Skip to contentSkip to conversation

iotests: check: return 1 on failure

PATCH Applied Vladimir Sementsov-Ogievskiy 2 participants 2 messages Feb 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests: check: return 1 on failure

We should indicate failure by exit code, not only output.

Reported-by Peter Maydell
Fixes f203080bbd9f9e5b31041b1f2afcd6040c5aaec5
---
 tests/qemu-iotests/check         | 5 ++++-
 tests/qemu-iotests/testrunner.py | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
tests/qemu-iotests/check +4 -1
index 5190dee82e..d1c87ceaf1 100755
@@ -140,4 +140,7 @@ if __name__ == '__main__':
     else:
         with TestRunner(env, makecheck=args.makecheck,
                         color=args.color) as tr:
-            tr.run_tests([os.path.join(env.source_iotests, t) for t in tests])
+            paths = [os.path.join(env.source_iotests, t) for t in tests]
+            ok = tr.run_tests(paths)
+            if not ok:
+                sys.exit(1)
tests/qemu-iotests/testrunner.py +3 -1
index 24b3fba115..25754e9a09 100644
@@ -318,7 +318,7 @@ class TestRunner(ContextManager['TestRunner']):
 
         return res
 
-    def run_tests(self, tests: List[str]) -> None:
+    def run_tests(self, tests: List[str]) -> bool:
         n_run = 0
         failed = []
         notrun = []
@@ -363,5 +363,7 @@ class TestRunner(ContextManager['TestRunner']):
         if failed:
             print('Failures:', ' '.join(failed))
             print(f'Failed {len(failed)} of {n_run} iotests')
+            return False
         else:
             print(f'Passed all {n_run} iotests')
+            return True
Signature · 1 line
2.29.2
Applied
#1 lore raw

Am 01.02.2021 um 09:50 hat Vladimir Sementsov-Ogievskiy geschrieben:

Quoted 5 lines

We should indicate failure by exit code, not only output.

Reported-by Peter Maydell
Fixes f203080bbd9f9e5b31041b1f2afcd6040c5aaec5

Thanks, applied to the block branch.

Kevin