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 committed by Angus Gratton
parent cffe7bf3a1
commit 69c0e6243e

View file

@ -310,6 +310,8 @@ def run_unit_test_cases(env, extra_data):
finally:
TinyFW.JunitReport.update_performance(performance_items)
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
if failed_cases:
@ -511,6 +513,10 @@ def run_multiple_devices_cases(env, extra_data):
failed_cases.append(format_case_name(one_case))
Utility.console_log("Failed: " + format_case_name(one_case), color="red")
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:
Utility.console_log("Failed Cases:", color="red")
@ -662,6 +668,8 @@ def run_multiple_stage_cases(env, extra_data):
finally:
TinyFW.JunitReport.update_performance(performance_items)
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
if failed_cases: