Opened 5 years ago

Closed 5 years ago

#15449 closed defect (fixed)

test_is_running() fails on OSX

Reported by: corcra Owned by: atagar
Priority: Low Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords: testing
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

On OSX, tor runs under the name tor.real (due to https://trac.torproject.org/projects/tor/ticket/10030#comment:20), but is started by calling tor, so this fails during testing:

self.assertTrue(stem.util.system.is_running(test.runner.get_runner().get_tor_command(True)))

(this is in stem/test/integ/util/system.py)

A possible workaround would be modifying the workaround for #10030 (it's workarounds all the way down) to use

exec -a tor ./tor.real "$@"

instead of

exec ./tor.real "$@"

and then changing the ps call in stem/stem/util/system.py to not use accounting, so it sees the process running as tor:

IS_RUNNING_PS_BSD = 'ps -ao comm='

instead of

IS_RUNNING_PS_BSD = 'ps -ao ucomm='

... but I'm not sure if turning off accounting is appropriate/desirable, and changing non-stem things just to fix a bug in stem tests seems like overkill.

The OSX 'weirdness' is already handled appropriately elsewhere in stem, so maybe this test should just be modified (like)

self.assertTrue(stem.util.system.is_running('tor') or stem.util.system.is_running('tor.real'))

or further upstream, set _tor_cmd in the runner in an OS-conscious manner?

Child Tickets

Change History (2)

comment:1 Changed 5 years ago by corcra

Keywords: testing added

comment:2 Changed 5 years ago by atagar

Resolution: fixed
Status: newclosed

Thanks corcra! Pushed a fix. I was a tad tempted to add a tor_tools.is_running() helper that accounts for both names but then realized this would be baking a hack into our library. Maybe I'm a dreamer but I'd like to think the hack will be dropped someday. :P

Note: See TracTickets for help on using tickets.