rteval/SOURCES/rteval-Improve-error-handli...

51 lines
1.8 KiB
Diff

From afbb4f884cd4221f557f8de98670c106448d2529 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 16 May 2017 20:55:36 -0400
Subject: [PATCH 04/18] rteval: Improve error handling if cyclictest fails to
run
Improve error handling if cyclictest fails to run.
An example of this could be if cyclictest is not installed, or rteval
cannot find the installation
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/modules/measurement/cyclictest.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index c5b30557da0b..d920e4be6548 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -299,11 +299,14 @@ class Cyclictest(rtevalModulePrototype):
fp.close()
self.__cyclicoutput.seek(0)
- self.__cyclicprocess = subprocess.Popen(self.__cmd,
+ try:
+ self.__cyclicprocess = subprocess.Popen(self.__cmd,
stdout=self.__cyclicoutput,
stderr=self.__nullfp,
stdin=self.__nullfp)
- self.__started = True
+ self.__started = True
+ except OSError:
+ self.__started = False
def WorkloadAlive(self):
@@ -314,7 +317,9 @@ class Cyclictest(rtevalModulePrototype):
def _WorkloadCleanup(self):
- while self.__cyclicprocess.poll() == None:
+ if not self.__started:
+ return
+ while self.__cyclicprocess.poll() is None:
self._log(Log.DEBUG, "Sending SIGINT")
os.kill(self.__cyclicprocess.pid, signal.SIGINT)
time.sleep(2)
--
2.14.3