Skip to content

Commit

Permalink
[CI] Update scripts/tests/run_test_suite.py so it can run darwinframe…
Browse files Browse the repository at this point in the history
…worktool.py (#29130)

* [MatterYamlTests] Allow chiptool.py to specify the specifications dirs

* [darwin-framework-tool] Expose --storage-directory argument

* [CI] Update scripts/tests/run_test_suite.py so it can run darwinframeworktool.py
  • Loading branch information
vivien-apple authored and pull[bot] committed Oct 13, 2023
1 parent 192057e commit 3277857
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class CHIPCommandBridge : public Command {
AddArgument("paa-trust-store-path", &mPaaTrustStorePath,
"Path to directory holding PAA certificate information. Can be absolute or relative to the current working "
"directory.");
AddArgument(
"storage-directory", &mStorageDirectory, "This option does nothing. It is here for API compatibility with chip-tool.");
AddArgument("commissioner-vendor-id", 0, UINT16_MAX, &mCommissionerVendorId,
"The vendor id to use for darwin-framework-tool. If not provided, chip::VendorId::TestVendor1 (65521, 0xFFF1) will be "
"used.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ el_status_t StopFunction()

ClearLine();

*status = mHandler->RunInteractive(command);
*status = mHandler->RunInteractive(command, GetStorageDirectory());

return YES;
}
7 changes: 5 additions & 2 deletions scripts/tests/run_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ 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:
elif runtime == TestRunTime.CHIP_TOOL_PYTHON and os.path.basename(chip_tool) != "darwin-framework-tool":
all_tests = [test for test in chiptest.AllChipToolYamlTests()]
else:
all_tests = [test for test in chiptest.AllChipToolTests(chip_tool)]
Expand Down Expand Up @@ -313,7 +313,10 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
chip_repl_yaml_tester = paths_finder.get('yamltest_with_chip_repl_tester.py')

if chip_tool_with_python is None:
chip_tool_with_python = paths_finder.get('chiptool.py')
if context.obj.chip_tool and os.path.basename(context.obj.chip_tool) == "darwin-framework-tool":
chip_tool_with_python = paths_finder.get('darwinframeworktool.py')
else:
chip_tool_with_python = paths_finder.get('chiptool.py')

# Command execution requires an array
paths = chiptest.ApplicationPaths(
Expand Down
7 changes: 5 additions & 2 deletions scripts/tests/yaml/chiptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

_DEFAULT_EXTENSIONS_DIR = 'scripts/tests/yaml/extensions'
_DEFAULT_PICS_FILE = 'src/app/tests/suites/certification/ci-pics-values'
_DEFAULT_SPECIFICATIONS_DIR = 'src/app/zap-templates/zcl/data-model/chip/*.xml'


def chiptool_runner_options(f):
Expand All @@ -45,6 +46,8 @@ def chiptool_runner_options(f):
help='Add a delay between each test suite steps.')(f)
f = click.option('--continueOnFailure', type=bool, default=False, show_default=True,
help='Do not stop running the test suite on first error.')(f)
f = click.option('--specifications_paths', type=click.Path(), show_default=True, default=_DEFAULT_SPECIFICATIONS_DIR,
help='Path to a set of files containing clusters definitions.')(f)
f = click.option('--PICS', type=click.Path(exists=True), show_default=True, default=_DEFAULT_PICS_FILE,
help='Path to the PICS file to use.')(f)
f = click.option('--additional_pseudo_clusters_directory', type=click.Path(), show_default=True, default=_DEFAULT_EXTENSIONS_DIR,
Expand Down Expand Up @@ -80,14 +83,14 @@ def maybe_update_stop_on_error(ctx):
@click.argument('commands', nargs=-1)
@chiptool_runner_options
@click.pass_context
def chiptool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, show_adapter_logs: bool, trace_file: str, trace_decode: bool, delay_in_ms: int, continueonfailure: bool, pics: str, additional_pseudo_clusters_directory: str):
def chiptool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, show_adapter_logs: bool, trace_file: str, trace_decode: bool, delay_in_ms: int, continueonfailure: bool, specifications_paths: str, pics: str, additional_pseudo_clusters_directory: str):
success = False

server_arguments = maybe_update_server_arguments(ctx)
maybe_update_stop_on_error(ctx)

if len(commands) > 1 and commands[0] == 'tests':
success = send_yaml_command(chiptool, commands[1], server_path, server_arguments, show_adapter_logs, pics,
success = send_yaml_command(chiptool, commands[1], server_path, server_arguments, show_adapter_logs, specifications_paths, pics,
additional_pseudo_clusters_directory, commands[2:])
else:
if server_path is None and server_name:
Expand Down
7 changes: 5 additions & 2 deletions scripts/tests/yaml/darwinframeworktool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

_DEFAULT_EXTENSIONS_DIR = 'scripts/tests/yaml/extensions'
_DEFAULT_PICS_FILE = 'src/app/tests/suites/certification/ci-pics-values'
_DEFAULT_SPECIFICATIONS_DIR = 'src/app/zap-templates/zcl/data-model/chip/*.xml'


def darwinframeworktool_runner_options(f):
Expand All @@ -41,6 +42,8 @@ def darwinframeworktool_runner_options(f):
help='Add a delay between each test suite steps.')(f)
f = click.option('--continueOnFailure', type=bool, default=False, show_default=True,
help='Do not stop running the test suite on first error.')(f)
f = click.option('--specifications_paths', type=click.Path(), show_default=True, default=_DEFAULT_SPECIFICATIONS_DIR,
help='Path to a set of files containing clusters definitions.')(f)
f = click.option('--PICS', type=click.Path(exists=True), show_default=True, default=_DEFAULT_PICS_FILE,
help='Path to the PICS file to use.')(f)
f = click.option('--additional_pseudo_clusters_directory', type=click.Path(), show_default=True, default=_DEFAULT_EXTENSIONS_DIR,
Expand All @@ -63,14 +66,14 @@ def maybe_update_stop_on_error(ctx):
@click.argument('commands', nargs=-1)
@darwinframeworktool_runner_options
@click.pass_context
def darwinframeworktool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, show_adapter_logs: bool, delay_in_ms: int, continueonfailure: bool, pics: str, additional_pseudo_clusters_directory: str):
def darwinframeworktool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, show_adapter_logs: bool, delay_in_ms: int, continueonfailure: bool, specifications_paths: str, pics: str, additional_pseudo_clusters_directory: str):
success = False

