Skip to content

Commit 427d701

Browse files
Define CI tests arguments in YAML format (#35770)
* Define CI tests arguments in YAML format * Convert ACE and ACL tests arguments to YAML * Update doc for CI test arguments * Restyled by prettier-markdown * Improve error reporting --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 627b561 commit 427d701

File tree

10 files changed

+200
-93
lines changed

10 files changed

+200
-93
lines changed

docs/testing/python.md

+33-37
Original file line numberDiff line numberDiff line change
@@ -644,74 +644,70 @@ single command.
644644

645645
Example to compile all prerequisites and then running all python tests:
646646

647-
```
647+
```shell
648648
./scripts/tests/local.py build # will compile python in out/pyenv and ALL application prerequisites
649649
./scripts/tests/local.py python-tests # Runs all python tests that are runnable in CI
650650
```
651651

652652
## Defining the CI test arguments
653653

654-
Below is the format of the structured environment definition comments:
654+
Arguments required to run a test can be defined in the comment block at the top
655+
of the test script. The section with the arguments should be placed between the
656+
`# === BEGIN CI TEST ARGUMENTS ===` and `# === END CI TEST ARGUMENTS ===`
657+
markers. Arguments should be structured as a valid YAML dictionary with a root
658+
key `test-runner-runs`, followed by the run identifier, and then the parameters
659+
for that run, e.g.:
655660

656-
```
661+
```python
657662
# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments
658663
# for details about the block below.
659664
#
660665
# === BEGIN CI TEST ARGUMENTS ===
661-
# test-runner-runs: <run_identifier>
662-
# test-runner-run/<run_identifier>/app: ${TYPE_OF_APP}
663-
# test-runner-run/<run_identifier>/factoryreset: <True|False>
664-
# test-runner-run/<run_identifier>/quiet: <True|False>
665-
# test-runner-run/<run_identifier>/app-args: <app_arguments>
666-
# test-runner-run/<run_identifier>/script-args: <script_arguments>
666+
# test-runner-runs:
667+
# run1:
668+
# app: ${TYPE_OF_APP}
669+
# factoryreset: <true|false>
670+
# quiet: <true|false>
671+
# app-args: <app_arguments>
672+
# script-args: <script_arguments>
667673
# === END CI TEST ARGUMENTS ===
668674
```
669675

670-
NOTE: The `=== BEGIN CI TEST ARGUMENTS ===` and `=== END CI TEST ARGUMENTS ===`
671-
markers must be present.
672-
673676
### Description of Parameters
674677

675-
- `test-runner-runs`: Specifies the identifier for the run. This can be any
676-
unique identifier.
677-
678-
- Example: `run1`
679-
680-
- `test-runner-run/<run_identifier>/app`: Indicates the application to be used
681-
in the test. Different app types as needed could be referenced from section
682-
[name: Generate an argument environment file ] of the file
678+
- `app`: Indicates the application to be used in the test. Different app types
679+
as needed could be referenced from section [name: Generate an argument
680+
environment file ] of the file
683681
[.github/workflows/tests.yaml](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml)
684682

685-
- Example: `${TYPE_OF_APP}`
683+
- Example: `${TYPE_OF_APP}`
686684

687-
- `test-runner-run/<run_identifier>/factoryreset`: Determines whether a
688-
factory reset should be performed before the test.
685+
- `factoryreset`: Determines whether a factory reset should be performed
686+
before the test.
689687

690-
- Example: `True`
688+
- Example: `true`
691689

692-
- `test-runner-run/<run_identifier>/quiet`: Sets the verbosity level of the
693-
test run. When set to True, the test run will be quieter.
690+
- `quiet`: Sets the verbosity level of the test run. When set to True, the
691+
test run will be quieter.
694692

695-
- Example: `True`
693+
- Example: `true`
696694

697-
- `test-runner-run/<run_identifier>/app-args`: Specifies the arguments to be
698-
passed to the application during the test.
695+
- `app-args`: Specifies the arguments to be passed to the application during
696+
the test.
699697

700698
- Example:
701699
`--discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json`
702700

703-
- `test-runner-run/<run_identifier>/script-args`: Specifies the arguments to
704-
be passed to the test script.
701+
- `script-args`: Specifies the arguments to be passed to the test script.
705702

706703
- Example:
707704
`--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto`
708705

709-
- `test-runner-run/<run_identifier>/script-start-delay`: Specifies the number
710-
of seconds to wait before starting the test script. This parameter can be
711-
used to allow the application to initialize itself properly before the test
712-
script will try to commission it (e.g. in case if the application needs to
713-
be commissioned to some other controller first). By default, the delay is 0
714-
seconds.
706+
- `script-start-delay`: Specifies the number of seconds to wait before
707+
starting the test script. This parameter can be used to allow the
708+
application to initialize itself properly before the test script will try to
709+
commission it (e.g. in case if the application needs to be commissioned to
710+
some other controller first). By default, the delay is 0 seconds.
715711

716712
- Example: `10`
717713

src/python_testing/TC_ACE_1_2.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@
1919
# for details about the block below.
2020
#
2121
# === BEGIN CI TEST ARGUMENTS ===
22-
# test-runner-runs: run1
23-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
24-
# test-runner-run/run1/factoryreset: True
25-
# test-runner-run/run1/quiet: True
26-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
27-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
22+
# test-runner-runs:
23+
# run1:
24+
# app: ${ALL_CLUSTERS_APP}
25+
# factoryreset: true
26+
# quiet: true
27+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
28+
# script-args: >
29+
# --storage-path admin_storage.json
30+
# --commissioning-method on-network
31+
# --discriminator 1234
32+
# --passcode 20202021
33+
# --trace-to json:${TRACE_TEST_JSON}.json
34+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2835
# === END CI TEST ARGUMENTS ===
2936

3037
import logging

src/python_testing/TC_ACE_1_3.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@
1919
# for details about the block below.
2020
#
2121
# === BEGIN CI TEST ARGUMENTS ===
22-
# test-runner-runs: run1
23-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
24-
# test-runner-run/run1/factoryreset: True
25-
# test-runner-run/run1/quiet: True
26-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
27-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
22+
# test-runner-runs:
23+
# run1:
24+
# app: ${ALL_CLUSTERS_APP}
25+
# factoryreset: true
26+
# quiet: true
27+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
28+
# script-args: >
29+
# --storage-path admin_storage.json
30+
# --commissioning-method on-network
31+
# --discriminator 1234
32+
# --passcode 20202021
33+
# --trace-to json:${TRACE_TEST_JSON}.json
34+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2835
# === END CI TEST ARGUMENTS ===
2936

3037
import logging

src/python_testing/TC_ACE_1_4.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,21 @@
1919
# for details about the block below.
2020
#
2121
# === BEGIN CI TEST ARGUMENTS ===
22-
# test-runner-runs: run1
23-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
24-
# test-runner-run/run1/factoryreset: True
25-
# test-runner-run/run1/quiet: True
26-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
27-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
22+
# test-runner-runs:
23+
# run1:
24+
# app: ${ALL_CLUSTERS_APP}
25+
# factoryreset: true
26+
# quiet: true
27+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
28+
# script-args: >
29+
# --storage-path admin_storage.json
30+
# --commissioning-method on-network
31+
# --discriminator 1234
32+
# --passcode 20202021
33+
# --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100
34+
# --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff
35+
# --trace-to json:${TRACE_TEST_JSON}.json
36+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2837
# === END CI TEST ARGUMENTS ===
2938

3039
import sys

src/python_testing/TC_ACE_1_5.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@
1919
# for details about the block below.
2020
#
2121
# === BEGIN CI TEST ARGUMENTS ===
22-
# test-runner-runs: run1
23-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
24-
# test-runner-run/run1/factoryreset: True
25-
# test-runner-run/run1/quiet: True
26-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
27-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
22+
# test-runner-runs:
23+
# run1:
24+
# app: ${ALL_CLUSTERS_APP}
25+
# factoryreset: true
26+
# quiet: true
27+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
28+
# script-args: >
29+
# --storage-path admin_storage.json
30+
# --commissioning-method on-network
31+
# --discriminator 1234
32+
# --passcode 20202021
33+
# --PICS src/app/tests/suites/certification/ci-pics-values
34+
# --trace-to json:${TRACE_TEST_JSON}.json
35+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2836
# === END CI TEST ARGUMENTS ===
2937

3038
import logging

src/python_testing/TC_ACL_2_11.py

+17-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@
1919
# for details about the block below.
2020
#
2121
# === BEGIN CI TEST ARGUMENTS ===
22-
# test-runner-runs: run1
23-
# test-runner-run/run1/app: ${NETWORK_MANAGEMENT_APP}
24-
# test-runner-run/run1/factoryreset: True
25-
# test-runner-run/run1/quiet: True
26-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --commissioning-arl-entries "[{\"endpoint\": 1,\"cluster\": 1105,\"restrictions\": [{\"type\": 0,\"id\": 0}]}]" --arl-entries "[{\"endpoint\": 1,\"cluster\": 1105,\"restrictions\": [{\"type\": 0,\"id\": 0}]}]"
27-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
22+
# test-runner-runs:
23+
# run1:
24+
# app: ${NETWORK_MANAGEMENT_APP}
25+
# factoryreset: true
26+
# quiet: true
27+
# app-args: >
28+
# --discriminator 1234 --KVS kvs1
29+
# --trace-to json:${TRACE_APP}.json
30+
# --commissioning-arl-entries "[{\"endpoint\": 1,\"cluster\": 1105,\"restrictions\": [{\"type\": 0,\"id\": 0}]}]"
31+
# --arl-entries "[{\"endpoint\": 1,\"cluster\": 1105,\"restrictions\": [{\"type\": 0,\"id\": 0}]}]"
32+
# script-args: >
33+
# --storage-path admin_storage.json
34+
# --commissioning-method on-network
35+
# --discriminator 1234
36+
# --passcode 20202021
37+
# --trace-to json:${TRACE_TEST_JSON}.json
38+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2839
# === END CI TEST ARGUMENTS ===
2940

3041
import logging

src/python_testing/TC_ACL_2_2.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@
1616
#
1717

1818
# === BEGIN CI TEST ARGUMENTS ===
19-
# test-runner-runs: run1
20-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
21-
# test-runner-run/run1/factoryreset: True
22-
# test-runner-run/run1/quiet: True
23-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
24-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
19+
# test-runner-runs:
20+
# run1:
21+
# app: ${ALL_CLUSTERS_APP}
22+
# factoryreset: true
23+
# quiet: true
24+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
25+
# script-args: >
26+
# --storage-path admin_storage.json
27+
# --commissioning-method on-network
28+
# --discriminator 1234
29+
# --passcode 20202021
30+
# --trace-to json:${TRACE_TEST_JSON}.json
31+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2532
# === END CI TEST ARGUMENTS ===
2633

2734
import chip.clusters as Clusters

src/python_testing/TC_AccessChecker.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
# for details about the block below.
33
#
44
# === BEGIN CI TEST ARGUMENTS ===
5-
# test-runner-runs: run1
6-
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
7-
# test-runner-run/run1/factoryreset: True
8-
# test-runner-run/run1/quiet: True
9-
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
10-
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
5+
# test-runner-runs:
6+
# run1:
7+
# app: ${ALL_CLUSTERS_APP}
8+
# factoryreset: true
9+
# quiet: true
10+
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
11+
# script-args: >
12+
# --storage-path admin_storage.json
13+
# --commissioning-method on-network
14+
# --discriminator 1234
15+
# --passcode 20202021
16+
# --trace-to json:${TRACE_TEST_JSON}.json
17+
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
1118
# === END CI TEST ARGUMENTS ===
1219

1320
import logging

0 commit comments

Comments
 (0)