Skip to content

Commit f56e2a4

Browse files
committed
TC-RR-1.1: Allow proper commissioning from TH
This test set required commissioning parameters in the command line runner, which weren't being picked up by the test harness when it commissioned. I have moved these to be default so that we can commission once and run all the tests. Also removed the ability to set parameters in this way because it will always result in test harness weirdness.
1 parent e48ed00 commit f56e2a4

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

src/python_testing/TC_RR_1_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -871,4 +871,4 @@ async def read_heap_statistics(self, dev_ctrl):
871871

872872

873873
if __name__ == "__main__":
874-
default_matter_test_main(maximize_cert_chains=True, controller_cat_tags=[0x0001_0001])
874+
default_matter_test_main()

src/python_testing/matter_testing_support.py

+11-21
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ class MatterTestConfig:
374374
discriminators: Optional[List[int]] = None
375375
setup_passcodes: Optional[List[int]] = None
376376
commissionee_ip_address_just_for_testing: Optional[str] = None
377-
maximize_cert_chains: bool = False
377+
# By default, we start with maximized cert chains, as required for RR-1.1.
378+
# This allows cert tests to be run without re-commissioning for RR-1.1.
379+
maximize_cert_chains: bool = True
378380

379381
qr_code_content: Optional[str] = None
380382
manual_code: Optional[str] = None
@@ -390,7 +392,10 @@ class MatterTestConfig:
390392
# Node ID to use for controller/commissioner
391393
controller_node_id: int = _DEFAULT_CONTROLLER_NODE_ID
392394
# CAT Tags for default controller/commissioner
393-
controller_cat_tags: List[int] = field(default_factory=list)
395+
# By default, we commission with CAT tags specified for RR-1.1
396+
# so the cert tests can be run without re-commissioning the device
397+
# for this one test. This can be overwritten from the command line
398+
controller_cat_tags: List[int] = field(default_factory=lambda: [0x0001_0001])
394399

395400
# Fabric ID which to use
396401
fabric_id: int = 1
@@ -1415,7 +1420,7 @@ def convert_args_to_matter_config(args: argparse.Namespace) -> MatterTestConfig:
14151420
return config
14161421

14171422

1418-
def parse_matter_test_args(argv: List[str]) -> MatterTestConfig:
1423+
def parse_matter_test_args() -> MatterTestConfig:
14191424
parser = argparse.ArgumentParser(description='Matter standalone Python test')
14201425

14211426
basic_group = parser.add_argument_group(title="Basic arguments", description="Overall test execution arguments")
@@ -1527,9 +1532,7 @@ def parse_matter_test_args(argv: List[str]) -> MatterTestConfig:
15271532
args_group.add_argument('--hex-arg', nargs='*', type=bytes_as_hex_named_arg, metavar="NAME:VALUE",
15281533
help="Add a named test argument for an octet string in hex (e.g. 0011cafe or 00:11:CA:FE)")
15291534

1530-
if not argv:
1531-
argv = sys.argv[1:]
1532-
1535+
argv = sys.argv[1:]
15331536
return convert_args_to_matter_config(parser.parse_known_args(argv)[0])
15341537

15351538

@@ -1612,7 +1615,7 @@ def _commission_device(self, i) -> bool:
16121615
raise ValueError("Invalid commissioning method %s!" % conf.commissioning_method)
16131616

16141617

1615-
def default_matter_test_main(argv=None, **kwargs):
1618+
def default_matter_test_main():
16161619
"""Execute the test class in a test module.
16171620
This is the default entry point for running a test script file directly.
16181621
In this case, only one test class in a test script is allowed.
@@ -1622,26 +1625,13 @@ def default_matter_test_main(argv=None, **kwargs):
16221625
...
16231626
if __name__ == '__main__':
16241627
default_matter_test_main.main()
1625-
Args:
1626-
argv: A list that is then parsed as command line args. If None, defaults to sys.argv
16271628
"""
16281629

1629-
matter_test_config = parse_matter_test_args(argv)
1630-
1631-
# Allow override of command line from optional arguments
1632-
if not matter_test_config.controller_cat_tags and "controller_cat_tags" in kwargs:
1633-
matter_test_config.controller_cat_tags = kwargs["controller_cat_tags"]
1630+
matter_test_config = parse_matter_test_args()
16341631

16351632
# Find the test class in the test script.
16361633
test_class = _find_test_class()
16371634

1638-
# This is required in case we need any testing with maximized certificate chains.
1639-
# We need *all* issuers from the start, even for default controller, to use
1640-
# maximized chains, before MatterStackState init, others some stale certs
1641-
# may not chain properly.
1642-
if "maximize_cert_chains" in kwargs:
1643-
matter_test_config.maximize_cert_chains = kwargs["maximize_cert_chains"]
1644-
16451635
hooks = InternalTestRunnerHooks()
16461636

16471637
run_tests(test_class, matter_test_config, hooks)

0 commit comments

Comments
 (0)