From 82218c8d6875947fee29e9b9a0b48b87bb587281 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 24 Jan 2024 00:43:23 +0700 Subject: [PATCH 1/3] retry flashih a few time due to random failed by s3 --- test/hil/hil_test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index 7c662aeea7..544a4eb398 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -364,8 +364,14 @@ def main(config_file, board): print(f' {test} ...', end='') - # flash firmware - ret = globals()[f'flash_{flasher}'](item, fw) + # flash firmware. It may fail randomly, retry a few times + for i in range(3): + ret = globals()[f'flash_{flasher}'](item, fw) + if ret.returncode == 0: + break + else: + time.sleep(1) + assert ret.returncode == 0, 'Flash failed\n' + ret.stdout.decode() # run test From 64f86ef8e744e72e27b529ddb3440420ee4e3cf0 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 24 Jan 2024 11:32:28 +0700 Subject: [PATCH 2/3] build workflow with hil-test when test/hil changes --- .github/workflows/build_esp.yml | 2 ++ .github/workflows/build_iar.yml | 2 ++ .github/workflows/cmake_arm.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index 33caa0edb9..65ade7b033 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -8,6 +8,7 @@ on: - 'examples/**' - 'lib/**' - 'hw/**' + - 'test/hil/**' - '.github/workflows/build_esp.yml' pull_request: branches: [ master ] @@ -16,6 +17,7 @@ on: - 'examples/**' - 'lib/**' - 'hw/**' + - 'test/hil/**' - '.github/workflows/build_esp.yml' concurrency: diff --git a/.github/workflows/build_iar.yml b/.github/workflows/build_iar.yml index 9f2cc03511..a0a022ecc9 100644 --- a/.github/workflows/build_iar.yml +++ b/.github/workflows/build_iar.yml @@ -9,6 +9,7 @@ on: - 'lib/**' - 'hw/**' - 'tools/get_deps.py' + - 'test/hil/**' - '.github/workflows/build_iar.yml' pull_request: branches: [ master ] @@ -18,6 +19,7 @@ on: - 'lib/**' - 'hw/**' - 'tools/get_deps.py' + - 'test/hil/**' - '.github/workflows/build_iar.yml' concurrency: diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index 8b87fef219..4ef2de4a62 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -8,6 +8,7 @@ on: - 'examples/**' - 'lib/**' - 'hw/**' + - 'test/hil/**' - 'tools/get_deps.py' - '.github/workflows/cmake_arm.yml' pull_request: @@ -17,6 +18,7 @@ on: - 'examples/**' - 'lib/**' - 'hw/**' + - 'test/hil/**' - 'tools/get_deps.py' - '.github/workflows/cmake_arm.yml' From 9d0df8ebc5f643ff0b3dd06da14d11b3c1107a21 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 24 Jan 2024 12:10:17 +0700 Subject: [PATCH 3/3] add message when flashing failed --- test/hil/hil_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index 544a4eb398..7f03ce43f1 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -370,6 +370,7 @@ def main(config_file, board): if ret.returncode == 0: break else: + print(f'Flashing failed, retry {i+1}') time.sleep(1) assert ret.returncode == 0, 'Flash failed\n' + ret.stdout.decode()