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/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.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) 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()