[tor-commits] [stem/master] Replace pgrep with ps in the BSD systems

atagar at torproject.org atagar at torproject.org
Tue Jan 3 04:41:40 UTC 2012


commit 8c8ad75bd1e3dc5541273336b03d6300f689b66e
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date:   Mon Dec 19 22:23:41 2011 +0530

    Replace pgrep with ps in the BSD systems
    
    Now, the integ test checks if the os is a BSD system with a
    call to stem.util.system.is_bsd(). If it is BSD, then it
    uses ps to check if an extra Tor instance is running, instead
    of using pgrep which does not exist on BSD.
---
 test/integ/util/system.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/integ/util/system.py b/test/integ/util/system.py
index d1e9f88..7f4c68c 100644
--- a/test/integ/util/system.py
+++ b/test/integ/util/system.py
@@ -25,9 +25,12 @@ class TestSystem(unittest.TestCase):
     # legitemately fail.
     
     if self.is_extra_tor_running == None:
-      pgrep_results = stem.util.system.call("pgrep -x tor")
-      self.is_extra_tor_running = len(pgrep_results) > 1
-  
+      if not stem.util.system.is_bsd():
+        pgrep_results = stem.util.system.call("pgrep -x tor")
+        self.is_extra_tor_running = len(pgrep_results) > 1
+      else:
+        pgrep_results = stem.util.system.call("ps -axo pid,command,args  | grep -i tor | awk '{ print $1}'")
+        self.is_extra_tor_running = len(pgrep_results) > 1
   def tearDown(self):
     # resets call mocking back to being disabled
     stem.util.system.CALL_MOCKING = None





More information about the tor-commits mailing list