diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/commands/test_runbuilds.py')
-rw-r--r-- | bitbake/lib/toaster/tests/commands/test_runbuilds.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/tests/commands/test_runbuilds.py b/bitbake/lib/toaster/tests/commands/test_runbuilds.py index e223b95fcb..849c227edc 100644 --- a/bitbake/lib/toaster/tests/commands/test_runbuilds.py +++ b/bitbake/lib/toaster/tests/commands/test_runbuilds.py | |||
@@ -19,12 +19,14 @@ import time | |||
19 | import subprocess | 19 | import subprocess |
20 | import signal | 20 | import signal |
21 | 21 | ||
22 | import logging | ||
23 | |||
22 | 24 | ||
23 | class KillRunbuilds(threading.Thread): | 25 | class KillRunbuilds(threading.Thread): |
24 | """ Kill the runbuilds process after an amount of time """ | 26 | """ Kill the runbuilds process after an amount of time """ |
25 | def __init__(self, *args, **kwargs): | 27 | def __init__(self, *args, **kwargs): |
26 | super(KillRunbuilds, self).__init__(*args, **kwargs) | 28 | super(KillRunbuilds, self).__init__(*args, **kwargs) |
27 | self.setDaemon(True) | 29 | self.daemon = True |
28 | 30 | ||
29 | def run(self): | 31 | def run(self): |
30 | time.sleep(5) | 32 | time.sleep(5) |
@@ -34,9 +36,12 @@ class KillRunbuilds(threading.Thread): | |||
34 | pidfile_path = os.path.join(os.environ.get("BUILDDIR", "."), | 36 | pidfile_path = os.path.join(os.environ.get("BUILDDIR", "."), |
35 | ".runbuilds.pid") | 37 | ".runbuilds.pid") |
36 | 38 | ||
37 | with open(pidfile_path) as pidfile: | 39 | try: |
38 | pid = pidfile.read() | 40 | with open(pidfile_path) as pidfile: |
39 | os.kill(int(pid), signal.SIGTERM) | 41 | pid = pidfile.read() |
42 | os.kill(int(pid), signal.SIGTERM) | ||
43 | except ProcessLookupError: | ||
44 | logging.warning("Runbuilds not running or already killed") | ||
40 | 45 | ||
41 | 46 | ||
42 | class TestCommands(TestCase): | 47 | class TestCommands(TestCase): |