aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_config.c
diff options
context:
space:
mode:
authorJ. Ryan Stinnett <jryans@gmail.com>2016-12-04 22:26:52 -0600
committerJ. Ryan Stinnett <jryans@gmail.com>2016-12-06 11:11:43 -1000
commit9b2b799d82e00286145d42b9c59cb4f820e4f8c7 (patch)
treee85a73b242499c5e82de56a99af6c6e69728b8c1 /src/test/test_config.c
parent8a0ea3ee43da0063c2546092662fa7ce4900bc2c (diff)
downloadtor-9b2b799d82e00286145d42b9c59cb4f820e4f8c7.tar.gz
tor-9b2b799d82e00286145d42b9c59cb4f820e4f8c7.zip
Accept non-space whitespace characters in log severity syntax.
Adds a test_config_parse_log_severity unit test to verify behavior. Fixes #19965.
Diffstat (limited to 'src/test/test_config.c')
-rw-r--r--src/test/test_config.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 2fc37b0bb8..bf2beb8206 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -4890,6 +4890,33 @@ test_config_parse_port_config__ports__server_options(void *data)
config_free_lines(config_port_valid); config_port_valid = NULL;
}
+static void
+test_config_parse_log_severity(void *data)
+{
+ int ret;
+ const char *severity_log_lines[] = {
+ "debug file /tmp/debug.log",
+ "debug\tfile /tmp/debug.log",
+ "[handshake]debug [~net,~mm]info notice stdout",
+ "[handshake]debug\t[~net,~mm]info\tnotice\tstdout",
+ NULL
+ };
+ int i;
+ log_severity_list_t *severity;
+
+ (void) data;
+
+ severity = tor_malloc(sizeof(log_severity_list_t));
+ for (i = 0; severity_log_lines[i]; i++) {
+ memset(severity, 0, sizeof(log_severity_list_t));
+ ret = parse_log_severity_config(&severity_log_lines[i], severity);
+ tt_int_op(ret, OP_EQ, 0);
+ }
+
+ done:
+ tor_free(severity);
+}
+
#define CONFIG_TEST(name, flags) \
{ #name, test_config_ ## name, flags, NULL, NULL }
@@ -4916,6 +4943,6 @@ struct testcase_t config_tests[] = {
CONFIG_TEST(parse_port_config__ports__no_ports_given, 0),
CONFIG_TEST(parse_port_config__ports__server_options, 0),
CONFIG_TEST(parse_port_config__ports__ports_given, 0),
+ CONFIG_TEST(parse_log_severity, 0),
END_OF_TESTCASES
};
-