]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Check more return values in the unit tests
authorNick Mathewson <nickm@torproject.org>
Tue, 18 Jun 2013 16:31:03 +0000 (12:31 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 18 Jun 2013 16:31:03 +0000 (12:31 -0400)
src/test/test_config.c
src/test/test_dir.c

index ad30cdf78fabe8d6de364a7569759ea091274bde..4e9e13e4740f321c93ee92536f0fa63d0f457f9e 100644 (file)
@@ -202,9 +202,9 @@ test_config_check_or_create_data_subdir(void *arg)
   (void)arg;
 
 #if defined (_WIN32) && !defined (WINCE)
-  mkdir(options->DataDirectory);
+  tt_int_op(mkdir(options->DataDirectory), ==, 0);
 #else
-  mkdir(options->DataDirectory, 0700);
+  tt_int_op(mkdir(options->DataDirectory, 0700), ==, 0);
 #endif
 
   r = stat(subpath, &st);
@@ -266,14 +266,14 @@ test_config_write_to_data_subdir(void *arg)
   (void)arg;
 
 #if defined (_WIN32) && !defined (WINCE)
-  mkdir(options->DataDirectory);
+  tt_int_op(mkdir(options->DataDirectory), ==, 0);
 #else
-  mkdir(options->DataDirectory, 0700);
+  tt_int_op(mkdir(options->DataDirectory, 0700), ==, 0);
 #endif
 
   // Write attempt shoudl fail, if subdirectory doesn't exist.
   test_assert(write_to_data_subdir(subdir, fname, str, NULL));
-  check_or_create_data_subdir(subdir);
+  test_assert(! check_or_create_data_subdir(subdir));
 
   // Content of file after write attempt should be
   // equal to the original string.
@@ -285,7 +285,7 @@ test_config_write_to_data_subdir(void *arg)
   test_streq(read_file_to_str(filepath, 0, NULL), str);
 
  done:
-  remove(filepath);
+  (void) unlink(filepath);
   rmdir(options->DataDirectory);
   tor_free(datadir);
   tor_free(filepath);
index 56ac3b34c7f3c8d7c241c7da159e6d978c3b31cb..6c2915d09464dc46308aef71f354e33789c4795e 100644 (file)
@@ -2317,9 +2317,9 @@ test_dir_v2_dir(void *arg)
 
   /* Make a directory so there's somewhere to store the thing */
 #ifdef _WIN32
-  mkdir(get_fname("cached-status"));
+  tt_int_op(mkdir(get_fname("cached-status")), ==, 0);
 #else
-  mkdir(get_fname("cached-status"), 0700);
+  tt_int_op(mkdir(get_fname("cached-status"), 0700), ==, 0);
 #endif
 
   v2 = generate_v2_networkstatus_opinion();