[tor-bugs] #22301 [Core Tor/Stem]: make test-stem doesn't work

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri May 19 16:19:26 UTC 2017


#22301: make test-stem doesn't work
---------------------------+------------------------------------
 Reporter:  catalyst       |          Owner:  atagar
     Type:  defect         |         Status:  new
 Priority:  Medium         |      Milestone:  Tor: 0.3.2.x-final
Component:  Core Tor/Stem  |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:                 |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------------------
Description changed by catalyst:

Old description:

> Running `make test-stem` doesn't seem to work on master (tor master with
> stem master).  This probably prevents people from running `make test-
> full`, which `CodingStandards.md` recommends.
>
> There are probably multiple bugs involved.  (I can open child tickets for
> them if people think that's bettter.)  Some of them involve invoking
> `run_tests.py` with a working directory not at the top of the stem source
> tree.  At least one other involves the lack of a `tor` binary in the
> default `$PATH`.  (I'm not sure whether the test in question
>
> Running
>
> {{{
> STEM_SOURCE_DIR=`pwd`/../stem CHUTNEY_PATH=`pwd`/../chutney make test-
> stem
> }}}
>
> produces many errors like
>
> {{{
> Starting ./src/or/tor...
>
>   failed to start tor: './src/or/tor' doesn't exist
> }}}
>
> This suggests that `run_tests.py` doesn't cope well with a relative path
> to the `tor` binary, so as a workaround I tried setting
> `TESTING_TOR_BINARY` like
>
> {{{
> STEM_SOURCE_DIR=`pwd`/../stem CHUTNEY_PATH=`pwd`/../chutney make
> TESTING_TOR_BINARY=`pwd`/src/or/tor test-stem
> }}}
>
> which produced
>
> {{{
>   installation...                                      failed (0.04s)
> test_install                                          37 ms  [SUCCESS]
> test_sdist                                                   [FAILURE]
>
> ======================================================================
> FAIL: test_sdist
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/tlyu/src/stem/test/util.py", line 245, in wrapped
>     return func(self, *args, **kwargs)
>   File "/home/tlyu/src/stem/test/integ/installation.py", line 144, in
> test_sdist
>     raise SDIST_FAILURE
> AssertionError: /home/tlyu/src/stem/dist already exists, maybe you
> manually ran 'python setup.py sdist'?
>
> ----------------------------------------------------------------------
> Ran 2 tests in 0.038s
>
> FAILED (failures=1)
> }}}
>
> and
>
> {{{
>   process...                                           failed (1.03s)
> test_can_run_multithreaded (already ran)                     [SKIPPED]
> test_dump_config_argument                            182 ms  [SUCCESS]
> test_hash_password                                    42 ms  [SUCCESS]
> test_hash_password_requires_argument                  33 ms  [SUCCESS]
> test_help_argument                                    70 ms  [SUCCESS]
> test_hush_argument                                    70 ms  [SUCCESS]
> test_launch_tor_with_config_via_file (already ran)           [SKIPPED]
> test_launch_tor_with_config_via_stdin (already ran)          [SKIPPED]
> test_launch_tor_with_timeout (already ran)                   [SKIPPED]
> test_list_fingerprint_argument                       230 ms  [SUCCESS]
> test_list_torrc_options_argument                      34 ms  [SUCCESS]
> test_no_orphaned_process                                     [FAILURE]
> test_quiet_argument                                   37 ms  [SUCCESS]
> test_take_ownership_via_controller (already ran)             [SKIPPED]
> test_take_ownership_via_pid (already ran)                    [SKIPPED]
> test_torrc_arguments                                  46 ms  [SUCCESS]
> test_torrc_arguments_via_stdin                        45 ms  [SUCCESS]
> test_validate_config_argument                         95 ms  [SUCCESS]
> test_version_argument                                 39 ms  [SUCCESS]
> test_with_invalid_config (already ran)                       [SKIPPED]
> test_with_missing_torrc                               97 ms  [SUCCESS]
>
> ======================================================================
> ERROR: test_no_orphaned_process
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/tlyu/src/stem/test/util.py", line 260, 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 217, 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 21 tests in 1.033s
>
> FAILED (errors=1, skipped=7)
> }}}
>
> The summary says
>
> {{{
> TESTING FAILED (72 seconds)
>   [RUN_NONE] test_sdist (test.integ.installation.TestInstallation) ...
> FAIL
>   [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:
>
>   /home/tlyu/src/tor/../stem/run_tests.py --tor
> /home/tlyu/src/tor/src/or/tor --all --log notice --target RUN_ALL --test
> test.integ.installation
>   /home/tlyu/src/tor/../stem/run_tests.py --tor
> /home/tlyu/src/tor/src/or/tor --all --log notice --target RUN_ALL --test
> test.integ.process
> }}}
>
> Running from the top of the stem source tree
>
> {{{
> ./run_tests.py --tor `pwd`/../tor/src/or/tor --all --log notice --target
> RUN_ALL --test test.integ.installation
> }}}
>
> succeeds
>
> {{{
> 14 TESTS WERE SKIPPED
> TESTING PASSED (10 seconds)
> }}}
>
> but
>
> {{{
> ./run_tests.py --tor `pwd`/../tor/src/or/tor --all --log notice --target
> RUN_ALL --test test.integ.process
> }}}
>
> still fails in the same way.  I don't have a system `tor` binary
> installed in this VM, but I don't see any documentation that such is
> required for this test.  Also it would be good to not accidentally test
> the system `tor` binary when we intend to test a specific other one.

New description:

 Running `make test-stem` doesn't seem to work on master (tor master with
 stem master).  This probably prevents people from running `make test-
 full`, which `CodingStandards.md` recommends.

 There are probably multiple bugs involved.  (I can open child tickets for
 them if people think that's bettter.)  Some of them involve invoking
 `run_tests.py` with a working directory not at the top of the stem source
 tree.  At least one other involves the lack of a `tor` binary in the
 default `$PATH`.  (I'm not sure whether the test in question expects to
 run the system `tor`.)

 Running

 {{{
 STEM_SOURCE_DIR=`pwd`/../stem CHUTNEY_PATH=`pwd`/../chutney make test-stem
 }}}

 produces many errors like

 {{{
 Starting ./src/or/tor...

   failed to start tor: './src/or/tor' doesn't exist
 }}}

 This suggests that `run_tests.py` doesn't cope well with a relative path
 to the `tor` binary, so as a workaround I tried setting
 `TESTING_TOR_BINARY` like

 {{{
 STEM_SOURCE_DIR=`pwd`/../stem CHUTNEY_PATH=`pwd`/../chutney make
 TESTING_TOR_BINARY=`pwd`/src/or/tor test-stem
 }}}

 which produced

 {{{
   installation...                                      failed (0.04s)
 test_install                                          37 ms  [SUCCESS]
 test_sdist                                                   [FAILURE]

 ======================================================================
 FAIL: test_sdist
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/tlyu/src/stem/test/util.py", line 245, in wrapped
     return func(self, *args, **kwargs)
   File "/home/tlyu/src/stem/test/integ/installation.py", line 144, in
 test_sdist
     raise SDIST_FAILURE
 AssertionError: /home/tlyu/src/stem/dist already exists, maybe you
 manually ran 'python setup.py sdist'?

 ----------------------------------------------------------------------
 Ran 2 tests in 0.038s

 FAILED (failures=1)
 }}}

 and

 {{{
   process...                                           failed (1.03s)
 test_can_run_multithreaded (already ran)                     [SKIPPED]
 test_dump_config_argument                            182 ms  [SUCCESS]
 test_hash_password                                    42 ms  [SUCCESS]
 test_hash_password_requires_argument                  33 ms  [SUCCESS]
 test_help_argument                                    70 ms  [SUCCESS]
 test_hush_argument                                    70 ms  [SUCCESS]
 test_launch_tor_with_config_via_file (already ran)           [SKIPPED]
 test_launch_tor_with_config_via_stdin (already ran)          [SKIPPED]
 test_launch_tor_with_timeout (already ran)                   [SKIPPED]
 test_list_fingerprint_argument                       230 ms  [SUCCESS]
 test_list_torrc_options_argument                      34 ms  [SUCCESS]
 test_no_orphaned_process                                     [FAILURE]
 test_quiet_argument                                   37 ms  [SUCCESS]
 test_take_ownership_via_controller (already ran)             [SKIPPED]
 test_take_ownership_via_pid (already ran)                    [SKIPPED]
 test_torrc_arguments                                  46 ms  [SUCCESS]
 test_torrc_arguments_via_stdin                        45 ms  [SUCCESS]
 test_validate_config_argument                         95 ms  [SUCCESS]
 test_version_argument                                 39 ms  [SUCCESS]
 test_with_invalid_config (already ran)                       [SKIPPED]
 test_with_missing_torrc                               97 ms  [SUCCESS]

 ======================================================================
 ERROR: test_no_orphaned_process
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/tlyu/src/stem/test/util.py", line 260, 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 217, 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 21 tests in 1.033s

 FAILED (errors=1, skipped=7)
 }}}

 The summary says

 {{{
 TESTING FAILED (72 seconds)
   [RUN_NONE] test_sdist (test.integ.installation.TestInstallation) ...
 FAIL
   [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:

   /home/tlyu/src/tor/../stem/run_tests.py --tor
 /home/tlyu/src/tor/src/or/tor --all --log notice --target RUN_ALL --test
 test.integ.installation
   /home/tlyu/src/tor/../stem/run_tests.py --tor
 /home/tlyu/src/tor/src/or/tor --all --log notice --target RUN_ALL --test
 test.integ.process
 }}}

 Running from the top of the stem source tree

 {{{
 ./run_tests.py --tor `pwd`/../tor/src/or/tor --all --log notice --target
 RUN_ALL --test test.integ.installation
 }}}

 succeeds

 {{{
 14 TESTS WERE SKIPPED
 TESTING PASSED (10 seconds)
 }}}

 but

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

 still fails in the same way.  I don't have a system `tor` binary installed
 in this VM, but I don't see any documentation that such is required for
 this test.  Also it would be good to not accidentally test the system
 `tor` binary when we intend to test a specific other one.

--

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


More information about the tor-bugs mailing list