Opened 2 years ago

Closed 2 years ago

#22894 closed defect (fixed)

run_tests.py fails when no system tor is installed

Reported by: catalyst Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

run_tests.py seems to once again be failing when there's no system tor installed. Installing a system tor binary causes the test to succeed. This might be a regression of #22366, but it seems that this time, running the run_tests.py from the top of the stem source tree instead of make test-stem from the top of the tor source tree also fails.

Again, I think this is a serious problem because attempting to run the system tor without intending to can cause the wrong tor binary to run, which can cause misleading test results. (Also we should support running stem without a tor binary being installed in the default path.)

Also, I confirmed that env -i doesn't reproduce this problem, possibly because of special cases that execute in the absence of a PATH variable. You have to delete or rename the system tor binary (or possibly otherwise remove it from the path).

I haven't had time to bisect this yet.

======================================================================
ERROR: test_no_orphaned_process
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tlyu/src/stem/test/require.py", line 58, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/home/tlyu/src/stem/test/integ/process.py", line 276, in test_no_orphaned_process
    stem.process.launch_tor()
  File "/home/tlyu/src/stem/stem/process.py", line 98, in launch_tor
    raise OSError("'%s' isn't available on your system. Maybe it's not in your PATH?" % tor_cmd)
OSError: 'tor' isn't available on your system. Maybe it's not in your PATH?

----------------------------------------------------------------------
Ran 22 tests in 0.004s

FAILED (errors=1)

Shutting down tor... done

Style checks require pycodestyle version 1.4.2 or later. Please install it from...
  http://pypi.python.org/pypi/pycodestyle

TESTING FAILED (36 seconds)
  [RUN_NONE] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_OPEN] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_PASSWORD] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_COOKIE] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_MULTIPLE] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_SOCKET] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_SCOOKIE] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR
  [RUN_PTRACE] test_no_orphaned_process (test.integ.process.TestProcess) ... ERROR

You can re-run just these tests with:

  ./run_tests.py --tor ../tor/src/or/tor --all --log notice --target RUN_ALL --test test.integ.process

Child Tickets

Change History (4)

comment:1 Changed 2 years ago by atagar

Very helpful, thanks catalyst! Fix pushed, mind giving it a whirl?

https://gitweb.torproject.org/stem.git/commit/?id=7a09b77

comment:2 Changed 2 years ago by catalyst

Thanks, that seems to work when a system tor isn't installed.

I'm now seeing things that might be deadlocks that also happened in the previous revision (if I had a system tor binary installed) but I will report those on a separate ticket.

comment:3 Changed 2 years ago by atagar

Gotcha, thanks. Are you saying the python process deadlocks or something else? Tests seem to pass for me just fine. If they hang for you that's certainly troubling. :/

comment:4 Changed 2 years ago by atagar

Resolution: fixed
Status: newclosed

Resolving since this is fixed and you filed another ticket for the deadlocks.

Note: See TracTickets for help on using tickets.