From: Vincent Fu Date: Mon, 11 Nov 2019 16:30:55 +0000 (-0500) Subject: t/run-fio-tests: improve error handling X-Git-Tag: fio-3.17~19 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b048455fef67dad4ef96ce0393937322e3165b58;p=fio.git 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 --- 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: