SF.net SVN: nagiosplug: [1905] nagiosplug/trunk/lib/tests/test_cmd.c

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 1905
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1905&view=rev
Author:   dermoth
Date:     2008-01-09 23:49:56 -0800 (Wed, 09 Jan 2008)

Log Message:
-----------
Add a return-code check (also test cmd_run without out/err buffers)

Modified Paths:
--------------
    nagiosplug/trunk/lib/tests/test_cmd.c

Modified: nagiosplug/trunk/lib/tests/test_cmd.c
===================================================================
--- nagiosplug/trunk/lib/tests/test_cmd.c	2008-01-09 04:27:52 UTC (rev 1904)
+++ nagiosplug/trunk/lib/tests/test_cmd.c	2008-01-10 07:49:56 UTC (rev 1905)
@@ -51,7 +51,7 @@
 	int c;
 	int result = UNSET;
 
-	plan_tests(50);
+	plan_tests(51);
 
 	diag ("Running plain echo command, set one");
 
@@ -206,6 +206,16 @@
 
 
 	/* ensure everything is empty again */
+	result = UNSET;
+
+	command = (char *)malloc(COMMAND_LINE);
+  strcpy(command, "/bin/sh -c 'exit 7'");
+  result = cmd_run (command, NULL, NULL, 0);
+
+  ok (result == 7, "Get return code 7 from /bin/sh");
+
+
+	/* ensure everything is empty again */
 	memset (&chld_out, 0, sizeof (output));
 	memset (&chld_err, 0, sizeof (output));
 	result = UNSET;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.