tor_free(td);
}
+#define expect_log_msg(str) \
+ tt_assert_msg(mock_saved_log_has_message(str), \
+ "expected log to contain " # str);
+
+#define expect_no_log_msg(str) \
+ tt_assert_msg(!mock_saved_log_has_message(str), \
+ "expected log to not contain " # str);
+
static void
test_options_validate__uname_for_server(void *ignored)
{
MOCK(get_uname, fixed_get_uname);
fixed_get_uname_result = "Windows 95";
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Tor is running as a server, but you"
+ expect_log_msg("Tor is running as a server, but you"
" are running Windows 95; this probably won't work. See https://www"
".torproject.org/docs/faq.html#BestOSForRelay for details.\n");
tor_free(msg);
fixed_get_uname_result = "Windows 98";
mock_clean_saved_logs();
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Tor is running as a server, but you"
+ expect_log_msg("Tor is running as a server, but you"
" are running Windows 98; this probably won't work. See https://www"
".torproject.org/docs/faq.html#BestOSForRelay for details.\n");
tor_free(msg);
fixed_get_uname_result = "Windows Me";
mock_clean_saved_logs();
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Tor is running as a server, but you"
+ expect_log_msg("Tor is running as a server, but you"
" are running Windows Me; this probably won't work. See https://www"
".torproject.org/docs/faq.html#BestOSForRelay for details.\n");
tor_free(msg);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_EQ,
+ expect_log_msg(
"Your ContactInfo config option is not"
" set. Please consider setting it, so we can contact you if your"
" server is misconfigured or something else goes wrong.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_NE,
+ expect_no_log_msg(
"Your ContactInfo config option is not"
" set. Please consider setting it, so we can contact you if your"
" server is misconfigured or something else goes wrong.\n");
tt_int_op(ret, OP_EQ, -1);
tt_str_op(msg, OP_EQ, "Failed to resolve/guess local address. See logs for"
" details.");
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Could not resolve local Address "
+ expect_log_msg("Could not resolve local Address "
"'this.should.not_exist.example.org'. Failing.\n");
tor_free(msg);
"SchedulerLowWaterMark__ 10\n");
mock_clean_saved_logs();
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Authoritative directory servers "
+ expect_log_msg("Authoritative directory servers "
"can't set UseEntryGuards. Disabling.\n");
tt_int_op(tdata->opt->UseEntryGuards, OP_EQ, 0);
tor_free(msg);
"SchedulerLowWaterMark__ 10\n");
mock_clean_saved_logs();
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Authoritative directories always try"
+ expect_log_msg("Authoritative directories always try"
" to download extra-info documents. Setting DownloadExtraInfo.\n");
tt_int_op(tdata->opt->DownloadExtraInfo, OP_EQ, 1);
tor_free(msg);
"SchedulerLowWaterMark__ 10\n");
mock_clean_saved_logs();
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(0), OP_NE, "Authoritative directories always try"
+ expect_no_log_msg("Authoritative directories always try"
" to download extra-info documents. Setting DownloadExtraInfo.\n");
tt_int_op(tdata->opt->DownloadExtraInfo, OP_EQ, 1);
tor_free(msg);
);
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(1), OP_EQ,
+ expect_log_msg(
"Tor is currently configured as a relay and a hidden service. "
"That's not very secure: you should probably run your hidden servi"
"ce in a separate Tor process, at least -- see "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_EQ,
+ expect_log_msg(
"You have asked to exclude certain relays from all positions "
"in your circuits. Expect hidden services and other Tor "
"features to be broken in unpredictable ways.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_NE,
+ expect_no_log_msg(
"You have asked to exclude certain relays from all positions "
"in your circuits. Expect hidden services and other Tor "
"features to be broken in unpredictable ways.\n");
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_EQ,
- "Bad SchedulerLowWaterMark__ option\n");
+ expect_log_msg("Bad SchedulerLowWaterMark__ option\n");
tor_free(msg);
// TODO: this test cannot run on platforms where UINT32_MAX == UINT64_MAX.
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_EQ,
- "Bad SchedulerHighWaterMark option\n");
+ expect_log_msg("Bad SchedulerHighWaterMark option\n");
tor_free(msg);
done:
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_EQ,
- "Unrecognized TLSECGroup: Falling back to the default.\n");
+ expect_log_msg("Unrecognized TLSECGroup: Falling back to the default.\n");
tt_assert(!tdata->opt->TLSECGroup);
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_NE,
+ expect_no_log_msg(
"Unrecognized TLSECGroup: Falling back to the default.\n");
tt_assert(tdata->opt->TLSECGroup);
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(0), OP_NE,
+ expect_no_log_msg(
"Unrecognized TLSECGroup: Falling back to the default.\n");
tt_assert(tdata->opt->TLSECGroup);
tor_free(msg);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_NE, "Invalid RecommendedPackage line "
+ expect_no_log_msg("Invalid RecommendedPackage line "
"invalid-package-line will be ignored\n");
done:
tt_int_op(ret, OP_EQ, -1);
tt_assert(tdata->opt->PathsNeededToBuildCircuits > 0.24 &&
tdata->opt->PathsNeededToBuildCircuits < 0.26);
- tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ,
- "PathsNeededToBuildCircuits is too low. Increasing to 0.25\n");
+ expect_log_msg("PathsNeededToBuildCircuits is too low. Increasing to 0.25\n");
tor_free(msg);
free_options_test_data(tdata);
tt_int_op(ret, OP_EQ, -1);
tt_assert(tdata->opt->PathsNeededToBuildCircuits > 0.94 &&
tdata->opt->PathsNeededToBuildCircuits < 0.96);
- tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "PathsNeededToBuildCircuits is "
+ expect_log_msg("PathsNeededToBuildCircuits is "
"too high. Decreasing to 0.95\n");
tor_free(msg);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_int_op(mock_saved_log_number(), OP_EQ, 6);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "Converting FascistFirewall config "
+ expect_log_msg("Converting FascistFirewall config "
"option to new format: \"ReachableDirAddresses *:80\"\n");
tt_str_op(tdata->opt->ReachableDirAddresses->value, OP_EQ, "*:80");
- tt_str_op(mock_saved_log_at(2), OP_EQ, "Converting FascistFirewall config "
+ expect_log_msg("Converting FascistFirewall config "
"option to new format: \"ReachableORAddresses *:443\"\n");
tt_str_op(tdata->opt->ReachableORAddresses->value, OP_EQ, "*:443");
tor_free(msg);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_int_op(mock_saved_log_number(), OP_EQ, 5);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "Converting FascistFirewall and "
+ expect_log_msg("Converting FascistFirewall and "
"FirewallPorts config options to new format: "
"\"ReachableAddresses *:123\"\n");
tt_str_op(tdata->opt->ReachableAddresses->value, OP_EQ, "*:123");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "Can't set a DirPort on a bridge "
+ expect_log_msg("Can't set a DirPort on a bridge "
"relay; disabling DirPort\n");
tt_assert(!tdata->opt->DirPort_lines);
tt_assert(!tdata->opt->DirPort_set);
tdata->opt->MinUptimeHidServDirectoryV2 = -1;
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "MinUptimeHidServDirectoryV2 "
+ expect_log_msg("MinUptimeHidServDirectoryV2 "
"option must be at least 0 seconds. Changing to 0.\n");
tt_int_op(tdata->opt->MinUptimeHidServDirectoryV2, OP_EQ, 0);
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "RendPostPeriod option is too short;"
+ expect_log_msg("RendPostPeriod option is too short;"
" raising to 600 seconds.\n");
tt_int_op(tdata->opt->RendPostPeriod, OP_EQ, 600);
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "RendPostPeriod is too large; "
+ expect_log_msg("RendPostPeriod is too large; "
"clipping to 302400s.\n");
tt_int_op(tdata->opt->RendPostPeriod, OP_EQ, 302400);
tor_free(msg);
TEST_OPTIONS_DEFAULT_VALUES);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "PredictedPortsRelevanceTime is too "
+ expect_log_msg("PredictedPortsRelevanceTime is too "
"large; clipping to 3600s.\n");
tt_int_op(tdata->opt->PredictedPortsRelevanceTime, OP_EQ, 3600);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"MaxCircuitDirtiness 2592001\n");
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "MaxCircuitDirtiness option is too "
+ expect_log_msg("MaxCircuitDirtiness option is too "
"high; setting to 30 days.\n");
tt_int_op(tdata->opt->MaxCircuitDirtiness, OP_EQ, 2592000);
tor_free(msg);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"CircuitStreamTimeout 1\n");
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(2), OP_EQ, "CircuitStreamTimeout option is too"
+ expect_log_msg("CircuitStreamTimeout option is too"
" short; raising to 10 seconds.\n");
tt_int_op(tdata->opt->CircuitStreamTimeout, OP_EQ, 10);
tor_free(msg);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"CircuitStreamTimeout 111\n");
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(2), OP_NE, "CircuitStreamTimeout option is too"
+ expect_no_log_msg("CircuitStreamTimeout option is too"
" short; raising to 10 seconds.\n");
tt_int_op(tdata->opt->CircuitStreamTimeout, OP_EQ, 111);
tor_free(msg);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"HeartbeatPeriod 1\n");
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(2), OP_EQ, "HeartbeatPeriod option is too short;"
+ expect_log_msg("HeartbeatPeriod option is too short;"
" raising to 1800 seconds.\n");
tt_int_op(tdata->opt->HeartbeatPeriod, OP_EQ, 1800);
tor_free(msg);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"HeartbeatPeriod 1982\n");
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(2), OP_NE, "HeartbeatPeriod option is too short;"
+ expect_no_log_msg("HeartbeatPeriod option is too short;"
" raising to 1800 seconds.\n");
tt_int_op(tdata->opt->HeartbeatPeriod, OP_EQ, 1982);
tor_free(msg);
"CircuitBuildTimeout 1\n"
);
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "CircuitBuildTimeout is shorter (1"
+ expect_log_msg("CircuitBuildTimeout is shorter (1"
" seconds) than the recommended minimum (10 seconds), and "
"LearnCircuitBuildTimeout is disabled. If tor isn't working, "
"raise this value or enable LearnCircuitBuildTimeout.\n");
"CircuitBuildTimeout 11\n"
);
options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
- tt_str_op(mock_saved_log_at(1), OP_NE, "CircuitBuildTimeout is shorter (1 "
+ expect_no_log_msg("CircuitBuildTimeout is shorter (1 "
"seconds) than the recommended minimum (10 seconds), and "
"LearnCircuitBuildTimeout is disabled. If tor isn't working, "
"raise this value or enable LearnCircuitBuildTimeout.\n");
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(1), OP_EQ, "UseEntryGuards is disabled, but you"
+ expect_log_msg("UseEntryGuards is disabled, but you"
" have configured one or more hidden services on this Tor "
"instance. Your hidden services will be very easy to locate using"
" a well-known attack -- see http://freehaven.net/anonbib/#hs-"
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(1), OP_NE, "UseEntryGuards is disabled, but you"
+ expect_no_log_msg("UseEntryGuards is disabled, but you"
" have configured one or more hidden services on this Tor "
"instance. Your hidden services will be very easy to locate using"
" a well-known attack -- see http://freehaven.net/anonbib/#hs-"
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(4), OP_EQ, "Using accounting with a hidden "
+ expect_log_msg("Using accounting with a hidden "
"service and an ORPort is risky: your hidden service(s) and "
"your public address will all turn off at the same time, "
"which may alert observers that they are being run by the "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(4), OP_NE, "Using accounting with a hidden "
+ expect_no_log_msg("Using accounting with a hidden "
"service and an ORPort is risky: your hidden service(s) and "
"your public address will all turn off at the same time, "
"which may alert observers that they are being run by the "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(3), OP_EQ, "Using accounting with multiple "
+ expect_log_msg("Using accounting with multiple "
"hidden services is risky: they will all turn off at the same"
" time, which may alert observers that they are being run by "
"the same party.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ, "HTTPProxy configured, but no SOCKS "
+ expect_log_msg("HTTPProxy configured, but no SOCKS "
"proxy or HTTPS proxy configured. Watch out: this configuration "
"will proxy unencrypted directory connections only.\n");
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE, "HTTPProxy configured, but no SOCKS "
+ expect_no_log_msg("HTTPProxy configured, but no SOCKS "
"proxy or HTTPS proxy configured. Watch out: this configuration "
"will proxy unencrypted directory connections only.\n");
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE, "HTTPProxy configured, but no SOCKS "
+ expect_no_log_msg("HTTPProxy configured, but no SOCKS "
"proxy or HTTPS proxy configured. Watch out: this configuration "
"will proxy unencrypted directory connections only.\n");
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"HTTPProxy configured, but no SOCKS proxy or HTTPS proxy "
"configured. Watch out: this configuration will proxy "
"unencrypted directory connections only.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ,
+ expect_log_msg(
"ControlPort is open, but no authentication method has been "
"configured. This means that any program on your computer can "
"reconfigure your Tor. That's bad! You should upgrade your Tor"
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"ControlPort is open, but no authentication method has been "
"configured. This means that any program on your computer can "
"reconfigure your Tor. That's bad! You should upgrade your Tor "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"ControlPort is open, but no authentication method has been "
"configured. This means that any program on your computer can "
"reconfigure your Tor. That's bad! You should upgrade your Tor "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"ControlPort is open, but no authentication method has been "
"configured. This means that any program on your computer can "
"reconfigure your Tor. That's bad! You should upgrade your Tor "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ,
+ expect_log_msg(
"ControlSocket is world writable, but no authentication method has"
" been configured. This means that any program on your computer "
"can reconfigure your Tor. That's bad! You should upgrade your "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"ControlSocket is world writable, but no authentication method has"
" been configured. This means that any program on your computer "
"can reconfigure your Tor. That's bad! You should upgrade your "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"ControlSocket is world writable, but no authentication method has"
" been configured. This means that any program on your computer "
"can reconfigure your Tor. That's bad! You should upgrade your "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"ControlSocket is world writable, but no authentication method has"
" been configured. This means that any program on your computer "
"can reconfigure your Tor. That's bad! You should upgrade your "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ,
+ expect_log_msg(
"CookieAuthFileGroupReadable is set, but will have no effect: you "
"must specify an explicit CookieAuthFile to have it "
"group-readable.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"CookieAuthFileGroupReadable is set, but will have no effect: you "
"must specify an explicit CookieAuthFile to have it "
"group-readable.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ,
+ expect_log_msg(
"Listing a family for a bridge relay is not supported: it can "
"reveal bridge fingerprints to censors. You should also make sure "
"you aren't listing this bridge's fingerprint in any other "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"Listing a family for a bridge relay is not supported: it can "
"reveal bridge fingerprints to censors. You should also make sure "
"you aren't listing this bridge's fingerprint in any other "
tt_str_op(msg, OP_EQ,
"Directory authority/fallback line did not parse. See logs for "
"details.");
- tt_str_op(mock_saved_log_at(2), OP_EQ,
+ expect_log_msg(
"You cannot set both DirAuthority and Alternate*Authority.\n");
tor_free(msg);
tt_int_op(ret, OP_EQ, -1);
tt_str_op(msg, OP_EQ,
"Invalid client transport line. See logs for details.");
- tt_str_op(mock_saved_log_at(3), OP_EQ,
+ expect_log_msg(
"Too few arguments on ClientTransportPlugin line.\n");
tor_free(msg);
tt_int_op(ret, OP_EQ, -1);
tt_str_op(msg, OP_EQ,
"Invalid server transport line. See logs for details.");
- tt_str_op(mock_saved_log_at(3), OP_EQ,
+ expect_log_msg(
"Too few arguments on ServerTransportPlugin line.\n");
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(3), OP_EQ,
+ expect_log_msg(
"Tor is not configured as a relay but you specified a "
"ServerTransportPlugin line (\"foo exec bar\"). The "
"ServerTransportPlugin line will be ignored.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(3), OP_NE,
+ expect_no_log_msg(
"Tor is not configured as a relay but you specified a "
"ServerTransportPlugin line (\"foo exec bar\"). The "
"ServerTransportPlugin line will be ignored.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(3), OP_EQ,
+ expect_log_msg(
"You need at least a single managed-proxy to specify a transport "
"listen address. The ServerTransportListenAddr line will be "
"ignored.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(3), OP_NE,
+ expect_no_log_msg(
"You need at least a single managed-proxy to specify a transport "
"listen address. The ServerTransportListenAddr line will be "
"ignored.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ, "You have requested constrained "
+ expect_log_msg("You have requested constrained "
"socket buffers while also serving directory entries via DirPort."
" It is strongly suggested that you disable serving directory"
" requests when system TCP buffer resources are scarce.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE,
+ expect_no_log_msg(
"You have requested constrained socket buffers while also serving"
" directory entries via DirPort. It is strongly suggested that "
"you disable serving directory requests when system TCP buffer "
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ, "V3AuthVotingInterval does not divide"
+ expect_log_msg("V3AuthVotingInterval does not divide"
" evenly into 24 hours.\n");
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE, "V3AuthVotingInterval does not divide"
+ expect_no_log_msg("V3AuthVotingInterval does not divide"
" evenly into 24 hours.\n");
tor_free(msg);
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(3), OP_EQ, "V3AuthVotingInterval is very low. "
+ expect_log_msg("V3AuthVotingInterval is very low. "
"This may lead to failure to synchronise for a consensus.\n");
tor_free(msg);
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_EQ, "You have set AllowSingleHopExits; "
+ expect_log_msg("You have set AllowSingleHopExits; "
"now your relay will allow others to make one-hop exits. However,"
" since by default most clients avoid relays that set this option,"
" most clients will ignore you.\n");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
- tt_str_op(mock_saved_log_at(2), OP_NE, "You have set AllowSingleHopExits; "
+ expect_no_log_msg("You have set AllowSingleHopExits; "
"now your relay will allow others to make one-hop exits. However,"
" since by default most clients avoid relays that set this option,"
" most clients will ignore you.\n");
mock_clean_saved_logs(); \
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);\
tt_int_op(ret, OP_EQ, 0); \
- tt_str_op(mock_saved_log_at(3), OP_EQ, #name " is insanely high.\n"); \
+ expect_log_msg( #name " is insanely high.\n"); \
tor_free(msg); \
STMT_END