diff options
author | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-04-28 09:00:05 (GMT) |
---|---|---|
committer | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-04-28 09:00:05 (GMT) |
commit | 34c4d13edd8ece1e928c578974218c10d25600c4 (patch) | |
tree | 96eaf64dc46c8b785d437250d42471180597a699 /lib/tests/test_cmd.c | |
parent | e4ddeb7bb722b50613108da1cb51a48e84068701 (diff) | |
parent | 7cb82e6486e662fa4d2530523787d3eced266545 (diff) | |
download | monitoring-plugins-34c4d13.tar.gz |
Merge branch 'master' into RincewindsHat-patch-1
Diffstat (limited to 'lib/tests/test_cmd.c')
-rw-r--r-- | lib/tests/test_cmd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index 29ca42a..4bb60aa 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c | |||
@@ -176,14 +176,14 @@ main (int argc, char **argv) | |||
176 | ok (result == UNSET, "(initialised) Checking exit code is reset"); | 176 | ok (result == UNSET, "(initialised) Checking exit code is reset"); |
177 | 177 | ||
178 | command = (char *)malloc(COMMAND_LINE); | 178 | command = (char *)malloc(COMMAND_LINE); |
179 | strcpy(command, "/bin/echo3456 non-existant command"); | 179 | strcpy(command, "/bin/echo3456 non-existent command"); |
180 | result = cmd_run (command, &chld_out, &chld_err, 0); | 180 | result = cmd_run (command, &chld_out, &chld_err, 0); |
181 | 181 | ||
182 | ok (chld_out.lines == 0, | 182 | ok (chld_out.lines == 0, |
183 | "Non existant command, so no output"); | 183 | "Non existent command, so no output"); |
184 | ok (chld_err.lines == 0, | 184 | ok (chld_err.lines == 0, |
185 | "No stderr either"); | 185 | "No stderr either"); |
186 | ok (result == 3, "Get return code 3 (?) for non-existant command"); | 186 | ok (result == 3, "Get return code 3 (?) for non-existent command"); |
187 | 187 | ||
188 | 188 | ||
189 | /* ensure everything is empty again */ | 189 | /* ensure everything is empty again */ |
@@ -192,14 +192,14 @@ main (int argc, char **argv) | |||
192 | result = UNSET; | 192 | result = UNSET; |
193 | 193 | ||
194 | command = (char *)malloc(COMMAND_LINE); | 194 | command = (char *)malloc(COMMAND_LINE); |
195 | strcpy(command, "/bin/sh non-existant-file"); | 195 | strcpy(command, "/bin/sh non-existent-file"); |
196 | result = cmd_run (command, &chld_out, &chld_err, 0); | 196 | result = cmd_run (command, &chld_out, &chld_err, 0); |
197 | 197 | ||
198 | ok (chld_out.lines == 0, | 198 | ok (chld_out.lines == 0, |
199 | "/bin/sh returns no stdout when file is missing..."); | 199 | "/bin/sh returns no stdout when file is missing..."); |
200 | ok (chld_err.lines == 1, | 200 | ok (chld_err.lines == 1, |
201 | "...but does give an error line"); | 201 | "...but does give an error line"); |
202 | ok (strstr(chld_err.line[0],"non-existant-file") != NULL, "And missing filename is in error message"); | 202 | ok (strstr(chld_err.line[0],"non-existent-file") != NULL, "And missing filename is in error message"); |
203 | ok (result != 0, "Get non-zero return code from /bin/sh"); | 203 | ok (result != 0, "Get non-zero return code from /bin/sh"); |
204 | 204 | ||
205 | 205 | ||
@@ -219,11 +219,11 @@ main (int argc, char **argv) | |||
219 | result = UNSET; | 219 | result = UNSET; |
220 | 220 | ||
221 | command = (char *)malloc(COMMAND_LINE); | 221 | command = (char *)malloc(COMMAND_LINE); |
222 | strcpy(command, "/bin/non-existant-command"); | 222 | strcpy(command, "/bin/non-existent-command"); |
223 | result = cmd_run (command, &chld_out, &chld_err, 0); | 223 | result = cmd_run (command, &chld_out, &chld_err, 0); |
224 | 224 | ||
225 | ok (chld_out.lines == 0, | 225 | ok (chld_out.lines == 0, |
226 | "/bin/non-existant-command returns no stdout..."); | 226 | "/bin/non-existent-command returns no stdout..."); |
227 | ok (chld_err.lines == 0, | 227 | ok (chld_err.lines == 0, |
228 | "...and no stderr output either"); | 228 | "...and no stderr output either"); |
229 | ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist"); | 229 | ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist"); |