[tor-commits] [tor/master] Don't expect permission failure if running as root

nickm at torproject.org nickm at torproject.org
Wed Oct 4 19:27:56 UTC 2017


commit 44e4a96bb5d2a01d57084ec8beb14e4518644614
Author: Taylor Yu <catalyst at torproject.org>
Date:   Wed Oct 4 08:42:05 2017 -0500

    Don't expect permission failure if running as root
    
    Skip test_config_include_no_permission() when running as root, because
    it will get an unexpected success from config_get_lines_include().
    This affects some continuous integration setups.  Fixes bug 23758.
---
 changes/bug23758       | 4 ++++
 src/test/test_config.c | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/changes/bug23758 b/changes/bug23758
new file mode 100644
index 000000000..565791e8f
--- /dev/null
+++ b/changes/bug23758
@@ -0,0 +1,4 @@
+  o Minor bugfixes (testing):
+    - Skip a test that would fail if run as root (because it expects a
+      permissions error).  This affects some continuous integration setups.
+      Fixes bug 23758; bugfix on 0.3.2.2-alpha.
diff --git a/src/test/test_config.c b/src/test/test_config.c
index e9cdf9ddb..b035070a1 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -4957,7 +4957,11 @@ test_config_include_no_permission(void *data)
   config_line_t *result = NULL;
 
   char *folder_path = NULL;
-  char *dir = tor_strdup(get_fname("test_include_forbidden_folder"));
+  char *dir = NULL;
+  if (geteuid() == 0)
+    tt_skip();
+
+  dir = tor_strdup(get_fname("test_include_forbidden_folder"));
   tt_ptr_op(dir, OP_NE, NULL);
 
   tt_int_op(mkdir(dir, 0700), OP_EQ, 0);



More information about the tor-commits mailing list