summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Fu <vincent.fu@wdc.com>2019-11-11 11:30:55 -0500
committerJens Axboe <axboe@kernel.dk>2019-11-14 14:07:25 -0700
commitb048455fef67dad4ef96ce0393937322e3165b58 (patch)
tree26c19dbf4305a73e3115d5bcec52dc59782f530f
parentfa9fd9143b6571cb99466bb21212cbce1e68ed18 (diff)
downloadfio-b048455fef67dad4ef96ce0393937322e3165b58.tar.gz
fio-b048455fef67dad4ef96ce0393937322e3165b58.tar.bz2
t/run-fio-tests: improve error handling
More gracefully handle errors when running a test. Also change the EXAMPLE to refer to fio's canonical git repository. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rwxr-xr-xt/run-fio-tests.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py
index 1b8ca0a2..cf8de093 100755
--- a/t/run-fio-tests.py
+++ b/t/run-fio-tests.py
@@ -14,7 +14,7 @@
#
#
# EXAMPLE
-# # git clone [fio-repository]
+# # git clone git://git.kernel.dk/fio.git
# # cd fio
# # make -j
# # python3 t/run-fio-tests.py
@@ -123,6 +123,7 @@ class FioExeTest(FioTest):
stderr_file = open(self.stderr_file, "w+")
exticode_file = open(self.exticode_file, "w+")
try:
+ proc = None
# Avoid using subprocess.run() here because when a timeout occurs,
# fio will be stopped with SIGKILL. This does not give fio a
# chance to clean up and means that child processes may continue
@@ -142,9 +143,10 @@ class FioExeTest(FioTest):
assert proc.poll()
self.output['failure'] = 'timeout'
except Exception:
- if not proc.poll():
- proc.terminate()
- proc.communicate()
+ if proc:
+ if not proc.poll():
+ proc.terminate()
+ proc.communicate()
self.output['failure'] = 'exception'
self.output['exc_info'] = sys.exc_info()
finally: