diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-05-10 09:19:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-10 09:19:28 -0400 |
commit | ba70439210c57b0e0e60b07f116f101725085d85 (patch) | |
tree | 8f7ad521ef29526e9d1beb890c0c771a3da850a6 /src | |
parent | aa08c197034a7dcd061f3c205a29dc1cb09641d3 (diff) | |
parent | edb6acf9cee42406cfa8380c898b7b664f699b8d (diff) | |
download | tor-ba70439210c57b0e0e60b07f116f101725085d85.tar.gz tor-ba70439210c57b0e0e60b07f116f101725085d85.zip |
Merge branch 'maint-0.2.9' into maint-0.3.1
Diffstat (limited to 'src')
-rw-r--r-- | src/test/test_dir.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c index a9d9cba7df..1ead6d78c2 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -1552,6 +1552,25 @@ test_dir_measured_bw_kb(void *arg) return; } +/* Test dirserv_read_measured_bandwidths */ +static void +test_dir_dirserv_read_measured_bandwidths(void *arg) +{ + char *fname=NULL; + (void)arg; + + fname = tor_strdup(get_fname("V3BandwidthsFile")); + /* Test an empty file */ + write_str_to_file(fname, "", 0); + setup_capture_of_logs(LOG_WARN); + tt_int_op(-1, OP_EQ, dirserv_read_measured_bandwidths(fname, NULL)); + expect_log_msg("Empty bandwidth file\n"); + + done: + tor_free(fname); + teardown_capture_of_logs(); +} + #define MBWC_INIT_TIME 1000 /** Do the measured bandwidth cache unit test */ @@ -6000,6 +6019,7 @@ struct testcase_t dir_tests[] = { DIR_LEGACY(versions), DIR_LEGACY(fp_pairs), DIR(split_fps, 0), + DIR_LEGACY(dirserv_read_measured_bandwidths), DIR_LEGACY(measured_bw_kb), DIR_LEGACY(measured_bw_kb_cache), DIR_LEGACY(param_voting), |