tests/run-unit-tests: add option to skip tests
authorRoss Burton <ross.burton@arm.com>
Mon, 11 Mar 2024 16:41:02 +0000 (16:41 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 11 Mar 2024 23:27:01 +0000 (23:27 +0000)
In automated QA environments there may be tests that are known to fail,
and being able to skip them is useful to remove known failures from the
test log.

Signed-off-by: Ross Burton <ross.burton@arm.com>
test/run-unit-tests.py

index 1b0329644b85b28dd16ef92b18ba976c5aa254a3..de8ac5c26cb43725f040d6b9cdf61bd58ebe459b 100755 (executable)
@@ -28,6 +28,9 @@ def argument_parser():
                    help='run "unsafe" tests too')
     p.add_argument('-A', '--artifact_directory',
                    help='store output from failed tests in this dir')
+    p.add_argument('-s', '--skip', action='append', default=[],
+                   help='skip the named test')
+
     return p
 
 opts = argument_parser().parse_args()
@@ -45,6 +48,11 @@ total.total = len(tests)
 for test in sorted(tests):
     name = os.path.basename(test)
 
+    if name in opts.skip:
+        print(f'{YELLOW}SKIP: {name} (by user) {RESET_ALL}')
+        total.skip += 1
+        continue
+
     ex = subprocess.run(test, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     if ex.returncode == 0:
         print(f'{GREEN}PASS: {name}{RESET_ALL}')