aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_dir.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-10 09:19:28 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-10 09:19:28 -0400
commit2eff709edb52e2bf6565dd8d00d7f2b79a05e60c (patch)
tree7e67350b63b550adde83b9b1e90c050a3a797662 /src/test/test_dir.c
parent1eede00a4bd9a7de2acf77393f2fc57aa3196d08 (diff)
parentf64fa6b19ec7663f47e600599761fadbde4135e9 (diff)
downloadtor-2eff709edb52e2bf6565dd8d00d7f2b79a05e60c.tar.gz
tor-2eff709edb52e2bf6565dd8d00d7f2b79a05e60c.zip
Merge branch 'maint-0.3.3'
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r--src/test/test_dir.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 77ba6e3bb4..0106e40d97 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -1562,6 +1562,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 */
@@ -5830,6 +5849,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),