diff tests/run-tests.py @ 34969:d600bda4a3e1

run-tests: allow automatic test discovery when providing folder as argument Currently `run-tests.py` automatically discovers test only in the current directory if no argument is provided. This patch makes it possible to pass a number of tests and folders as arguments.
author Matthieu Laneuville <matthieu.laneuville@octobus.net>
date Thu, 19 Oct 2017 23:13:57 +0900
parents d8c2db6167b3
children 57d56f603f70
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Nov 03 14:47:37 2017 +0100
+++ b/tests/run-tests.py	Thu Oct 19 23:13:57 2017 +0900
@@ -2510,6 +2510,16 @@
             else:
                 args = os.listdir(b'.')
 
+        expanded_args = []
+        for arg in args:
+            if os.path.isdir(arg):
+                if not arg.endswith(b'/'):
+                    arg += b'/'
+                expanded_args.extend([arg + a for a in os.listdir(arg)])
+            else:
+                expanded_args.append(arg)
+        args = expanded_args
+
         tests = []
         for t in args:
             if not (os.path.basename(t).startswith(b'test-')