Skip to content

Commit 3915a76

Browse files
committed
actually set exit value
Also, apparently the formatting rules changed. OK...
1 parent 30d3224 commit 3915a76

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/python_testing/test_testing/test_TC_DA_1_2.py

+20-10
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
import json
2020
import os
2121
import subprocess
22+
import sys
2223

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__), '../../..'))
2426
RUNNER_SCRIPT_DIR = os.path.join(CHIP_ROOT, 'scripts/tests')
2527

2628

@@ -30,13 +32,15 @@ def run_single_test(dac_provider: str, product_id: int, factory_reset: bool = Fa
3032
if factory_reset:
3133
reset = ' --factoryreset'
3234

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')
3437

3538
# Certs in the commissioner_dut directory use 0x8000 as the PID
3639
app_args = '--discriminator 1234 --KVS kvs1 --product-id ' + \
3740
str(product_id) + ' --vendor-id 65521 --dac_provider ' + dac_provider
3841

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'))
4044
script_args = '--storage-path admin_storage.json --discriminator 1234 --passcode 20202021 --dut-node-id 1 --PICS ' + \
4145
str(ci_pics_values)
4246

@@ -45,28 +49,34 @@ def run_single_test(dac_provider: str, product_id: int, factory_reset: bool = Fa
4549
if factory_reset:
4650
script_args = script_args + ' --commissioning-method on-network'
4751

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'))
4954

5055
# 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'))
5258
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 + '"'
5461

5562
return subprocess.call(cmd, shell=True)
5663

5764

5865
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'))
6068

6169
# 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"))
6372
run_single_test(path, 32768, factory_reset=True)
6473

6574
test_cases = {'struct_cd': 32768, 'fallback_encoding': 177}
6675

6776
# struct_cd_version_number_wrong - excluded because this is a DCL test not covered by cert
6877
# 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']
7080

7181
passes = []
7282
for p in os.listdir(cert_path):
@@ -92,7 +102,7 @@ def main():
92102
print('INCORRECT: ' + p[0])
93103
retval = 1
94104

95-
return retval
105+
sys.exit(retval)
96106

97107

98108
if __name__ == '__main__':

0 commit comments

Comments
 (0)