From 6eea36a14491c195388b943f04e7d88a32649c97 Mon Sep 17 00:00:00 2001 From: Patrick Robb Date: Tue, 7 Oct 2025 14:42:23 -0400 Subject: [PATCH 1/2] tests: remove error failure condition Previously, some tests within the flash validation testsuite were set to fail when the error prefix was detected. This is now removed per instruction from the Ocre community developers. Now, the flash validation testsuite includes only one testcase which just checks for the expected hello world string and fails if it is not detected. Signed-off-by: Patrick Robb --- tests/groups/flashValidation/config.json | 10 +----- .../flashValidation/flash_validation_error.py | 35 ------------------ .../flash_validation_hello_world_error.py | 36 ------------------- 3 files changed, 1 insertion(+), 80 deletions(-) delete mode 100755 tests/groups/flashValidation/flash_validation_error.py delete mode 100755 tests/groups/flashValidation/flash_validation_hello_world_error.py diff --git a/tests/groups/flashValidation/config.json b/tests/groups/flashValidation/config.json index 4575b24b..3c50c0f5 100644 --- a/tests/groups/flashValidation/config.json +++ b/tests/groups/flashValidation/config.json @@ -15,14 +15,6 @@ { "name": "Check Runtime Hello World", "exec": "./flash_validation_hello_world.py" - }, - { - "name": "Check Runetime Error", - "exec": "./flash_validation_error.py" - }, - { - "name": "Check Runtime Hello World With Error", - "exec": "./flash_validation_hello_world_error.py" } ] } @@ -33,4 +25,4 @@ "exec": "bash clean.sh" } ] - } \ No newline at end of file + } diff --git a/tests/groups/flashValidation/flash_validation_error.py b/tests/groups/flashValidation/flash_validation_error.py deleted file mode 100755 index 131da325..00000000 --- a/tests/groups/flashValidation/flash_validation_error.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 - -import serial -import time -import sys - -""" -This testcase is to be used following the flashing of the Ocre runtime to a board. - -The testcase forms a serial connection to the board, sends a break and checks that -there are no instance of the error prefix "E: " in the output returned from the break. -""" - -def main(): - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=1) - conn.send_break(duration=1) - - time.sleep(1) - - print('**** READING RESPONSE FROM BREAK ****\n') - - response = conn.read(1024).decode(errors='ignore') - print(response) - - print('**** CLOSING CONNECTION ****\n') - - conn.close() - - if "E:" not in response: - sys.exit(0) - sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/tests/groups/flashValidation/flash_validation_hello_world_error.py b/tests/groups/flashValidation/flash_validation_hello_world_error.py deleted file mode 100755 index ad94f596..00000000 --- a/tests/groups/flashValidation/flash_validation_hello_world_error.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 - -import serial -import time -import sys - -""" -This testcase is to be used following the flashing of the Ocre runtime to a board. - -The testcase forms a serial connection to the board, sends a break and checks that -the string Hello World! appears in the output of that break command, and without any -instances of the error prefix "E: ". -""" - -def main(): - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=1) - conn.send_break(duration=1) - - time.sleep(1) - - print('**** READING RESPONSE FROM BREAK ****\n') - - response = conn.read(1024).decode(errors='ignore') - print(response) - - print('**** CLOSING CONNECTION ****\n') - - conn.close() - - if "Hello World!" in response and "E:" not in response: - sys.exit(0) - sys.exit(1) - - -if __name__ == "__main__": - main() From e8ba268a478004357eb4d78a4b4d6243101c5619 Mon Sep 17 00:00:00 2001 From: Patrick Robb Date: Fri, 10 Oct 2025 11:16:49 -0400 Subject: [PATCH 2/2] tests: Move test group execution to build workflow Previously, the test groups were invoked within a dedicated tests workflow, triggered by a workflow_run event. This did not work well because workflows triggered by workflow_run are forced to run from the main branch as a security measure. So, changes to the test workflow coming in from a pull request were not used in the CI testing. This commit also includes an increased sleep on the flash validation test, allowing it to properly initialize the hello world container and fill the output buffer with the expected string. Signed-off-by: Patrick Robb --- .github/workflows/build.yml | 26 ++++++++++++++-- .github/workflows/tests.yml | 31 ------------------- .../flash_validation_hello_world.py | 21 ++++++++++--- 3 files changed, 40 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22991f5f..8358e447 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,11 +136,11 @@ jobs: uses: actions/download-artifact@v4 with: name: ocre-zephyr-b_u585i_iot02a-app - + - name: Flash b_u585i_iot02a if: runner.environment == 'self-hosted' run: | - STM32_Programmer_CLI -c port=swd -w zephyr.bin 0x08000000 -v -rst + STM32_Programmer_CLI -c port=swd -e all -w zephyr.bin 0x08000000 -v -rst build-and-run-linux-sample: runs-on: ubuntu-latest @@ -316,3 +316,25 @@ jobs: echo "[FAIL] ${{ matrix.sample.name }} did not produce expected log: ${{ matrix.sample.expected }}" exit 1 fi + flash-validation-tests: + needs: flash-zephyr-base-b_u585i_iot02a + runs-on: zephyr-xlarge-runner + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Flash Validation Tests + run: | + cd tests && bash beginTests.sh "flashValidation" + + - name: Print Flash Validation Logs + if: always() + run: cat /tmp/flashValidation.log + + - name: Upload log file as artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: "FlashValidation.log" + path: /tmp/flashValidation.log + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index e2a4fec3..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Tests -on: - workflow_run: - workflows: ["Build"] - types: - - completed -jobs: - tests: - runs-on: zephyr-xlarge-runner - - steps: - - name: Make the github actions runner recursively take ownership of the github workspace - run: sudo chown -R $(whoami) ${{ github.workspace }} - - - name: Checkout - uses: actions/checkout@v4 - - - name: Flash Validation Tests - run: | - cd tests && bash beginTests.sh "flashValidation" - - - name: Print Flash Validation Logs - if: always() - run: cat /tmp/flashValidation.log - - - name: Upload log file as artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: "FlashValidation.log" - path: /tmp/flashValidation.log diff --git a/tests/groups/flashValidation/flash_validation_hello_world.py b/tests/groups/flashValidation/flash_validation_hello_world.py index bf951c2f..251403ab 100755 --- a/tests/groups/flashValidation/flash_validation_hello_world.py +++ b/tests/groups/flashValidation/flash_validation_hello_world.py @@ -12,21 +12,32 @@ """ def main(): - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=1) - conn.send_break(duration=1) + conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) + + print('**** WAITING FOR SYSTEM TO FULLY INITIALIZE ****\n') + + # Wait for the system to boot and initialize completely + # We need to wait for network initialization and OCRE runtime startup + time.sleep(5) - time.sleep(1) + # Clear any existing data in the buffer + conn.reset_input_buffer() + + # Send break to get current output + conn.send_break(duration=1) + time.sleep(10) print('**** READING RESPONSE FROM BREAK ****\n') - response = conn.read(1024).decode(errors='ignore') + # Read response with longer timeout to capture all output + response = conn.read(2048).decode(errors='ignore') print(response) print('**** CLOSING CONNECTION ****\n') conn.close() - if "Hello World!" in response: + if "Hello World from Ocre!" in response: sys.exit(0) sys.exit(1)