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

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Thu Jan 10 08:49:57 CET 2008


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.




More information about the Commits mailing list