Skip to content

Commit

Permalink
Re-enable YAML tests in CI. (#28958)
Browse files Browse the repository at this point in the history
Two fixes, basically:

1. Make tests_with_command fail if the command fails.  This would have caught
   the fact that we were not ending up with a useful test list.
2. Fix the test list determination for the CHIP_TOOL_PYTHON runner.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Apr 19, 2024
1 parent b2cb4c9 commit 72240f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 144,292 deletions.
25 changes: 11 additions & 14 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,20 @@ def target_for_name(name: str):
return TestTarget.ALL_CLUSTERS


def tests_with_command(chip_tool: str, is_manual: bool, is_chip_tool_python_only: bool = False):
def tests_with_command(chip_tool: str, is_manual: bool):
"""Executes `chip_tool` binary to see what tests are available, using cmd
to get the list.
"""
cmd = "list"
if is_manual:
cmd += "-manual"
elif is_chip_tool_python_only:
cmd += "-python-runner-only"

result = subprocess.run([chip_tool, "tests", cmd], capture_output=True)
result.check_returncode()

test_tags = set()
if is_manual:
test_tags.add(TestTag.MANUAL)
if is_chip_tool_python_only:
test_tags.add(TestTag.CHIP_TOOL_PYTHON_ONLY)

in_development_tests = [s.replace(".yaml", "") for s in _GetInDevelopmentTests()]

Expand All @@ -243,9 +240,7 @@ def tests_with_command(chip_tool: str, is_manual: bool, is_chip_tool_python_only
)


# TODO We will move away from hardcoded list of yamltests to run all file when yamltests
# parser/runner reaches parity with the code gen version.
def _hardcoded_python_yaml_tests():
def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool):
manual_tests = _GetManualTests()
flaky_tests = _GetFlakyTests()
slow_tests = _GetSlowTests()
Expand All @@ -269,7 +264,7 @@ def _hardcoded_python_yaml_tests():
if path.name in in_development_tests:
tags.add(TestTag.IN_DEVELOPMENT)

if path.name in chip_repl_unsupported_tests:
if treat_repl_unsupported_as_in_development and path.name in chip_repl_unsupported_tests:
tags.add(TestTag.IN_DEVELOPMENT)

yield TestDefinition(
Expand All @@ -280,8 +275,13 @@ def _hardcoded_python_yaml_tests():
)


def AllYamlTests():
for test in _hardcoded_python_yaml_tests():
def AllReplYamlTests():
for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=True):
yield test


def AllChipToolYamlTests():
for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=False):
yield test


Expand All @@ -292,9 +292,6 @@ def AllChipToolTests(chip_tool: str):
for test in tests_with_command(chip_tool, is_manual=True):
yield test

for test in tests_with_command(chip_tool, is_manual=False, is_chip_tool_python_only=True):
yield test


__all__ = [
"TestTarget",
Expand Down
4 changes: 3 additions & 1 deletion scripts/tests/run_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob,

# Figures out selected test that match the given name(s)
if runtime == TestRunTime.CHIP_REPL_PYTHON:
all_tests = [test for test in chiptest.AllYamlTests()]
all_tests = [test for test in chiptest.AllReplYamlTests()]
elif runtime == TestRunTime.CHIP_TOOL_PYTHON:
all_tests = [test for test in chiptest.AllChipToolYamlTests()]
else:
all_tests = [test for test in chiptest.AllChipToolTests(chip_tool)]

Expand Down
5 changes: 0 additions & 5 deletions src/app/tests/suites/pythonRunnerOnlyTests.json

This file was deleted.

Loading

0 comments on commit 72240f8

Please sign in to comment.