server_arguments = ctx.params['server_arguments']
maybe_update_stop_on_error(ctx)

if len(commands) > 1 and commands[0] == 'tests':
success = send_yaml_command(darwinframeworktool, commands[1], server_path, server_arguments, show_adapter_logs, pics,
success = send_yaml_command(darwinframeworktool, commands[1], server_path, server_arguments, show_adapter_logs, specifications_paths, pics,
additional_pseudo_clusters_directory, commands[2:])
else:
if server_path is None and server_name:
Expand Down
5 changes: 3 additions & 2 deletions scripts/tests/yaml/tests_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


@click.pass_context
def send_yaml_command(ctx, test_tool, test_name: str, server_path: str, server_arguments: str, show_adapter_logs: bool, pics: str, additional_pseudo_clusters_directory: str, commands: List[str]):
kwargs = {'test_name': test_name, 'show_adapter_logs': show_adapter_logs, 'pics': pics,
def send_yaml_command(ctx, test_tool, test_name: str, server_path: str, server_arguments: str, show_adapter_logs: bool, specifications_paths: str, pics: str, additional_pseudo_clusters_directory: str, commands: List[str]):
kwargs = {'test_name': test_name, 'show_adapter_logs': show_adapter_logs, 'specifications_paths': specifications_paths, 'pics': pics,
'additional_pseudo_clusters_directory': additional_pseudo_clusters_directory}

index = 0
Expand All @@ -37,6 +37,7 @@ def send_yaml_command(ctx, test_tool, test_name: str, server_path: str, server_a
ctx.invoke(runner_base, **kwargs)

del ctx.params['commands']
del ctx.params['specifications_paths']
del ctx.params['pics']
del ctx.params['additional_pseudo_clusters_directory']

Expand Down

0 comments on commit 3277857

Please sign in to comment.