From 304e7119ceb9a505fca98d975e982d1cb287528f Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Mon, 17 Jun 2019 09:48:04 +0800 Subject: [PATCH] ci: fix random unit test CI failure: we use `-` command to check if DUT reset pass. If we input `-` command during DUT bootup, DUT could only receive `\n` and print test cases. Print test cases could take long time and lead to reset check timeout. Now we will add delay after reset, and enlarge reset check timeout to solve this problem. --- tools/unit-test-app/unit_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/unit-test-app/unit_test.py b/tools/unit-test-app/unit_test.py index 330b32ff3..2f80db6f5 100755 --- a/tools/unit-test-app/unit_test.py +++ b/tools/unit-test-app/unit_test.py @@ -63,8 +63,9 @@ MULTI_DEVICE_ID = 2 DEFAULT_TIMEOUT = 20 +DUT_DELAY_AFTER_RESET = 2 DUT_STARTUP_CHECK_RETRY_COUNT = 5 -TEST_HISTORY_CHECK_TIMEOUT = 1 +TEST_HISTORY_CHECK_TIMEOUT = 2 class TestCaseFailed(AssertionError): @@ -164,6 +165,11 @@ def reset_dut(dut): # now use input cmd `-` and check test history to check if DUT is bootup. # we'll retry this step for a few times, # in case `dut.reset` returns during DUT bootup (when DUT can't process any command). + # + # during bootup, DUT might only receive part of the first `-` command. + # If it only receive `\n`, then it will print all cases. It could take more than 5 seconds, reset check will fail. + # To solve this problem, we will add a delay between reset and input `-` command. And we'll also enlarge expect timeout. + time.sleep(DUT_DELAY_AFTER_RESET) for _ in range(DUT_STARTUP_CHECK_RETRY_COUNT): dut.write("-") try: