aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-08-12 15:04:58 +0300
committerNick Mathewson <nickm@torproject.org>2018-08-16 08:31:45 -0400
commitf454c283031e282ade3db78ce9da3726ec4a0234 (patch)
tree03756152ceec10aa78eafaff806f5a9a592f4ac8 /src
parent57d0b8c3cd7213f03b0a37c8c74c003b1c820438 (diff)
downloadtor-f454c283031e282ade3db78ce9da3726ec4a0234.tar.gz
tor-f454c283031e282ade3db78ce9da3726ec4a0234.zip
Fix test to pass without HOME env being set
Diffstat (limited to 'src')
-rw-r--r--src/test/test_options.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test_options.c b/src/test/test_options.c
index 4e890205b2..dcb8932bec 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -473,6 +473,11 @@ test_options_validate__uname_for_server(void *ignored)
{
(void)ignored;
char *msg;
+
+ int unset_home_env = 0;
+ if (setenv("HOME", "/home/john", 0) == 0)
+ unset_home_env = 1;
+
options_test_data_t *tdata = get_options_test_data(
"ORPort 127.0.0.1:5555");
setup_capture_of_logs(LOG_WARN);
@@ -512,6 +517,8 @@ test_options_validate__uname_for_server(void *ignored)
free_options_test_data(tdata);
tor_free(msg);
teardown_capture_of_logs();
+ if (unset_home_env)
+ unsetenv("HOME");
}
static void
@@ -1413,6 +1420,11 @@ test_options_validate__paths_needed(void *ignored)
(void)ignored;
int ret;
char *msg;
+
+ int unset_home_env = 0;
+ if (setenv("HOME", "/home/john", 0) == 0)
+ unset_home_env = 1;
+
setup_capture_of_logs(LOG_WARN);
options_test_data_t *tdata = get_options_test_data(
"PathsNeededToBuildCircuits 0.1\n"
@@ -1455,6 +1467,8 @@ test_options_validate__paths_needed(void *ignored)
teardown_capture_of_logs();
free_options_test_data(tdata);
tor_free(msg);
+ if (unset_home_env)
+ unsetenv("HOME");
}
static void