Skip to contentSkip to conversation

run-fio-tests: make test runs more resilient

PATCH New Vincent Fu 1 participant 1 message Sep 21, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20210921212509uscas1p2cb672c3c98ba460d5c859f29961ca6cf@uscas1p2.samsung.com

Vincent Fu

author
#1 lore raw

PATCH 1/1 run-fio-tests: make test runs more resilient

Catch exceptions that occur during test setup/running/evaluation. This makes it more likely that the entire test suite can run to completion even if some tests fail in an unexpected fashion.

In particular I have seen failures in FioJobTest_t0014() when the test is run on a bare metal machine. Without this patch these failures make the entire script grind to a halt.

---
 t/run-fio-tests.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
t/run-fio-tests.py +11 -3
index a59cdfe0..612e50ca 100755
@@ -49,6 +49,7 @@ import shutil
 import logging
 import argparse
 import platform
+import traceback
 import subprocess
 import multiprocessing
 from pathlib import Path
@@ -1057,9 +1058,16 @@ def main():
                 skipped = skipped + 1
                 continue
 
-        test.setup(artifact_root, config['test_id'])
-        test.run()
-        test.check_result()
+        try:
+            test.setup(artifact_root, config['test_id'])
+            test.run()
+            test.check_result()
+        except KeyboardInterrupt:
+            break
+        except Exception as e:
+            test.passed = False
+            test.failure_reason += str(e)
+            logging.debug("Test %d exception:\n%s\n", config['test_id'], traceback.format_exc())
         if test.passed:
             result = "PASSED"
             passed = passed + 1
Signature · 1 line
2.25.1