[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Test fix: expect old consensuses to be deleted if not deflate-compressed
commit db370bb8a8fd65a902d3abd996ace019db4c296c
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri May 5 12:10:45 2017 -0400
Test fix: expect old consensuses to be deleted if not deflate-compressed
---
src/or/consdiffmgr.c | 2 +-
src/or/consdiffmgr.h | 1 +
src/test/test_consdiffmgr.c | 6 ++++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index ad63ce9..3e1edf0 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -108,7 +108,7 @@ static const compress_method_t compress_consensus_with[] = {
};
/** How many different methods will we try to use for diff compression? */
-static unsigned
+STATIC unsigned
n_consensus_compression_methods(void)
{
return ARRAY_LENGTH(compress_consensus_with);
diff --git a/src/or/consdiffmgr.h b/src/or/consdiffmgr.h
index 5f7e944..abe1ea9 100644
--- a/src/or/consdiffmgr.h
+++ b/src/or/consdiffmgr.h
@@ -46,6 +46,7 @@ int consdiffmgr_validate(void);
#ifdef CONSDIFFMGR_PRIVATE
STATIC unsigned n_diff_compression_methods(void);
+STATIC unsigned n_consensus_compression_methods(void);
STATIC consensus_cache_t *cdm_cache_get(void);
STATIC consensus_cache_entry_t *cdm_cache_lookup_consensus(
consensus_flavor_t flavor, time_t valid_after);
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index 9d0c5b5..2e5dd59 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -759,9 +759,11 @@ test_consdiffmgr_cleanup_old_diffs(void *arg)
consensus_cache_entry_incref(hold_ent); // incref, so it is preserved.
/* Now add an even-more-recent consensus; this should make all previous
- * diffs deletable */
+ * diffs deletable, and make delete */
tt_int_op(0, OP_EQ, consdiffmgr_add_consensus(md_body[3], md_ns[3]));
- tt_int_op(2 * n_diff_compression_methods(), OP_EQ, consdiffmgr_cleanup());
+ tt_int_op(2 * n_diff_compression_methods() +
+ (n_consensus_compression_methods() - 1) , OP_EQ,
+ consdiffmgr_cleanup());
tt_int_op(CONSDIFF_NOT_FOUND, OP_EQ,
lookup_diff_from(&ent, FLAV_MICRODESC, md_body[0]));
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits