[tor-bugs] #8432 [Ooni]: ooni: dnsconsistency.py should display UsageError in a more friendly manner

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Mar 8 16:58:33 UTC 2013


#8432: ooni: dnsconsistency.py should display UsageError in a more friendly manner
-----------------------------+----------------------------------------------
 Reporter:  isis             |          Owner:  hellais
     Type:  defect           |         Status:  new    
 Priority:  normal           |      Milestone:         
Component:  Ooni             |        Version:         
 Keywords:  ooni, bugreport  |         Parent:         
   Points:                   |   Actualpoints:         
-----------------------------+----------------------------------------------
 When running the dnsconsistency test without specifying a test resolver
 (the "-t" option), the test craps out with a UsageError which displays a
 traceback, and then it just hangs until a SIGTERM:

 {{{
 (ooni)?!isis?wintermute:~/code/torproject/ooni-probe ? s ./bin/ooniprobe
 nettests/blocking/dnsconsistency.py -f private/lists/alexa-11
 [!] pypcap or dnet not installed. Certain tests may not work.
 Log opened.
 Starting
 Starting sniffer
 [!] Initializing DummyPcapWriter. We will not actually write to a pcapfile
 [D] No test deck detected
 [D] processing options
 [D] Checking if backend is present
 [D] Checking if file is present
 [D] Running [(<class
 'nettests.blocking.dnsconsistency.DNSConsistencyTest'>, 'test_a_lookup')]
 [D] Options {'inputs': <ooni.nettest.inputProcessorIterator object at
 0x2362390>, 'version': '0.5', 'name': 'DNS Consistency'}
 [D] cmd_line_options {'pcapfile': None, 'help': 0, 'subargs': ('-f',
 'private/lists/alexa-11'), 'resume': 0, 'parallelism': '10', 'test':
 'nettests/blocking/dn
 sconsistency.py', 'logfile': None, 'collector': None, 'reportfile': None}
 [D] Creating report_dnsconsistency_2013-03-08T165102Z.yamloo
 [D] Writing report with YAML reporter
 Reporting to file report_dnsconsistency_2013-03-08T165102Z.yamloo
 [D] Not going to resume dnsconsistency.py
 [D] Running dnsconsistency default processor
 [D] input_unit_items: 2
 [D] test_case_number: 1.0
 [D] Test case number: 1.0
 [D] Total iterations: 2.0
 [D] Current iteration: 0.0
 [D] Running dnsconsistency default processor
 [D] Running dnsconsistency.py with input unit <<class
 'ooni.inputunit.InputUnit'> inputs=<listiterator object at 0x27d9e50>>
 [D] Running test cases with input unit
 [D] Running test with this input torproject.org
 [D] Processing test_a_lookup
 [D] Running test_a_lookup with torproject.org...
 Traceback (most recent call last):
   File "/home/isis/code/torproject/ooni-probe/ooni/runner.py", line 462,
 in runTestCases
     yaml_reporter, oonib_reporter)
   File "/home/isis/code/torproject/ooni-probe/ooni/runner.py", line 267,
 in runTestCasesWithInputUnit
     test_input, yaml_reporter, oonib_reporter)
   File "/home/isis/code/torproject/ooni-probe/ooni/runner.py", line 230,
 in runTestCasesWithInput
     test_instance.setUp()
   File "/home/isis/code/torproject/ooni-
 probe/nettests/blocking/dnsconsistency.py", line 54, in setUp
     raise usage.UsageError("You did not specify a testresolver")
 UsageError: You did not specify a testresolver
 [D] testsEnded: Finished running all tests
 [D] [dnsconsistency.py] 0.0%
 [D] [dnsconsistency.py] 0.0%
 [D] [dnsconsistency.py] 0.0%
 [D] [dnsconsistency.py] 0.0%
 ^CReceived SIGINT, shutting down.
 }}}

 Instead, it should nicely display the error (without the unnecessary
 traceback) and then call sys.exit, or some sort of shutdown method.

 Questions:
  * Do we currently, in runner.py, or somewhere in the TaskManager branch,
 have a safe shutdown method that can be called from within a NetTestCase?

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8432>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list