diff options
author | Luis Claudio R. Gonçalves <lgoncalv@redhat.com> | 2010-05-07 15:14:09 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2010-05-07 15:14:09 +0200 |
commit | 3f2ed6dc26f2c8eefb0ff2f6a834758ac5ec04d5 (patch) | |
tree | 35f73cd62582ae777226a8babb25df1a9e3b5bac /rteval | |
parent | aec91028d0f70adaab82fe21dfc16c72dba613a5 (diff) | |
download | rteval-3f2ed6dc26f2c8eefb0ff2f6a834758ac5ec04d5.tar.gz rteval-3f2ed6dc26f2c8eefb0ff2f6a834758ac5ec04d5.tar.xz rteval-3f2ed6dc26f2c8eefb0ff2f6a834758ac5ec04d5.zip |
rteval: code cleanup and fixes
Changes:
* Closed /dev/null after use on each function opening it.
* Make use of subprocess.wait() calls where appropriate.
* Imported the missing SIGKILL symbol in hackbench.py
* Removed the code snippet below from hackbench.py:runload():
count = 30
while count > 0 and p.poll() == None:
time.sleep(1.0)
count -= 1
if p.poll() == None:
os.kill(p.pid, SIGKILL)
Signed-off-by: Luis Claudio R. Gonçalves <lgoncalv@redhat.com>
Diffstat (limited to 'rteval')
-rw-r--r-- | rteval/cyclictest.py | 5 | ||||
-rw-r--r-- | rteval/hackbench.py | 9 | ||||
-rw-r--r-- | rteval/kcompile.py | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/rteval/cyclictest.py b/rteval/cyclictest.py index 5a3ffbf..03442e0 100644 --- a/rteval/cyclictest.py +++ b/rteval/cyclictest.py @@ -233,7 +233,9 @@ class Cyclictest(Thread): break time.sleep(1.0) self.debug("stopping") - os.kill(c.pid, signal.SIGINT) + if c.poll() == None: + os.kill(c.pid, signal.SIGINT) + c.wait() # now parse the histogram output for line in c.stdout: if line.startswith('#'): continue @@ -245,6 +247,7 @@ class Cyclictest(Thread): for n in self.data.keys(): self.data[n].reduce() self.finished.set() + os.close(null) def genxml(self, x): x.openblock('cyclictest') diff --git a/rteval/hackbench.py b/rteval/hackbench.py index 65d0133..685b8d6 100644 --- a/rteval/hackbench.py +++ b/rteval/hackbench.py @@ -30,6 +30,7 @@ import time import glob import subprocess from signal import SIGTERM +from signal import SIGKILL sys.pathconf = "." import load @@ -41,6 +42,7 @@ class Hackbench(load.Load): null = open("/dev/null", "w") subprocess.call(['killall', '-9', 'hackbench'], stdout=null, stderr=null) + os.close(null) def setup(self): # find our tarball @@ -93,6 +95,7 @@ class Hackbench(load.Load): raise RuntimeError, "Can't find hackbench executable: %s" % self.exe self.args = [self.exe, str(self.jobs)] self.ready = True + os.close(null) def runload(self): null = os.open("/dev/null", os.O_RDWR) @@ -104,15 +107,11 @@ class Hackbench(load.Load): p.wait() p = subprocess.Popen(self.args,stdin=null,stdout=null,stderr=null) self.debug("stopping") - os.kill(p.pid, SIGTERM) - count = 30 - while count > 0 and p.poll() == None: - time.sleep(1.0) - count -= 1 if p.poll() == None: os.kill(p.pid, SIGKILL) p.wait() self.debug("returning from runload()") + os.close(null) def genxml(self, x): x.taggedvalue('command_line', ' '.join(self.args), {'name':'hackbench'}) diff --git a/rteval/kcompile.py b/rteval/kcompile.py index 1e0863a..f57a18b 100644 --- a/rteval/kcompile.py +++ b/rteval/kcompile.py @@ -97,6 +97,7 @@ class Kcompile(load.Load): return self.debug("ready to run") self.ready = True + os.close(null) def runload(self): null = os.open("/dev/null", os.O_RDWR) @@ -118,7 +119,10 @@ class Kcompile(load.Load): p = subprocess.Popen(self.args, stdin=null,stdout=null,stderr=null) self.debug("stopping") - os.kill(p.pid, SIGTERM) + if p.poll() == None: + os.kill(p.pid, SIGTERM) + p.wait() + os.close(null) def genxml(self, x): x.taggedvalue('command_line', ' '.join(self.args), {'name':'kcompile'}) |