unit-test-app: fix test script error when handling multiple unit test configs in one config file:

If we have multiple configs, we need to flash DUT with different binaries. But if we don't close DUT before apply new config, the old DUT will be reused, so new config name will not be applied.
This commit is contained in:
He Yin Ling 2019-11-22 11:41:57 +08:00
parent 1c65f1aed3
commit 9665c6ef66

View file

@ -306,6 +306,8 @@ def run_unit_test_cases(env, extra_data):
finally: finally:
TinyFW.JunitReport.update_performance(performance_items) TinyFW.JunitReport.update_performance(performance_items)
TinyFW.JunitReport.test_case_finish(junit_test_case) TinyFW.JunitReport.test_case_finish(junit_test_case)
# close DUT when finish running all cases for one config
env.close_dut(dut.name)
# raise exception if any case fails # raise exception if any case fails
if failed_cases: if failed_cases:
@ -507,6 +509,10 @@ def run_multiple_devices_cases(env, extra_data):
failed_cases.append(one_case["name"]) failed_cases.append(one_case["name"])
Utility.console_log("Failed: " + one_case["name"], color="red") Utility.console_log("Failed: " + one_case["name"], color="red")
TinyFW.JunitReport.test_case_finish(junit_test_case) TinyFW.JunitReport.test_case_finish(junit_test_case)
# close all DUTs when finish running all cases for one config
for dut in duts:
env.close_dut(dut)
duts = {}
if failed_cases: if failed_cases:
Utility.console_log("Failed Cases:", color="red") Utility.console_log("Failed Cases:", color="red")
@ -658,6 +664,8 @@ def run_multiple_stage_cases(env, extra_data):
finally: finally:
TinyFW.JunitReport.update_performance(performance_items) TinyFW.JunitReport.update_performance(performance_items)
TinyFW.JunitReport.test_case_finish(junit_test_case) TinyFW.JunitReport.test_case_finish(junit_test_case)
# close DUT when finish running all cases for one config
env.close_dut(dut.name)
# raise exception if any case fails # raise exception if any case fails
if failed_cases: if failed_cases: