[tor-commits] [tor/master] Storagedir test fix: save strings in binary mode to preserve length

nickm at torproject.org nickm at torproject.org
Mon Mar 27 13:29:08 UTC 2017


commit e79f90c7f031b8a7825574f865c77d7034b93a16
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Mar 27 15:27:52 2017 +0200

    Storagedir test fix: save strings in binary mode to preserve length
---
 src/test/test_storagedir.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c
index 77ed5bf..6678629 100644
--- a/src/test/test_storagedir.c
+++ b/src/test/test_storagedir.c
@@ -172,17 +172,17 @@ test_storagedir_full(void *arg)
   d = storage_dir_new(dirname, 3);
   tt_assert(d);
 
-  r = storage_dir_save_string_to_file(d, str, 0, NULL);
+  r = storage_dir_save_string_to_file(d, str, 1, NULL);
   tt_int_op(r, OP_EQ, 0);
-  r = storage_dir_save_string_to_file(d, str, 0, NULL);
+  r = storage_dir_save_string_to_file(d, str, 1, NULL);
   tt_int_op(r, OP_EQ, 0);
-  r = storage_dir_save_string_to_file(d, str, 0, NULL);
+  r = storage_dir_save_string_to_file(d, str, 1, NULL);
   tt_int_op(r, OP_EQ, 0);
 
   // These should fail!
-  r = storage_dir_save_string_to_file(d, str, 0, NULL);
+  r = storage_dir_save_string_to_file(d, str, 1, NULL);
   tt_int_op(r, OP_EQ, -1);
-  r = storage_dir_save_string_to_file(d, str, 0, NULL);
+  r = storage_dir_save_string_to_file(d, str, 1, NULL);
   tt_int_op(r, OP_EQ, -1);
 
   tt_u64_op(strlen(str) * 3, OP_EQ, storage_dir_get_usage(d));
@@ -212,7 +212,7 @@ test_storagedir_cleaning(void *arg)
   tt_assert(d);
 
   for (i = 0; i < 8; ++i) {
-    r = storage_dir_save_string_to_file(d, str+i*2, 0, &fns[i]);
+    r = storage_dir_save_string_to_file(d, str+i*2, 1, &fns[i]);
     tt_int_op(r, OP_EQ, 0);
   }
 



More information about the tor-commits mailing list