mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Check more return values in the unit tests
This commit is contained in:
parent
459c7c0e41
commit
8a96a85d66
@ -202,9 +202,9 @@ test_config_check_or_create_data_subdir(void *arg)
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
#if defined (_WIN32) && !defined (WINCE)
|
#if defined (_WIN32) && !defined (WINCE)
|
||||||
mkdir(options->DataDirectory);
|
tt_int_op(mkdir(options->DataDirectory), ==, 0);
|
||||||
#else
|
#else
|
||||||
mkdir(options->DataDirectory, 0700);
|
tt_int_op(mkdir(options->DataDirectory, 0700), ==, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
r = stat(subpath, &st);
|
r = stat(subpath, &st);
|
||||||
@ -266,14 +266,14 @@ test_config_write_to_data_subdir(void *arg)
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
#if defined (_WIN32) && !defined (WINCE)
|
#if defined (_WIN32) && !defined (WINCE)
|
||||||
mkdir(options->DataDirectory);
|
tt_int_op(mkdir(options->DataDirectory), ==, 0);
|
||||||
#else
|
#else
|
||||||
mkdir(options->DataDirectory, 0700);
|
tt_int_op(mkdir(options->DataDirectory, 0700), ==, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Write attempt shoudl fail, if subdirectory doesn't exist.
|
// Write attempt shoudl fail, if subdirectory doesn't exist.
|
||||||
test_assert(write_to_data_subdir(subdir, fname, str, NULL));
|
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
|
// Content of file after write attempt should be
|
||||||
// equal to the original string.
|
// 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);
|
test_streq(read_file_to_str(filepath, 0, NULL), str);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
remove(filepath);
|
(void) unlink(filepath);
|
||||||
rmdir(options->DataDirectory);
|
rmdir(options->DataDirectory);
|
||||||
tor_free(datadir);
|
tor_free(datadir);
|
||||||
tor_free(filepath);
|
tor_free(filepath);
|
||||||
|
@ -2317,9 +2317,9 @@ test_dir_v2_dir(void *arg)
|
|||||||
|
|
||||||
/* Make a directory so there's somewhere to store the thing */
|
/* Make a directory so there's somewhere to store the thing */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
mkdir(get_fname("cached-status"));
|
tt_int_op(mkdir(get_fname("cached-status")), ==, 0);
|
||||||
#else
|
#else
|
||||||
mkdir(get_fname("cached-status"), 0700);
|
tt_int_op(mkdir(get_fname("cached-status"), 0700), ==, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
v2 = generate_v2_networkstatus_opinion();
|
v2 = generate_v2_networkstatus_opinion();
|
||||||
|
Loading…
Reference in New Issue
Block a user