Skip to content

Commit b079f63

Browse files
author
Petr Vesely
committed
[UR] Fetch testsuite names from ctest
1 parent 26b9d82 commit b079f63

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

scripts/ctest_parser.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
88
"""
99

10-
from subprocess import Popen, DEVNULL
10+
from subprocess import Popen, DEVNULL, PIPE
1111
import argparse
1212
import os
1313
import json
1414

1515
TMP_RESULTS_FILE = "tmp-results-file.json"
16-
CTS_TEST_SUITES = ["context", "device", "enqueue", "event", "kernel", "memory",
17-
"platform", "program", "queue", "runtime", "sampler", "usm",
18-
"virtual_memory"]
16+
17+
def get_cts_test_suite_names(working_directory):
18+
process = Popen(["ctest", "--show-only=json-v1"], cwd=working_directory,
19+
stdout=PIPE, env=os.environ.copy())
20+
out,_ = process.communicate()
21+
testsuites = json.loads(out)
22+
return [test['name']for test in testsuites['tests']]
1923

2024
def percent(amount, total):
2125
return round((amount / total) * 100, 2)
@@ -74,8 +78,10 @@ def run(args):
7478
env = os.environ.copy()
7579
env['GTEST_OUTPUT'] = f"json:{tmp_results_file}"
7680

81+
test_suite_names = get_cts_test_suite_names(f"{args.ctest_path}/test/conformance/")
82+
7783
## try and list all the available tests
78-
for suite in CTS_TEST_SUITES:
84+
for suite in test_suite_names:
7985
results[suite] = {}
8086
test_executable = f"{args.ctest_path}/bin/test-{suite}"
8187
process = Popen([test_executable, "--gtest_list_tests"], env=env,
@@ -90,7 +96,7 @@ def run(args):
9096
except FileNotFoundError:
9197
print(f"Could not discover tests for {suite}")
9298

93-
for suite in CTS_TEST_SUITES:
99+
for suite in test_suite_names:
94100
ctest_path = f"{args.ctest_path}/test/conformance/{suite}"
95101
process = Popen(['ctest',ctest_path], env=env, cwd=ctest_path,
96102
stdout=DEVNULL if args.quiet else None,

0 commit comments

Comments
 (0)