diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-01-10 07:49:56 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-01-10 07:49:56 +0000 |
commit | c51b6eea0e80048690a9f48b74d2caebead08a2f (patch) | |
tree | 0759c2b943a98c4e587f3975ce3dd05366243f9e | |
parent | 34fdd021f91e2f715e2a321132e72fd8bfa472e5 (diff) | |
download | monitoring-plugins-c51b6eea0e80048690a9f48b74d2caebead08a2f.tar.gz |
Add a return-code check (also test cmd_run without out/err buffers)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1905 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | lib/tests/test_cmd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index 0372c477..6b4bc35f 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c @@ -51,7 +51,7 @@ main (int argc, char **argv) int c; int result = UNSET; - plan_tests(50); + plan_tests(51); diag ("Running plain echo command, set one"); @@ -206,6 +206,16 @@ main (int argc, char **argv) /* 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; |