]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Update tests to handle new interpretation of quiet_level.
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Oct 2019 17:23:11 +0000 (13:23 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 Oct 2019 11:50:13 +0000 (07:50 -0400)
Two things needed to be changed.  First, we used to set quiet_level
to the default (QUIET_NONE) when running tests, since we would not
call anything that acted based upon it.  But since we sometimes call
options_init_logs(), we need to pre-set quiet_level to QUIET_SILENT
in the logs so that we don't add the default logs.  This did not
cause test failure: just unwanted logs.

Second, we had a test that checked whether options_validate was
messing with options->Logs correctly.  Since options_validate no
longer messes with the logs, we no longer want a test for this.

src/test/test_options.c
src/test/testing_common.c

index 69407a999b4486bd87951b016e17c54281dfc0bc..0a7cd03e57439620e5ebd198fb56a76d3b6c15bb 100644 (file)
@@ -678,8 +678,7 @@ test_options_validate__logs(void *ignored)
   tdata->opt->RunAsDaemon = 0;
 
   ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
-  tt_str_op(tdata->opt->Logs->key, OP_EQ, "Log");
-  tt_str_op(tdata->opt->Logs->value, OP_EQ, "notice stdout");
+  tt_assert(!tdata->opt->Logs);
   tor_free(msg);
   tt_int_op(ret, OP_EQ, -1);
 
@@ -689,8 +688,7 @@ test_options_validate__logs(void *ignored)
   tdata->opt->RunAsDaemon = 0;
   quiet_level = 1;
   ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
-  tt_str_op(tdata->opt->Logs->key, OP_EQ, "Log");
-  tt_str_op(tdata->opt->Logs->value, OP_EQ, "warn stdout");
+  tt_assert(!tdata->opt->Logs);
   tor_free(msg);
   tt_int_op(ret, OP_EQ, -1);
 
index ff6028ddb4b4dc43fa7a06f1b02b3b978992897c..e14a169407bf01964351b2c792161ae32242918f 100644 (file)
@@ -272,6 +272,9 @@ main(int c, const char **v)
 
   control_initialize_event_queue();
 
+  /* Don't add default logs; the tests manage their own. */
+  quiet_level = QUIET_SILENT;
+
   for (i_out = i = 1; i < c; ++i) {
     if (!strcmp(v[i], "--warn")) {
       loglevel = LOG_WARN;