Skip to content

Commit 1646812

Browse files
krypton36pull[bot]
authored andcommitted
Update simulated README and fix gn_build_test_example template path. (#25661)
1 parent f434f1d commit 1646812

File tree

2 files changed

+41
-34
lines changed

2 files changed

+41
-34
lines changed

docs/guides/simulated_device_linux.md

+40-33
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ is defined by a ZAP config file and tests can be added with a
2424

2525
- [Building Prerequisites](./BUILDING.md#prerequisites)
2626
- [Prepare For Building](./BUILDING.md#prepare-for-building)
27+
- [Code Generate](../code_generation.md)
28+
- [ZAP Installed](../code_generation.md#installing-zap-and-environment-variables)
2729

28-
## Generating and building the default Simulated App with Script
30+
## Building the default Simulated App with Script
2931

3032
In order to utilize the app against a commissioner or controller, the app will
3133
need to be specifically built.
3234

33-
1. To generate the ZAP files, and build the `chip-app1` binary completing the
34-
following steps:
35+
1. To build the `chip-app1` binary completing the following steps:
3536

3637
```
37-
./scripts/examples/gn_build_test_example.sh app1
38+
./scripts/examples/gn_build_example.sh examples/placeholder/linux out/debug/simulated/ chip_tests_zap_config=\"app1\"
3839
```
3940
40-
## Build the App only
41+
## Build the App with gn and ninja
4142
4243
In order to utilize the app against a commissioner or controller, the app will
4344
need to be specifically built.
@@ -46,13 +47,7 @@ need to be specifically built.
4647
4748
```
4849
source scripts/activate.sh
49-
CHIP_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
50-
GN_ARGS="chip_tests_zap_config=\"app1\""
51-
GN_ARGS+="chip_project_config_include_dirs=[\"$CHIP_ROOT/examples/placeholder/linux/apps/app1/include\", \"$CHIP_ROOT/config/standalone\"]"
52-
GN_ARGS+="chip_config_network_layer_ble=false"
53-
54-
gn gen --check --fail-on-unused-args --root=examples/placeholder/linux out/simulated --args="$GN_ARGS"
55-
50+
gn gen --check --root=examples/placeholder/linux out/simulated --args="chip_tests_zap_config=\"app1\""
5651
ninja -C out/simulated
5752
```
5853
@@ -61,24 +56,18 @@ need to be specifically built.
6156
Now that the building is completed there is a `chip-app1` binary created. This
6257
binary can be executed on a linux os.
6358
64-
1. To generate the ZAP files, and build the `chip-app1` binary completing the
65-
following steps:
66-
67-
```
68-
./out/simulated/chip-app1
69-
```
59+
```
60+
./out/simulated/chip-app1
61+
```
7062
7163
## Running the app with test parameter
7264
7365
Now that the building is completed there is a `chip-app1` binary created. This
7466
binary can be executed on a linux os with test commands.
7567
76-
1. To generate the ZAP files, and build the `chip-app1` binary completing the
77-
following steps:
78-
79-
```
80-
./out/simulated/chip-app1 --command [TEST NAME]
81-
```
68+
```
69+
./out/simulated/chip-app1 --command [TEST NAME]
70+
```
8271
8372
## Interacting with the simulated app
8473
@@ -88,11 +77,13 @@ interact with it using chip-tool
8877
1. Follow the instruction to build chip-tool in the
8978
[chip-tool readme](../../examples/chip-tool/README.md).
9079
91-
2. Run this command to commission.
80+
2. Run this command to commission with whatever is listed on the "SetupQRCode:"
81+
line in the log output:
82+
9283
```
93-
./out/debug/standalone/chip-tool pairing code 0x654321 MT:-24J0AFN00KA0648G00
84+
./out/debug/standalone/chip-tool pairing code 0x654321 MT:-24J0AFN00KA0648G00
9485
```
95-
or whatever is listed on the "SetupQRCode:" line in the log output.
86+
9687
3. Most tests will start at this point and now an send cluster commands with
9788
chip-tool as follow.
9889
@@ -113,14 +104,18 @@ new code is generated.
113104
114105
1. YAML test file are located in
115106
[YAML folder](../../src/app/tests/suites/certification/)
107+
116108
2. Test names must follow a strict format dues to CI of test recognition. The
117109
format is as follows:
110+
118111
- Test_TC\_[`CATEGORY ABBREVIATION`]\_[`SECTION NUMBER`]\_[`SUBSECTION
119112
NUMBER`]\_Simulated.yaml
120113
- <strong>`IMPORTANT`: The test name must end in Simulated with the
121114
capital.</strong>
115+
122116
3. Available properties can be found in
123117
[YAML Test Name](../../src/app/tests/suites/README.md)
118+
124119
4. An Additional property is as follows:
125120
126121
| Name | Description |
@@ -129,14 +124,26 @@ new code is generated.
129124
130125
5. [Test_TC_DM_1_3_Simulated](../../src/app/tests/suites/certification/Test_TC_DM_1_3_Simulated.yaml)
131126
is an example of a written test that runs on the simulated device.
127+
132128
6. Next, it will need to be added to
133-
[examples/placeholder/linux/apps/app1/tests.js](../../examples/placeholder/linux/apps/app1/tests.js).
134-
in the following array
129+
[examples/placeholder/linux/apps/app1/tests.js](../../examples/placeholder/linux/apps/app1/tests.js)
130+
in the following array:
131+
135132
```javascript
136133
const tests = ["Test_TC_DM_1_3_Simulated"];
137134
```
138-
7. Then, the code will be generated using ZAP. Follow
139-
[Gen Script](#generating-and-building-the-default-simulated-app-with-script)
140-
to do so.
141-
8. When submitting code for review, create 2 commits. One for YAML changes and
135+
136+
7. Then, the code will be generated using ZAP.
137+
138+
```
139+
./scripts/tools/zap/generate.py examples/placeholder/linux/apps/app1/config.zap -t examples/placeholder/templates/templates.json -o zzz_generated/placeholder/app1/zap-generated
140+
```
141+
142+
The following command can be used to generate and compile:
143+
144+
```
145+
./scripts/examples/gn_build_test_example.sh app1
146+
```
147+
148+
8) When submitting code for review, create 2 commits. One for YAML changes and
142149
second for generated code.

scripts/examples/gn_build_test_example.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function runZAP() {
4040
"$CHIP_ROOT"/scripts/tools/zap/generate.py "$ZAP_INPUT_FILE" -o "$ZAP_OUTPUT_DIR"
4141

4242
# Generates the specific files for the given zap configuration
43-
TARGET_APP=$APP_DIR "$CHIP_ROOT"/scripts/tools/zap/generate.py "$ZAP_INPUT_FILE" -t "$INPUT_DIR"/../templates/templates.json -o "$ZAP_OUTPUT_DIR"
43+
TARGET_APP=$APP_DIR "$CHIP_ROOT"/scripts/tools/zap/generate.py "$ZAP_INPUT_FILE" -t "$INPUT_DIR"/apps/"$APP_DIR"/templates/templates.json -o "$ZAP_OUTPUT_DIR"
4444
}
4545

4646
function runGN() {

0 commit comments

Comments
 (0)