summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-03-26 16:54:00 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-03-26 16:54:00 +0100
commit3b9f09d48beb9b71386153fb16b168c1af3c9a19 (patch)
tree4ebbc1cfb52c3cc292d6019fa234ed422bb7f612 /lib/tests
parent36f4495deee8611f2fc4c62e54616d52f5c25979 (diff)
downloadmonitoring-plugins-3b9f09d48beb9b71386153fb16b168c1af3c9a19.tar.gz
Fix tests
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/test_cmd.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c
index 29ca42ac..d67c4d57 100644
--- a/lib/tests/test_cmd.c
+++ b/lib/tests/test_cmd.c
@@ -40,13 +40,11 @@ get_command (char *const *line)
40} 40}
41 41
42int 42int
43main (int argc, char **argv) 43main ()
44{ 44{
45 char **command_line = malloc (sizeof (char *) * COMMAND_LINE); 45 char **command_line = malloc (sizeof (char *) * COMMAND_LINE);
46 char *command = NULL; 46 char *command = NULL;
47 char *perl; 47 cmd_output chld_out, chld_err;
48 output chld_out, chld_err;
49 int c;
50 int result = UNSET; 48 int result = UNSET;
51 49
52 plan_tests(51); 50 plan_tests(51);
@@ -54,8 +52,8 @@ main (int argc, char **argv)
54 diag ("Running plain echo command, set one"); 52 diag ("Running plain echo command, set one");
55 53
56 /* ensure everything is empty before we begin */ 54 /* ensure everything is empty before we begin */
57 memset (&chld_out, 0, sizeof (output)); 55 memset (&chld_out, 0, sizeof (cmd_output));
58 memset (&chld_err, 0, sizeof (output)); 56 memset (&chld_err, 0, sizeof (cmd_output));
59 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); 57 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
60 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); 58 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
61 ok (result == UNSET, "(initialised) Checking exit code is reset"); 59 ok (result == UNSET, "(initialised) Checking exit code is reset");
@@ -78,8 +76,8 @@ main (int argc, char **argv)
78 ok (result == 0, "(array) Checking exit code"); 76 ok (result == 0, "(array) Checking exit code");
79 77
80 /* ensure everything is empty again */ 78 /* ensure everything is empty again */
81 memset (&chld_out, 0, sizeof (output)); 79 memset (&chld_out, 0, sizeof (cmd_output));
82 memset (&chld_err, 0, sizeof (output)); 80 memset (&chld_err, 0, sizeof (cmd_output));
83 result = UNSET; 81 result = UNSET;
84 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); 82 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
85 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); 83 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
@@ -98,8 +96,8 @@ main (int argc, char **argv)
98 diag ("Running plain echo command, set two"); 96 diag ("Running plain echo command, set two");
99 97
100 /* ensure everything is empty again */ 98 /* ensure everything is empty again */
101 memset (&chld_out, 0, sizeof (output)); 99 memset (&chld_out, 0, sizeof (cmd_output));
102 memset (&chld_err, 0, sizeof (output)); 100 memset (&chld_err, 0, sizeof (cmd_output));
103 result = UNSET; 101 result = UNSET;
104 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); 102 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
105 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); 103 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
@@ -121,8 +119,8 @@ main (int argc, char **argv)
121 ok (result == 0, "(array) Checking exit code"); 119 ok (result == 0, "(array) Checking exit code");
122 120
123 /* ensure everything is empty again */ 121 /* ensure everything is empty again */
124 memset (&chld_out, 0, sizeof (output)); 122 memset (&chld_out, 0, sizeof (cmd_output));
125 memset (&chld_err, 0, sizeof (output)); 123 memset (&chld_err, 0, sizeof (cmd_output));
126 result = UNSET; 124 result = UNSET;
127 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); 125 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
128 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); 126 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
@@ -140,8 +138,8 @@ main (int argc, char **argv)
140 138
141 139
142 /* ensure everything is empty again */ 140 /* ensure everything is empty again */
143 memset (&chld_out, 0, sizeof (output)); 141 memset (&chld_out, 0, sizeof (cmd_output));
144 memset (&chld_err, 0, sizeof (output)); 142 memset (&chld_err, 0, sizeof (cmd_output));
145 result = UNSET; 143 result = UNSET;
146 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); 144 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
147 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); 145 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
@@ -168,8 +166,8 @@ main (int argc, char **argv)
168 166
169 167
170 /* ensure everything is empty again */ 168 /* ensure everything is empty again */
171 memset (&chld_out, 0, sizeof (output)); 169 memset (&chld_out, 0, sizeof (cmd_output));
172 memset (&chld_err, 0, sizeof (output)); 170 memset (&chld_err, 0, sizeof (cmd_output));
173 result = UNSET; 171 result = UNSET;
174 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); 172 ok (chld_out.lines == 0, "(initialised) Checking stdout is reset");
175 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); 173 ok (chld_err.lines == 0, "(initialised) Checking stderr is reset");
@@ -187,8 +185,8 @@ main (int argc, char **argv)
187 185
188 186
189 /* ensure everything is empty again */ 187 /* ensure everything is empty again */
190 memset (&chld_out, 0, sizeof (output)); 188 memset (&chld_out, 0, sizeof (cmd_output));
191 memset (&chld_err, 0, sizeof (output)); 189 memset (&chld_err, 0, sizeof (cmd_output));
192 result = UNSET; 190 result = UNSET;
193 191
194 command = (char *)malloc(COMMAND_LINE); 192 command = (char *)malloc(COMMAND_LINE);
@@ -214,8 +212,8 @@ main (int argc, char **argv)
214 212
215 213
216 /* ensure everything is empty again */ 214 /* ensure everything is empty again */
217 memset (&chld_out, 0, sizeof (output)); 215 memset (&chld_out, 0, sizeof (cmd_output));
218 memset (&chld_err, 0, sizeof (output)); 216 memset (&chld_err, 0, sizeof (cmd_output));
219 result = UNSET; 217 result = UNSET;
220 218
221 command = (char *)malloc(COMMAND_LINE); 219 command = (char *)malloc(COMMAND_LINE);