Skip to content

Commit

Permalink
tests: rename poorly named function and add report argument
Browse files Browse the repository at this point in the history
The poorly named `print_tool_versions()` doesn't just print the tools
versions, it finds them and populates a global table, without which some
tests will fail. Rename the function and add a `report` argument so that
calls can decide whether they want to have the printed message, because
the single runner doesn't in quick mode.
  • Loading branch information
dcbaker authored and eli-schwartz committed Jul 12, 2024
1 parent f5d66b4 commit 8e89a38
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions run_project_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ class ToolInfo(T.NamedTuple):
regex: T.Pattern
match_group: int

def print_tool_versions() -> None:
def detect_tools(report: bool = True) -> None:
tools: T.List[ToolInfo] = [
ToolInfo(
'ninja',
Expand Down Expand Up @@ -1553,6 +1553,11 @@ def get_version(t: ToolInfo) -> str:

return f'{exe} (unknown)'

if not report:
for tool in tools:
get_version(tool)
return

print()
print('tools')
print()
Expand Down Expand Up @@ -1646,7 +1651,7 @@ def setup_symlinks() -> None:
print('VSCMD version', os.environ['VSCMD_VER'])
setup_commands(options.backend)
detect_system_compiler(options)
print_tool_versions()
detect_tools()
script_dir = os.path.split(__file__)[0]
if script_dir != '':
os.chdir(script_dir)
Expand Down
6 changes: 3 additions & 3 deletions run_single_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright © 2021-2023 Intel Corporation
# Copyright © 2021-2024 Intel Corporation

"""Script for running a single project test.
Expand All @@ -15,7 +15,7 @@
from mesonbuild import mlog
from run_tests import handle_meson_skip_test
from run_project_tests import TestDef, load_test_json, run_test, BuildStep
from run_project_tests import setup_commands, detect_system_compiler, print_tool_versions
from run_project_tests import setup_commands, detect_system_compiler, detect_tools

if T.TYPE_CHECKING:
from run_project_tests import CompilerArgumentType
Expand Down Expand Up @@ -47,7 +47,7 @@ def main() -> None:
setup_commands(args.backend)
if not args.quick:
detect_system_compiler(args)
print_tool_versions()
detect_tools(not args.quick)

test = TestDef(args.case, args.case.stem, [])
tests = load_test_json(test, False)
Expand Down

0 comments on commit 8e89a38

Please sign in to comment.