radeonsi/test: allow to pass a filename as a test filter value
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 10 Aug 2021 13:25:22 +0000 (15:25 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 12 Aug 2021 09:47:36 +0000 (11:47 +0200)
This allows this pattern:

   $ radeonsi-run-tests.py /tmp/foo
   ... reports that some piglit tests regressed ...
   $ radeonsi-run-tests.py -t /tmp/foo/new_baseline/sienna_cichlid-piglit-quick-fail.csv
   ... this only runs the test that regressed ...

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12306>

src/gallium/drivers/radeonsi/ci/radeonsi-run-tests.py

index 0a2b36f..d7fbeba 100755 (executable)
@@ -32,6 +32,7 @@ import tempfile
 import itertools
 import filecmp
 import multiprocessing
+import csv
 
 
 def print_red(txt, end_line=True):
@@ -61,7 +62,12 @@ parser.add_argument(
 )
 parser.add_argument("--verbose", "-v", action="count", default=0)
 parser.add_argument(
-    "--include-tests", "-t", action="append", dest="include_tests", default=[]
+    "--include-tests",
+    "-t",
+    action="append",
+    dest="include_tests",
+    default=[],
+    help="Only run the test matching this expression. This can only be a filename containing a list of failing tests to re-run.",
 )
 
 parser.add_argument(
@@ -199,6 +205,20 @@ def verify_results(baseline1, baseline2):
     return True
 
 
+def parse_test_filters(include_tests):
+    cmd = []
+    for t in include_tests:
+        if os.path.exists(t):
+            with open(t, "r") as file:
+                for row in csv.reader(file, delimiter=","):
+                    cmd += ["-t", row[0]]
+        else:
+            cmd += ["-t", t]
+    return cmd
+
+
+filters_args = parse_test_filters(args.include_tests)
+
 # piglit test
 if args.piglit:
     out = os.path.join(output_folder, "piglit")
@@ -223,9 +243,8 @@ if args.piglit:
         str(args.jobs),
         "--skips",
         skips,
-    ]
-    for t in args.include_tests:
-        cmd += ["-t", t]
+    ] + filters_args
+
     if os.path.exists(baseline):
         cmd += ["--baseline", baseline]
     env = os.environ.copy()
@@ -265,9 +284,8 @@ if args.glcts:
         str(args.jobs),
         "--timeout",
         "1000",
-    ]
-    for t in args.include_tests:
-        cmd += ["-t", t]
+    ] + filters_args
+
     if os.path.exists(baseline):
         cmd += ["--baseline", baseline]
     cmd += deqp_args