Skip to content

Commit

Permalink
untested test run. good times
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille committed Jan 25, 2024
1 parent 223bf1c commit 8dc8697
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 56 deletions.
44 changes: 0 additions & 44 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,42 +248,6 @@ def target_for_name(name: str):
return TestTarget.ALL_CLUSTERS


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"

cmd = [chip_tool, "tests", cmd]
result = subprocess.run(cmd, capture_output=True, encoding="utf-8")
if result.returncode != 0:
logging.error(f'Failed to run {cmd}:')
logging.error('STDOUT: ' + result.stdout)
logging.error('STDERR: ' + result.stderr)
result.check_returncode()

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

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

for name in result.stdout.split("\n"):
if not name:
continue

target = target_for_name(name)
tags = test_tags.copy()
if name in in_development_tests:
tags.add(TestTag.IN_DEVELOPMENT)

yield TestDefinition(
run_name=name, name=name, target=target, tags=tags
)


def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool, use_short_run_name: bool):
"""
use_short_run_name should be true if we want the run_name to be "Test_ABC" instead of "some/path/Test_ABC.yaml"
Expand Down Expand Up @@ -345,14 +309,6 @@ def AllChipToolYamlTests():
yield test


def AllChipToolTests(chip_tool: str):
for test in tests_with_command(chip_tool, is_manual=False):
yield test

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


__all__ = [
"TestTarget",
"TestDefinition",
Expand Down
7 changes: 1 addition & 6 deletions scripts/tests/chiptest/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ def to_s(self):


class TestRunTime(Enum):
CHIP_TOOL_BUILTIN = auto() # run via chip-tool built-in test commands
CHIP_TOOL_PYTHON = auto() # use the python yaml test parser with chip-tool
CHIP_REPL_PYTHON = auto() # use the python yaml test runner
DARWIN_FRAMEWORK_TOOL_BUILTIN = auto() # run via darwin-framework-tool built-in test commands


@dataclass
Expand All @@ -272,7 +270,7 @@ def tags_str(self) -> str:
return ", ".join([t.to_s() for t in self.tags])

def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str,
timeout_seconds: typing.Optional[int], dry_run=False, test_runtime: TestRunTime = TestRunTime.CHIP_TOOL_BUILTIN):
timeout_seconds: typing.Optional[int], dry_run=False, test_runtime: TestRunTime = TestRunTime.CHIP_TOOL_PYTHON):
"""
Executes the given test case using the provided runner for execution.
"""
Expand Down Expand Up @@ -349,9 +347,6 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str,
(' ' if len(tool_storage_args) else '') + ' '.join(tool_storage_args)]
pairing_cmd += server_args
test_cmd += server_args
elif test_runtime == TestRunTime.CHIP_TOOL_BUILTIN:
pairing_cmd += tool_storage_args
test_cmd += tool_storage_args

if dry_run:
# Some of our command arguments have spaces in them, so if we are
Expand Down
7 changes: 1 addition & 6 deletions scripts/tests/run_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,10 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob,
log_fmt = '%(levelname)-7s %(message)s'
coloredlogs.install(level=__LOG_LEVELS__[log_level], fmt=log_fmt)

runtime = TestRunTime.CHIP_TOOL_BUILTIN
if runner == 'chip_repl_python':
runtime = TestRunTime.CHIP_REPL_PYTHON
elif runner == 'chip_tool_python':
runtime = TestRunTime.CHIP_TOOL_PYTHON
elif chip_tool is not None and os.path.basename(chip_tool) == "darwin-framework-tool":
runtime = TestRunTime.DARWIN_FRAMEWORK_TOOL_BUILTIN

if chip_tool is None and not runtime == TestRunTime.CHIP_REPL_PYTHON:
# non yaml tests REQUIRE chip-tool. Yaml tests should not require chip-tool
Expand All @@ -160,10 +157,8 @@ 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.AllReplYamlTests()]
elif runtime == TestRunTime.CHIP_TOOL_PYTHON and os.path.basename(chip_tool) != "darwin-framework-tool":
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)]

tests = all_tests

Expand Down

0 comments on commit 8dc8697

Please sign in to comment.