Opened 7 years ago

Closed 6 years ago

#8432 closed defect (fixed)

ooni: should display UsageError in a more friendly manner

Reported by: isis Owned by: hellais
Priority: Medium Milestone:
Component: Archived/Ooni Version:
Severity: Keywords: ooni, bugreport
Cc: hellais, ioerror, aagbsn, isis Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


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/ -f private/lists/alexa-11                         
[!] pypcap or dnet not installed. Certain tests may not work.
Log opened.
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', '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
[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 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
[D] Processing test_a_lookup
[D] Running test_a_lookup with
Traceback (most recent call last):
  File "/home/isis/code/torproject/ooni-probe/ooni/", line 462, in runTestCases
    yaml_reporter, oonib_reporter)
  File "/home/isis/code/torproject/ooni-probe/ooni/", line 267, in runTestCasesWithInputUnit
    test_input, yaml_reporter, oonib_reporter)
  File "/home/isis/code/torproject/ooni-probe/ooni/", line 230, in runTestCasesWithInput
  File "/home/isis/code/torproject/ooni-probe/nettests/blocking/", 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] [] 0.0%
[D] [] 0.0%
[D] [] 0.0%
[D] [] 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.


  • Do we currently, in, or somewhere in the TaskManager branch, have a safe shutdown method that can be called from within a NetTestCase?

Child Tickets

Change History (1)

comment:1 Changed 6 years ago by hellais

Resolution: fixed
Status: newclosed

If no test resolved is specified we will now automatically read from /etc/resolv.conf and populate such field.

Note: See TracTickets for help on using tickets.