[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix unit test failure introduced by #20002



commit 075c52084dbcf09cc73efbc2bbf34c7148314329
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Sep 7 13:40:38 2016 -0400

    Fix unit test failure introduced by #20002
    
    Updating the consensus algorithm made a non-valid node never get
    listed, which messed up some other tests.
---
 src/test/test_dir.c        | 6 +++---
 src/test/test_dir_common.c | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index bfd89a9..09c3e05 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -1714,8 +1714,8 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now)
     tt_int_op(rs->addr,OP_EQ, 0x99008801);
     tt_int_op(rs->or_port,OP_EQ, 443);
     tt_int_op(rs->dir_port,OP_EQ, 8000);
-    /* no flags except "running" (16) and "v2dir" (64) */
-    tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(80));
+    /* no flags except "running" (16) and "v2dir" (64) and "valid" (128) */
+    tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(0xd0));
   } else if (tor_memeq(rs->identity_digest,
                        "\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5"
                        "\x5\x5\x5\x5",
@@ -1812,7 +1812,7 @@ test_routerstatus_for_v3ns(routerstatus_t *rs, time_t now)
     tt_assert(!rs->is_stable);
     /* (If it wasn't running it wouldn't be here) */
     tt_assert(rs->is_flagged_running);
-    tt_assert(!rs->is_valid);
+    tt_assert(rs->is_valid);
     tt_assert(!rs->is_named);
     tt_assert(rs->is_v2_dir);
     /* XXXX check version */
diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c
index 2448d30..ca43dd4 100644
--- a/src/test/test_dir_common.c
+++ b/src/test/test_dir_common.c
@@ -89,6 +89,7 @@ dir_common_gen_routerstatus_for_v3ns(int idx, time_t now)
       /* all flags but running and v2dir cleared */
       rs->is_flagged_running = 1;
       rs->is_v2_dir = 1;
+      rs->is_valid = 1; /* xxxxx */
       break;
     case 1:
       /* Generate the second routerstatus. */

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits