Skip to content

Commit 5cbe293

Browse files
author
Josh V [Apple]
authored
Update readme with additional functionality. (project-chip#15160)
1 parent fba7434 commit 5cbe293

16 files changed

+667
-37
lines changed

.github/.wordlist.txt

+107-2
Large diffs are not rendered by default.

src/app/tests/suites/README.md

+324-35
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
config:
2+
cluster: "ExampleCluster"
3+
endpoint: 1
4+
identity: "beta" # Uses secondary commissioner
5+
exampleVariable: # See Config variables example
6+
type: INT16U
7+
defaultValue: 110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
config:
2+
exampleVariable:
3+
type: INT16U
4+
defaultValue: 110
5+
coolVariables:
6+
type: CHAR_STRING
7+
defaultValue: "I am a super cool variable"
8+
aBigNumber:
9+
type: INT64U
10+
defaultValue: 1.8446744e+19
11+
aBool:
12+
type: BOOLEAN
13+
defaultValue: false
14+
15+
tests:
16+
- label: "Examples Test Step 1"
17+
cluster: "ExampleCluster"
18+
command: "ExamplesCommand"
19+
disabled: false # Disables the test step if true
20+
arguments: # User variable as arguments
21+
values:
22+
- name: "exampleVariable"
23+
value: exampleVariable
24+
25+
- label: "Examples Test Step 2"
26+
cluster: "ExampleCluster2"
27+
command: "ExamplesCommand2"
28+
response: # User variable as response value checks
29+
values:
30+
- name: "aBool"
31+
value: aBool
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
tests:
2+
- label: "Examples Test Step 1"
3+
cluster: "ExampleCluster"
4+
command: "writeAttribute"
5+
PICS: WILL_NOT_RUN
6+
7+
- label: "Examples Test Step 2"
8+
cluster: "ExampleCluster"
9+
command: "readAttribute"
10+
PICS: WILL_RUN
11+
12+
- label: "Examples Test Step 3"
13+
cluster: "ExampleCluster"
14+
command: "ExamplesCommand"
15+
PICS: WILL_NOT_RUN || WILL_RUN # Conditional will run
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tests:
2+
- label: "Examples Test Step 1"
3+
cluster: "ExampleCluster"
4+
command: "ExamplesCommand"
5+
response: # Validates the response variables of the commands
6+
values:
7+
- name: "exampleResponseVariable"
8+
value: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{#chip_tests (getTests)}}
2+
{{#chip_tests_config}}
3+
"Argument Name {{name}}"
4+
"Argument Type {{type}}"
5+
"Argument Type {{defaultValue}}"
6+
7+
{{/chip_tests_config}}
8+
{{/chip_tests}}
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
WILL_NOT_RUN=0
2+
WILL_RUN=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
tests:
2+
- label: "Examples Test Step 1"
3+
cluster: "ExampleCluster"
4+
command: "writeAttribute"
5+
attribute: "exampleAttribute"
6+
arguments:
7+
value: 255
8+
9+
- label: "Examples Test Step 2"
10+
cluster: "ExampleCluster"
11+
command: "readAttribute"
12+
attribute: "exampleAttribute"
13+
response: # Validates the response variables of the commands
14+
value: 255
15+
16+
- label: "Examples Test Step 3"
17+
cluster: "ExampleCluster"
18+
command: "ExamplesCommand"
19+
response: # Validates the response variables of the commands
20+
saveAs: nameOfSaveVariable
21+
value: 0
22+
values:
23+
- name: "exampleResponseVariable"
24+
value: 1
25+
timedInteractionTimeoutMs: 10000
26+
PICS: RUN_ONLY_IF_ENABLED
27+
arguments:
28+
values:
29+
- name: "arg1"
30+
value: 0
31+
- name: "arg2"
32+
value: { Key1: 1, Key2: 2 }
33+
- name: "stringExamples"
34+
value: "Hello World"
35+
- name: "fromSaveAs"
36+
value: nameOfSaveVariable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
config:
2+
cluster: "Basic"
3+
endpoint: 0
4+
testOneVariable:
5+
type: INT16U
6+
defaultValue: 1
7+
tests:
8+
- label: "Examples Test Step 1"
9+
cluster: "LogCommands"
10+
command: "Log"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
config:
2+
cluster: "Basic"
3+
endpoint: 0
4+
testTwoVariable:
5+
type: INT16U
6+
defaultValue: 2
7+
tests:
8+
- label: "Examples Test Step 1"
9+
cluster: "LogCommands"
10+
command: "Log"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
config:
2+
cluster: "Basic"
3+
endpoint: 0
4+
testThreeVariable:
5+
type: INT16U
6+
defaultValue: 3
7+
tests:
8+
- label: "Examples Test Step 1"
9+
cluster: "LogCommands"
10+
command: "Log"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (c) 2022 Project CHIP Authors
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
CHIP_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"/../../../../..
20+
echo "$CHIP_ROOT"
21+
INPUT_ZAP="$CHIP_ROOT/src/controller/data_model/controller-clusters.zap"
22+
INPUT_TEMPLATE="$CHIP_ROOT/src/app/tests/suites/examples/templates/templates.json"
23+
OUTPUT_DIR="$CHIP_ROOT/src/app/tests/suites/examples/out"
24+
25+
source "$CHIP_ROOT/scripts/activate.sh"
26+
27+
mkdir -p "$OUTPUT_DIR"
28+
29+
"$CHIP_ROOT"/scripts/tools/zap/generate.py "$INPUT_ZAP" -t "$INPUT_TEMPLATE" -o "$OUTPUT_DIR"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "CHIP README Templates",
3+
"version": "chip-v1",
4+
"helpers": [
5+
"../../../../zap-templates/common/ClusterTestGeneration.js",
6+
"tests.js"
7+
],
8+
9+
"templates": [
10+
{
11+
"path": "../TestGenExample.zapt",
12+
"name": "Test Generate Example",
13+
"output": "TestGenExample.out"
14+
}
15+
]
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
*
3+
* Copyright (c) 2022 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
function getManualTests()
19+
{
20+
const ExampleManualCataCategory = [
21+
'examples/Test_Example',
22+
];
23+
24+
const tests = [
25+
ExampleManualCataCategory, //
26+
27+
];
28+
return tests.flat(1);
29+
}
30+
31+
function getTests()
32+
{
33+
const TestExample = [
34+
'examples/Test_Example_1',
35+
'examples/Test_Example_2',
36+
'examples/Test_Example_3',
37+
];
38+
39+
const tests = [
40+
TestExample, //
41+
];
42+
return tests.flat(1);
43+
}
44+
45+
//
46+
// Module exports
47+
//
48+
exports.getTests = getTests;
49+
exports.getManualTests = getManualTests;

src/controller/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ The Android chip-tool is located in [../android/CHIPTool](../android/CHIPTool).
1818
The POSIX CLI chip-tool is located in
1919
[../../examples/chip-tool](../../examples/chip-tool).
2020

21+
### Darwin CLI
22+
23+
The POSIX CLI chip-tool is located in
24+
[../../examples/chip-tool-darwin](../../examples/chip-tool).
25+
2126
### Python
2227

2328
The Python chip-device-ctrl is located in

0 commit comments

Comments
 (0)