[tor-commits] [ooni-probe/master] Print that the test requires root only after having parsed it's command line args

art at torproject.org art at torproject.org
Thu Nov 22 10:29:25 UTC 2012


commit d127ce73e847032682c19993389ba45a8f223fcc
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Nov 22 11:29:01 2012 +0100

    Print that the test requires root only after having parsed it's command line args
---
 ooni/runner.py |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ooni/runner.py b/ooni/runner.py
index 158523d..a296e7f 100644
--- a/ooni/runner.py
+++ b/ooni/runner.py
@@ -40,12 +40,6 @@ def processTest(obj, cmd_line_options):
         class.
     """
     options = None
-    if obj.requiresRoot:
-        try:
-            checkForRoot()
-        except NotRootError:
-            log.err("%s requires root to run" % obj.name)
-            sys.exit(1)
 
     if obj.usageOptions and obj.inputFile:
         obj.usageOptions.optParameters.append(obj.inputFile)
@@ -84,6 +78,13 @@ def processTest(obj, cmd_line_options):
             options.opt_help()
             raise usage.UsageError("Error in parsing command line args for %s" % test_name) 
 
+    if obj.requiresRoot:
+        try:
+            checkForRoot()
+        except NotRootError:
+            log.err("%s requires root to run" % obj.name)
+            sys.exit(1)
+
     return obj
 
 def isTestCase(obj):



More information about the tor-commits mailing list