aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_consdiffmgr.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-04-16 12:01:45 -0400
committerNick Mathewson <nickm@torproject.org>2017-04-24 11:01:40 -0400
commitde0142cd9d980e3f08caf48d2c0b42c4149c1230 (patch)
treee4a0d774961c6cb354efcde927af1ccd9e335e13 /src/test/test_consdiffmgr.c
parent43d683e0ad46b7914ef0e629dc7b953fcdd1f411 (diff)
downloadtor-de0142cd9d980e3f08caf48d2c0b42c4149c1230.tar.gz
tor-de0142cd9d980e3f08caf48d2c0b42c4149c1230.zip
Expand diff-management test to cover reloading items from disk
Diffstat (limited to 'src/test/test_consdiffmgr.c')
-rw-r--r--src/test/test_consdiffmgr.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index 4be36a4a45..f3cce2362d 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -174,6 +174,14 @@ lookup_apply_and_verify_diff(consensus_flavor_t flav,
return match ? 0 : -1;
}
+static void
+cdm_reload(void)
+{
+ consdiffmgr_free_all();
+ cdm_cache_get();
+ consdiffmgr_rescan();
+}
+
// ============================== Beginning of tests
#if 0
@@ -451,6 +459,23 @@ test_consdiffmgr_diff_rules(void *arg)
tt_int_op(0, OP_EQ,
lookup_apply_and_verify_diff(FLAV_NS, ns_body[2], ns_body[5]));
+ /* Finally: reload, and make sure that the information is still indexed */
+ cdm_reload();
+
+ tt_int_op(0, OP_EQ,
+ lookup_apply_and_verify_diff(FLAV_NS, ns_body[0], ns_body[5]));
+ tt_int_op(0, OP_EQ,
+ lookup_apply_and_verify_diff(FLAV_NS, ns_body[2], ns_body[5]));
+ tt_int_op(0, OP_EQ,
+ lookup_apply_and_verify_diff(FLAV_NS, ns_body[1], ns_body[5]));
+
+ tt_int_op(0, OP_EQ,
+ lookup_apply_and_verify_diff(FLAV_MICRODESC, md_body[1], md_body[4]));
+ tt_int_op(0, OP_EQ,
+ lookup_apply_and_verify_diff(FLAV_MICRODESC, md_body[2], md_body[4]));
+ tt_int_op(0, OP_EQ,
+ lookup_apply_and_verify_diff(FLAV_MICRODESC, md_body[3], md_body[4]));
+
done:
for (i = 0; i < N; ++i) {
tor_free(md_body[i]);
@@ -680,7 +705,6 @@ struct testcase_t consdiffmgr_tests[] = {
// in cdm_diff_ht_purge().
// XXXX Test: cdm_entry_get_sha3_value cases.
// XXXX Test: sha3 mismatch on validation
- // XXXX Test: initial loading of diffs from disk.
// XXXX Test: non-cacheing cases of replyfn().
END_OF_TESTCASES