7
7
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
8
"""
9
9
10
- from subprocess import Popen , DEVNULL
10
+ from subprocess import Popen , DEVNULL , PIPE
11
11
import argparse
12
12
import os
13
13
import json
14
14
15
15
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' ]]
19
23
20
24
def percent (amount , total ):
21
25
return round ((amount / total ) * 100 , 2 )
@@ -74,8 +78,10 @@ def run(args):
74
78
env = os .environ .copy ()
75
79
env ['GTEST_OUTPUT' ] = f"json:{ tmp_results_file } "
76
80
81
+ test_suite_names = get_cts_test_suite_names (f"{ args .ctest_path } /test/conformance/" )
82
+
77
83
## try and list all the available tests
78
- for suite in CTS_TEST_SUITES :
84
+ for suite in test_suite_names :
79
85
results [suite ] = {}
80
86
test_executable = f"{ args .ctest_path } /bin/test-{ suite } "
81
87
process = Popen ([test_executable , "--gtest_list_tests" ], env = env ,
@@ -90,7 +96,7 @@ def run(args):
90
96
except FileNotFoundError :
91
97
print (f"Could not discover tests for { suite } " )
92
98
93
- for suite in CTS_TEST_SUITES :
99
+ for suite in test_suite_names :
94
100
ctest_path = f"{ args .ctest_path } /test/conformance/{ suite } "
95
101
process = Popen (['ctest' ,ctest_path ], env = env , cwd = ctest_path ,
96
102
stdout = DEVNULL if args .quiet else None ,
0 commit comments