|
10 | 10 | # Printing conformance test output from gtest and checking failed tests with match files.
|
11 | 11 | # The match files contain tests that are expected to fail.
|
12 | 12 |
|
| 13 | +import os |
| 14 | +import shlex |
13 | 15 | import sys
|
14 | 16 | from argparse import ArgumentParser
|
15 | 17 | import subprocess # nosec B404
|
16 | 18 | import signal
|
17 | 19 | import re
|
18 | 20 | from collections import OrderedDict
|
19 | 21 |
|
20 |
| -if __name__ == '__main__': |
| 22 | + |
| 23 | +def _print_cmdline(cmd_args, env, cwd, file=sys.stderr): |
| 24 | + cwd = shlex.quote(cwd) |
| 25 | + env_args = " ".join( |
| 26 | + "%s=%s" % (shlex.quote(k), shlex.quote(v)) for k, v in env.items() |
| 27 | + ) |
| 28 | + cmd_str = " ".join(map(shlex.quote, cmd_args)) |
| 29 | + print(f"### env -C {cwd} -i {env_args} {cmd_str}", file=file) |
| 30 | + |
| 31 | + |
| 32 | +if __name__ == "__main__": |
21 | 33 |
|
22 | 34 | parser = ArgumentParser()
|
23 | 35 | parser.add_argument("--test_command", help="Ctest test case")
|
24 | 36 | parser.add_argument("--devices_count", type=str, help="Number of devices on which tests will be run")
|
25 | 37 | parser.add_argument("--platforms_count", type=str, help="Number of platforms on which tests will be run")
|
26 | 38 | args = parser.parse_args()
|
| 39 | + invocation = [ |
| 40 | + args.test_command, |
| 41 | + "--gtest_brief=1", |
| 42 | + f"--devices_count={args.devices_count}", |
| 43 | + f"--platforms_count={args.platforms_count}", |
| 44 | + ] |
| 45 | + _print_cmdline(invocation, os.environ, os.getcwd()) |
27 | 46 |
|
28 |
| - result = subprocess.Popen([args.test_command, '--gtest_brief=1', # nosec B603 |
29 |
| - f'--devices_count={args.devices_count}', |
30 |
| - f'--platforms_count={args.platforms_count}'], |
31 |
| - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) |
| 47 | + result = subprocess.Popen( # nosec B603 |
| 48 | + invocation, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True |
| 49 | + ) |
32 | 50 |
|
33 | 51 | pat = re.compile(r'\[( )*FAILED( )*\]')
|
34 | 52 | output_list = []
|
|
0 commit comments