aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-03-27 15:27:52 +0200
committerNick Mathewson <nickm@torproject.org>2017-03-27 15:27:52 +0200
commite79f90c7f031b8a7825574f865c77d7034b93a16 (patch)
tree16fe727d9338dbaff7c4eb6e1ec656691e2b3c16
parent10888dcac6cd1b32914da4d25c5dcc42e91a6239 (diff)
downloadtor-e79f90c7f031b8a7825574f865c77d7034b93a16.tar.gz
tor-e79f90c7f031b8a7825574f865c77d7034b93a16.zip
Storagedir test fix: save strings in binary mode to preserve length
-rw-r--r--src/test/test_storagedir.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c
index 77ed5bf129..6678629df6 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);
}