19
19
import json
20
20
import os
21
21
import subprocess
22
+ import sys
22
23
23
- CHIP_ROOT = os .path .abspath (os .path .join (os .path .dirname (__file__ ), '../../..' ))
24
+ CHIP_ROOT = os .path .abspath (os .path .join (
25
+ os .path .dirname (__file__ ), '../../..' ))
24
26
RUNNER_SCRIPT_DIR = os .path .join (CHIP_ROOT , 'scripts/tests' )
25
27
26
28
@@ -30,13 +32,15 @@ def run_single_test(dac_provider: str, product_id: int, factory_reset: bool = Fa
30
32
if factory_reset :
31
33
reset = ' --factoryreset'
32
34
33
- app = os .path .join (CHIP_ROOT , 'out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app' )
35
+ app = os .path .join (
36
+ CHIP_ROOT , 'out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app' )
34
37
35
38
# Certs in the commissioner_dut directory use 0x8000 as the PID
36
39
app_args = '--discriminator 1234 --KVS kvs1 --product-id ' + \
37
40
str (product_id ) + ' --vendor-id 65521 --dac_provider ' + dac_provider
38
41
39
- ci_pics_values = os .path .abspath (os .path .join (CHIP_ROOT , 'src/app/tests/suites/certification/ci-pics-values' ))
42
+ ci_pics_values = os .path .abspath (os .path .join (
43
+ CHIP_ROOT , 'src/app/tests/suites/certification/ci-pics-values' ))
40
44
script_args = '--storage-path admin_storage.json --discriminator 1234 --passcode 20202021 --dut-node-id 1 --PICS ' + \
41
45
str (ci_pics_values )
42
46
@@ -45,28 +49,34 @@ def run_single_test(dac_provider: str, product_id: int, factory_reset: bool = Fa
45
49
if factory_reset :
46
50
script_args = script_args + ' --commissioning-method on-network'
47
51
48
- script = os .path .abspath (os .path .join (CHIP_ROOT , 'src/python_testing/TC_DA_1_2.py' ))
52
+ script = os .path .abspath (os .path .join (
53
+ CHIP_ROOT , 'src/python_testing/TC_DA_1_2.py' ))
49
54
50
55
# run_python_test uses click so call as a command
51
- run_python_test = os .path .abspath (os .path .join (RUNNER_SCRIPT_DIR , 'run_python_test.py' ))
56
+ run_python_test = os .path .abspath (os .path .join (
57
+ RUNNER_SCRIPT_DIR , 'run_python_test.py' ))
52
58
cmd = str (run_python_test ) + reset + ' --app ' + str (app ) + ' --app-args "' + \
53
- app_args + '" --script ' + str (script ) + ' --script-args "' + script_args + '"'
59
+ app_args + '" --script ' + \
60
+ str (script ) + ' --script-args "' + script_args + '"'
54
61
55
62
return subprocess .call (cmd , shell = True )
56
63
57
64
58
65
def main ():
59
- cert_path = os .path .abspath (os .path .join (CHIP_ROOT , 'credentials/development/commissioner_dut' ))
66
+ cert_path = os .path .abspath (os .path .join (
67
+ CHIP_ROOT , 'credentials/development/commissioner_dut' ))
60
68
61
69
# Commission first using a known good set, then run the rest of the tests without recommissioning
62
- path = str (os .path .join (cert_path , "struct_cd_authorized_paa_list_count1_valid/test_case_vector.json" ))
70
+ path = str (os .path .join (
71
+ cert_path , "struct_cd_authorized_paa_list_count1_valid/test_case_vector.json" ))
63
72
run_single_test (path , 32768 , factory_reset = True )
64
73
65
74
test_cases = {'struct_cd' : 32768 , 'fallback_encoding' : 177 }
66
75
67
76
# struct_cd_version_number_wrong - excluded because this is a DCL test not covered by cert
68
77
# struct_cd_cert_id_mismatch - excluded because this is a DCL test not covered by cert
69
- exclude_cases = ['struct_cd_version_number_wrong' , 'struct_cd_cert_id_mismatch' ]
78
+ exclude_cases = ['struct_cd_version_number_wrong' ,
79
+ 'struct_cd_cert_id_mismatch' ]
70
80
71
81
passes = []
72
82
for p in os .listdir (cert_path ):
@@ -92,7 +102,7 @@ def main():
92
102
print ('INCORRECT: ' + p [0 ])
93
103
retval = 1
94
104
95
- return retval
105
+ sys . exit ( retval )
96
106
97
107
98
108
if __name__ == '__main__' :
0 commit comments