[tor-commits] [tor/master] Add an extra check to test_dir to try to debug windows jenkins issue

nickm at torproject.org nickm at torproject.org
Fri Jul 1 14:10:58 UTC 2016


commit 738a8c655a1f8067b330b132164fa8879ef102c3
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 1 10:10:55 2016 -0400

    Add an extra check to test_dir to try to debug windows jenkins issue
---
 src/test/test_dir.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index a97ac7c..90b1864 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -4803,6 +4803,7 @@ test_dir_dump_unparseable_descriptors(void *data)
 
 /* Variables for reset_read_file_to_str_mock() */
 
+static int enforce_expected_filename = 0;
 static char *expected_filename = NULL;
 static char *file_content = NULL;
 static size_t file_content_len = 0;
@@ -4834,6 +4835,11 @@ read_file_to_str_mock(const char *filename, int flags,
   /* Bump the call count */
   ++read_call_count;
 
+  if (enforce_expected_filename) {
+    tt_assert(expected_filename);
+    tt_str_op(filename, OP_EQ, expected_filename);
+  }
+
   if (expected_filename != NULL &&
       file_content != NULL &&
       strcmp(filename, expected_filename) == 0) {
@@ -4948,11 +4954,13 @@ test_dir_populate_dump_desc_fifo(void *data)
   fname =
     "unparseable-desc."
     "DF0981323F3A70D02B55AB54B44B04F287D72F7B72F242E85C8CB0EDA8854A99";
+  enforce_expected_filename = 1;
   tor_asprintf(&expected_filename, "%s%s%s", dirname, PATH_SEPARATOR, fname);
   file_content = tor_strdup("hanc culpam maiorem an illam dicam?");
   file_content_len = strlen(file_content);
   file_stat.st_mtime = 123456;
   ent = dump_desc_populate_one_file(dirname, fname);
+  enforce_expected_filename = 0;
   tt_assert(ent == NULL);
   tt_int_op(unlinked_count, ==, 8);
   tt_int_op(read_count, ==, 1);



More information about the tor-commits mailing list