summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_opts.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests/test_opts.c')
-rw-r--r--lib/tests/test_opts.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/tests/test_opts.c b/lib/tests/test_opts.c
index 61370a9c..e878abd8 100644
--- a/lib/tests/test_opts.c
+++ b/lib/tests/test_opts.c
@@ -59,7 +59,7 @@ main (int argc, char **argv)
59 char **argv_test=NULL, **argv_known=NULL; 59 char **argv_test=NULL, **argv_known=NULL;
60 int i, argc_test; 60 int i, argc_test;
61 61
62 plan_tests(12); 62 plan_tests(9);
63 63
64 argv_test=(char **)malloc(2*sizeof(char **)); 64 argv_test=(char **)malloc(2*sizeof(char **));
65 argv_test[0] = "prog_name"; 65 argv_test[0] = "prog_name";
@@ -145,10 +145,10 @@ main (int argc, char **argv)
145 ok(array_diff(argc_test, argv_test, 7, argv_known), "twice extra opts using two sections"); 145 ok(array_diff(argc_test, argv_test, 7, argv_known), "twice extra opts using two sections");
146 my_free(&argc_test,argv_test); 146 my_free(&argc_test,argv_test);
147 147
148 /* Next three checks should die according to N::P - for now they're useful 148 /* Next three checks dre expected to die. They are commented out as they
149 * to test code is working properly (i.e. no srash or unexpected behavior) 149 * could possibly go in a sepatare test checked for return value.
150 */ 150 */
151 argv_test=(char **)malloc(6*sizeof(char **)); 151 /* argv_test=(char **)malloc(6*sizeof(char **));
152 argv_test[0] = "prog_name"; 152 argv_test[0] = "prog_name";
153 argv_test[1] = "arg1"; 153 argv_test[1] = "arg1";
154 argv_test[2] = "--extra-opts=missing@./config-opts.ini"; 154 argv_test[2] = "--extra-opts=missing@./config-opts.ini";
@@ -164,9 +164,9 @@ main (int argc, char **argv)
164 argv_known[4] = NULL; 164 argv_known[4] = NULL;
165 argv_test=np_extra_opts(&argc_test, argv_test, "check_missing"); 165 argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
166 ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 1"); 166 ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 1");
167 my_free(&argc_test,argv_test); 167 my_free(&argc_test,argv_test); */
168 168
169 argv_test=(char **)malloc(7*sizeof(char **)); 169 /* argv_test=(char **)malloc(7*sizeof(char **));
170 argv_test[0] = "prog_name"; 170 argv_test[0] = "prog_name";
171 argv_test[1] = "arg1"; 171 argv_test[1] = "arg1";
172 argv_test[2] = "--extra-opts"; 172 argv_test[2] = "--extra-opts";
@@ -183,9 +183,9 @@ main (int argc, char **argv)
183 argv_known[4] = NULL; 183 argv_known[4] = NULL;
184 argv_test=np_extra_opts(&argc_test, argv_test, "check_missing"); 184 argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
185 ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 2"); 185 ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 2");
186 my_free(&argc_test,argv_test); 186 my_free(&argc_test,argv_test); */
187 187
188 argv_test=(char **)malloc(6*sizeof(char **)); 188 /* argv_test=(char **)malloc(6*sizeof(char **));
189 argv_test[0] = "prog_name"; 189 argv_test[0] = "prog_name";
190 argv_test[1] = "arg1"; 190 argv_test[1] = "arg1";
191 argv_test[2] = "--extra-opts"; 191 argv_test[2] = "--extra-opts";
@@ -201,7 +201,7 @@ main (int argc, char **argv)
201 argv_known[4] = NULL; 201 argv_known[4] = NULL;
202 argv_test=np_extra_opts(&argc_test, argv_test, "check_missing"); 202 argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
203 ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 3"); 203 ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 3");
204 my_free(&argc_test,argv_test); 204 my_free(&argc_test,argv_test); */
205 205
206 setenv("NAGIOS_CONFIG_PATH", ".", 1); 206 setenv("NAGIOS_CONFIG_PATH", ".", 1);
207 argv_test=(char **)malloc(6*sizeof(char **)); 207 argv_test=(char **)malloc(6*sizeof(char **));
@@ -257,8 +257,8 @@ main (int argc, char **argv)
257 argv_test=(char **)malloc(6*sizeof(char **)); 257 argv_test=(char **)malloc(6*sizeof(char **));
258 argv_test[0] = "prog_name"; 258 argv_test[0] = "prog_name";
259 argv_test[1] = "arg1"; 259 argv_test[1] = "arg1";
260 argv_test[2] = "--extra-opts=section2"; 260 argv_test[2] = "--extra-opts";
261 argv_test[3] = "--arg3"; 261 argv_test[3] = "-arg3";
262 argv_test[4] = "val2"; 262 argv_test[4] = "val2";
263 argv_test[5] = NULL; 263 argv_test[5] = NULL;
264 argc_test=5; 264 argc_test=5;
@@ -266,11 +266,11 @@ main (int argc, char **argv)
266 argv_known[0] = "prog_name"; 266 argv_known[0] = "prog_name";
267 argv_known[1] = "--foo=bar"; 267 argv_known[1] = "--foo=bar";
268 argv_known[2] = "arg1"; 268 argv_known[2] = "arg1";
269 argv_known[3] = "--arg3"; 269 argv_known[3] = "-arg3";
270 argv_known[4] = "val2"; 270 argv_known[4] = "val2";
271 argv_known[5] = NULL; 271 argv_known[5] = NULL;
272 argv_test=np_extra_opts(&argc_test, argv_test, "check_disk"); 272 argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
273 ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 3"); 273 ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 4");
274 my_free(&argc_test,argv_test); 274 my_free(&argc_test,argv_test);
275 275
276 return exit_status(); 276 return exit_status();