diff mbox series

[kms-tests] kmstest: Add support for specifying subset of tests on the command line

Message ID 20231114133929.26419-1-laurent.pinchart@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [kms-tests] kmstest: Add support for specifying subset of tests on the command line | expand

Commit Message

Laurent Pinchart Nov. 14, 2023, 1:39 p.m. UTC
The kmstest.py runner is a convenient way to run all the tests in the
current directory, in addition to running specific tests manually. It is
also useful to run a subset of the tests. Add support for this by
specifying them as command line arguments to kmstest.py.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 tests/kmstest.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)


base-commit: 2264236eefd15450320c0cdb34fa07ac0881f713
diff mbox series

Patch

diff --git a/tests/kmstest.py b/tests/kmstest.py
index 4bd4e0ad27a6..a86d689347d9 100755
--- a/tests/kmstest.py
+++ b/tests/kmstest.py
@@ -549,14 +549,23 @@  class KMSTest(object):
 
 
 if __name__ == '__main__':
+    import argparse
     import importlib
     import inspect
     import os
+    import sys
 
-    files = []
-    for path in os.scandir():
-        if path.is_file() and path.name.startswith('kms-test-') and path.name.endswith('.py'):
-            files.append(path.name)
+    parser = argparse.ArgumentParser()
+    parser.add_argument('test', type=str, nargs='*', help='Tests files')
+    args = parser.parse_args(sys.argv[1:])
+
+    if args.test:
+        files = args.test
+    else:
+        files = []
+        for path in os.scandir():
+            if path.is_file() and path.name.startswith('kms-test-') and path.name.endswith('.py'):
+                files.append(path.name)
 
     files.sort()
     for file in files: