From 4bbb9a220994e8b999cdc72eaff11096badb7c7c Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Thu, 5 Feb 2026 17:19:53 -0500 Subject: [PATCH 01/13] Add initial test and GHA file for bu585 Includes a new basic test group and initial github actions file to establish framework for testing ocre runtime with physical hardware after the major refactor. The test plan tests to confirm the hello-world container works and establishes initial process for testing containers on the b_u585 board. Utilizes similar methods in the GHA workflow as before the major refactor to build the .wasm and build and flash the runtime. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 167 ++++++++++++++++++ .github/workflows/main.yml | 6 + .../groups/supervisor-helloWorld/clean.py | 22 +++ .../groups/supervisor-helloWorld/config.json | 28 +++ .../groups/supervisor-helloWorld/setup.py | 27 +++ .../groups/supervisor-helloWorld/testcase.py | 27 +++ 6 files changed, 277 insertions(+) create mode 100644 .github/workflows/hardware-bu585.yml create mode 100755 tests_hw/groups/supervisor-helloWorld/clean.py create mode 100644 tests_hw/groups/supervisor-helloWorld/config.json create mode 100755 tests_hw/groups/supervisor-helloWorld/setup.py create mode 100755 tests_hw/groups/supervisor-helloWorld/testcase.py diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml new file mode 100644 index 00000000..3e8b7ab2 --- /dev/null +++ b/.github/workflows/hardware-bu585.yml @@ -0,0 +1,167 @@ +# @copyright Copyright (c) contributors to Project Ocre, +# which has been established as Project Ocre a Series of LF Projects, LLC +# +# SPDX-License-Identifier: Apache-2.0 + + +name: Hardware Checks (b_u585) + +concurrency: + group: pr-workflows + cancel-in-progress: false + +on: + workflow_call: + + +jobs: + setup-local-runner: + runs-on: zephyr-xlarge-runner + steps: + - name: Remove old workflow files + run: rm -rf /var/ocre-ci-files/* + + - name: Create wasm directory + run: mkdir /var/ocre-ci-files/wasm + + build-wasm-files: + needs: setup-local-runner + runs-on: zephyr-xlarge-runner + container: + image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch + options: --user root -v /var/ocre-ci-files/:/var/ocre-ci-files/ + strategy: + matrix: + sample: + - name: generic-hello-world + path: generic/hello-world + filename: hello-world.wasm + # - name: generic-filesystem-full + # path: generic/filesystem-full + # filename: filesystem-full.wasm + # - name: b_u585i-modbus-server + # path: board_specific/b_u585i_iot02a/modbus-server + # filename: modbus-server.wasm + # - name: generic-blinky + # path: generic/blinky + # filename: blinky.wasm + steps: + - name: Cleanup workspace + uses: eviden-actions/clean-self-hosted-runner@v1 + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + path: ocre-runtime + fetch-depth: 0 + + - name: Install tools (xxd + WASI SDK) + run: | + sudo apt-get update + sudo apt-get install -y wget build-essential + wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz + tar -xvf vim.tar.gz + cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz + tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz + sudo mv wasi-sdk-25.0-x86_64-linux /opt/wasi-sdk + env: + WASI_SDK_PATH: /opt/wasi-sdk + + - name: Build WASM sample + run: | + SAMPLE_DIR=$GITHUB_WORKSPACE/ocre-runtime/ocre-sdk/${{ matrix.sample.path }} + if [ ! -d "$SAMPLE_DIR" ]; then + echo "Directory not found: $SAMPLE_DIR" + exit 1 + fi + + mkdir -p "$SAMPLE_DIR/build" + cd "$SAMPLE_DIR/build" + cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake + make + + env: + WASI_SDK_PATH: /opt/wasi-sdk + + # Saving files to the runner so avoid uploading .wasm files as artifacts individually, uploaded in separate step + - name: Save .wasm artifact locally + if: always() + run: | + mkdir /var/ocre-ci-files/wasm/${{ matrix.sample.name }}/ + cp "ocre-runtime/ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}" + + artifact-wasm-files: + needs: build-wasm-files + runs-on: zephyr-xlarge-runner + steps: + - name: Artifact local wasm files + if: always() + uses: actions/upload-artifact@v4 + with: + name: wasm-build-artifacts + path: "/var/ocre-ci-files/wasm" + + + build-flash-supervisor: + needs: artifact-wasm-files + runs-on: zephyr-xlarge-runner + + steps: + - name: Cleanup workspace + uses: eviden-actions/clean-self-hosted-runner@v1 + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Make python venv + run: | + python3 -m venv ./.venv + source .venv/bin/activate + pip install littlefs-python + pip install west + + - name: Setup west environment + run: | + source .venv/bin/activate + west update + west zephyr-export + west packages pip --install + west sdk install -t \ + x86_64-zephyr-elf \ + aarch64-zephyr-elf \ + arm-zephyr-eabi + + - name: Download wasm artifact + uses: actions/download-artifact@v4 + with: + name: wasm-build-artifacts + path: wasm-build-artifacts + + - name: Build and Flash Supervisor + run: | + ls -lah + pwd + source .venv/bin/activate + west build -p always -b b_u585i_iot02a src/samples/supervisor/zephyr -- "-DOCRE_SDK_PRELOADED_IMAGES=hello-world.wasm" + west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex + + supervisor-hello-world-test: + needs: build-flash-supervisor + runs-on: zephyr-xlarge-runner + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Supervisor Hello-World Testcase + run: | + cd tests_hw && bash beginTests.sh "supervisor-helloWorld" + + - name: Print Modbus Server Validation Logs + if: always() + run: cat /tmp/supervisor-helloWorld.log \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5cc6eb54..24c5117b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,3 +63,9 @@ jobs: secrets: inherit with: devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} + + hardware-bu585: + name: Hardware b_u585i_iot02a + uses: ./.github/workflows/hardware-bu585.yml + secrets: inherit + \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/clean.py b/tests_hw/groups/supervisor-helloWorld/clean.py new file mode 100755 index 00000000..3b3ddd6a --- /dev/null +++ b/tests_hw/groups/supervisor-helloWorld/clean.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +import time +import serial + + +def main(): + conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) + conn.reset_input_buffer() + conn.send_break(duration=1) + time.sleep(5) + print("Cleaning up container hello-world") + conn.write(b'ocre rm hello-world\n') + response = conn.read(2048).decode(errors='ignore') + print("Runtime Output:") + print(response) + conn.close() + + + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/config.json b/tests_hw/groups/supervisor-helloWorld/config.json new file mode 100644 index 00000000..984a94ea --- /dev/null +++ b/tests_hw/groups/supervisor-helloWorld/config.json @@ -0,0 +1,28 @@ +{ + "name": "Supervisor Sample - Hello World", + "description": "Test Hello World Container within ", + "setup": [ + { + "name": "Start Hello-World Container", + "exec": "./setup.py" + } + ], + "test_suites": [ + { + "name": "Test Container Output", + "description": "Reads output from container to make sure it successfully ran", + "test_cases": [ + { + "name": "Check Runtime Hello World", + "exec": "./testcase.py" + } + ] + } + ], + "cleanup": [ + { + "name": "Remove Hello-World Container", + "exec": "./clean.py" + } + ] + } diff --git a/tests_hw/groups/supervisor-helloWorld/setup.py b/tests_hw/groups/supervisor-helloWorld/setup.py new file mode 100755 index 00000000..1db9a386 --- /dev/null +++ b/tests_hw/groups/supervisor-helloWorld/setup.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import serial +import time +import sys + +def main(): + + conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) + time.sleep(5) + conn.reset_input_buffer() + + print("Creating container on board off of hello-world.wasm") + conn.write(b'ocre create -n hello-world -k ocre:api hello-world.wasm\n') + response = conn.read(2048).decode(errors='ignore') + print(response) + + conn.close() + + if "Failed to create container" in response: + sys.exit(1) + + + + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py new file mode 100755 index 00000000..62463759 --- /dev/null +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import time +import serial +import sys + + +def main(): + + conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) + conn.reset_input_buffer() + time.sleep(5) + print("Running hello-world container:") + conn.write(b'ocre start hello-world\n') + response = conn.read(2048).decode(errors='ignore') + + print("Container Output:") + print(response) + conn.close() + + if "powered by Ocre" in response: + sys.exit(0) + sys.exit(1) + + + +if __name__ == "__main__": + main() \ No newline at end of file From b371f3c56ce523c76075fd203a4b2f949dd1dc83 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Fri, 6 Feb 2026 17:18:42 -0500 Subject: [PATCH 02/13] tests: Address initial pull request comments Code style, naming conventions, and formatting fixes. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 2 +- .github/workflows/main.yml | 3 +-- tests_hw/groups/supervisor-helloWorld/config.json | 2 +- tests_hw/groups/supervisor-helloWorld/setup.py | 5 +---- tests_hw/groups/supervisor-helloWorld/testcase.py | 1 - 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 3e8b7ab2..ac6e27ab 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -162,6 +162,6 @@ jobs: run: | cd tests_hw && bash beginTests.sh "supervisor-helloWorld" - - name: Print Modbus Server Validation Logs + - name: Print Hello-World Test Case Logs if: always() run: cat /tmp/supervisor-helloWorld.log \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24c5117b..d3f8d636 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,8 +64,7 @@ jobs: with: devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} - hardware-bu585: + hardware-b_u585i_iot02a: name: Hardware b_u585i_iot02a uses: ./.github/workflows/hardware-bu585.yml secrets: inherit - \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/config.json b/tests_hw/groups/supervisor-helloWorld/config.json index 984a94ea..6b15bc97 100644 --- a/tests_hw/groups/supervisor-helloWorld/config.json +++ b/tests_hw/groups/supervisor-helloWorld/config.json @@ -1,6 +1,6 @@ { "name": "Supervisor Sample - Hello World", - "description": "Test Hello World Container within ", + "description": "Test hello world container on within the supervisor sample", "setup": [ { "name": "Start Hello-World Container", diff --git a/tests_hw/groups/supervisor-helloWorld/setup.py b/tests_hw/groups/supervisor-helloWorld/setup.py index 1db9a386..f3e5bb96 100755 --- a/tests_hw/groups/supervisor-helloWorld/setup.py +++ b/tests_hw/groups/supervisor-helloWorld/setup.py @@ -19,9 +19,6 @@ def main(): if "Failed to create container" in response: sys.exit(1) - - - - + if __name__ == "__main__": main() \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py index 62463759..6c7eb492 100755 --- a/tests_hw/groups/supervisor-helloWorld/testcase.py +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -22,6 +22,5 @@ def main(): sys.exit(1) - if __name__ == "__main__": main() \ No newline at end of file From 8b562c7915253f0c829eeb372f08bc0c427b735a Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Tue, 10 Feb 2026 16:13:25 -0500 Subject: [PATCH 03/13] tests: Initial GHA container integration Comments out unnecessary python and west dependency setup in favor of using the existing Ocre container. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 71 +++++++++++++++------------- .github/workflows/main.yml | 4 ++ 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index ac6e27ab..7e5f2aac 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -12,6 +12,12 @@ concurrency: on: workflow_call: + inputs: + devcontainer-tag: + description: The container tag to be used + default: latest + required: false + type: string jobs: @@ -28,14 +34,17 @@ jobs: needs: setup-local-runner runs-on: zephyr-xlarge-runner container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch - options: --user root -v /var/ocre-ci-files/:/var/ocre-ci-files/ + image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} + volumes: + - /var/ocre-ci-files/:/var/ocre-ci-files/ + options: --user root strategy: matrix: sample: - name: generic-hello-world path: generic/hello-world filename: hello-world.wasm + # Examples for future images to add # - name: generic-filesystem-full # path: generic/filesystem-full # filename: filesystem-full.wasm @@ -47,27 +56,16 @@ jobs: # filename: blinky.wasm steps: - name: Cleanup workspace - uses: eviden-actions/clean-self-hosted-runner@v1 + run: | + rm -rf ocre-runtime || true + rm -rf ../.west || true + continue-on-error: true - - name: Checkout + - name: Checkout uses: actions/checkout@v4 with: - submodules: recursive path: ocre-runtime - fetch-depth: 0 - - - name: Install tools (xxd + WASI SDK) - run: | - sudo apt-get update - sudo apt-get install -y wget build-essential - wget https://github.com/vim/vim/archive/refs/tags/v9.1.1000.tar.gz -O vim.tar.gz - tar -xvf vim.tar.gz - cd vim-9.1.1000/src && make -j$(nproc) && sudo cp xxd/xxd /usr/local/bin/xxd - wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz - tar -xvf wasi-sdk-25.0-x86_64-linux.tar.gz - sudo mv wasi-sdk-25.0-x86_64-linux /opt/wasi-sdk - env: - WASI_SDK_PATH: /opt/wasi-sdk + submodules: recursive - name: Build WASM sample run: | @@ -89,6 +87,9 @@ jobs: - name: Save .wasm artifact locally if: always() run: | + pwd + ls /var/ + ls /var/ocre-ci-files/ mkdir /var/ocre-ci-files/wasm/${{ matrix.sample.name }}/ cp "ocre-runtime/ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}" @@ -107,27 +108,33 @@ jobs: build-flash-supervisor: needs: artifact-wasm-files runs-on: zephyr-xlarge-runner + container: + image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} + volumes: + - /var/ocre-ci-files/:/var/ocre-ci-files/ + - /usr/local/STMicroelectronics/:/usr/local/STMicroelectronics/ + - /github/home/STMicroelectronics/:/github/home/STMicroelectronics/ + - /dev/bus/usb:/dev/bus/usb + options: --user root --device=/dev/ttyACM0 steps: - - name: Cleanup workspace - uses: eviden-actions/clean-self-hosted-runner@v1 - + - name: Clean workspace + run: | + rm -rf ocre-runtime || true + rm -rf ../.west || true + continue-on-error: true + - name: Checkout uses: actions/checkout@v4 with: + path: ocre-runtime submodules: recursive - fetch-depth: 0 - - name: Make python venv - run: | - python3 -m venv ./.venv - source .venv/bin/activate - pip install littlefs-python - pip install west - name: Setup west environment run: | - source .venv/bin/activate + . /opt/zephyr-venv/bin/activate + west init -l . west update west zephyr-export west packages pip --install @@ -144,9 +151,7 @@ jobs: - name: Build and Flash Supervisor run: | - ls -lah - pwd - source .venv/bin/activate + . /opt/zephyr-venv/bin/activate west build -p always -b b_u585i_iot02a src/samples/supervisor/zephyr -- "-DOCRE_SDK_PRELOADED_IMAGES=hello-world.wasm" west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d3f8d636..a2c51b50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,5 +66,9 @@ jobs: hardware-b_u585i_iot02a: name: Hardware b_u585i_iot02a + needs: + - zephyr-devcontainer uses: ./.github/workflows/hardware-bu585.yml secrets: inherit + with: + devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} From b4927767aeedfff1ac69990763bf13c249b164b5 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Fri, 13 Feb 2026 14:37:49 -0500 Subject: [PATCH 04/13] Add tests for demo and mini samples Includes two basic additional test groups, one for mini and demo to fit in with the current framework. These tests run in a matrix before any supervisor test runs. Currently the demo test group could be expanded upon in the future but it is not necessary at the moment. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 178 ++++++++++++++++-- tests_hw/groups/demo/clean.sh | 1 + tests_hw/groups/demo/config.json | 28 +++ tests_hw/groups/demo/setup.sh | 1 + tests_hw/groups/demo/testcase.py | 43 +++++ tests_hw/groups/mini/clean.sh | 1 + tests_hw/groups/mini/config.json | 28 +++ tests_hw/groups/mini/setup.sh | 1 + tests_hw/groups/mini/testcase.py | 32 ++++ .../groups/supervisor-helloWorld/testcase.py | 6 + 10 files changed, 307 insertions(+), 12 deletions(-) create mode 100644 tests_hw/groups/demo/clean.sh create mode 100644 tests_hw/groups/demo/config.json create mode 100644 tests_hw/groups/demo/setup.sh create mode 100755 tests_hw/groups/demo/testcase.py create mode 100644 tests_hw/groups/mini/clean.sh create mode 100644 tests_hw/groups/mini/config.json create mode 100644 tests_hw/groups/mini/setup.sh create mode 100755 tests_hw/groups/mini/testcase.py diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 7e5f2aac..cac1d2aa 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -21,7 +21,8 @@ on: jobs: - setup-local-runner: + setup-local-runner: + name: Setup local runner runs-on: zephyr-xlarge-runner steps: - name: Remove old workflow files @@ -31,6 +32,7 @@ jobs: run: mkdir /var/ocre-ci-files/wasm build-wasm-files: + name: Build .wasm Files needs: setup-local-runner runs-on: zephyr-xlarge-runner container: @@ -44,6 +46,16 @@ jobs: - name: generic-hello-world path: generic/hello-world filename: hello-world.wasm + - name: generic-subscriber + path: generic/messaging/subscriber + filename: subscriber.wasm + - name: generic-publisher + path: generic/messaging/publisher + filename: publisher.wasm + - name: generic-blinky + path: generic/blinky + filename: blinky.wasm + # Examples for future images to add # - name: generic-filesystem-full # path: generic/filesystem-full @@ -51,9 +63,7 @@ jobs: # - name: b_u585i-modbus-server # path: board_specific/b_u585i_iot02a/modbus-server # filename: modbus-server.wasm - # - name: generic-blinky - # path: generic/blinky - # filename: blinky.wasm + steps: - name: Cleanup workspace run: | @@ -94,6 +104,7 @@ jobs: cp "ocre-runtime/ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}" artifact-wasm-files: + name: Artifact built .wasm Files needs: build-wasm-files runs-on: zephyr-xlarge-runner steps: @@ -104,8 +115,8 @@ jobs: name: wasm-build-artifacts path: "/var/ocre-ci-files/wasm" - - build-flash-supervisor: + mini-flash: + name: Mini sample build and flash needs: artifact-wasm-files runs-on: zephyr-xlarge-runner container: @@ -115,7 +126,143 @@ jobs: - /usr/local/STMicroelectronics/:/usr/local/STMicroelectronics/ - /github/home/STMicroelectronics/:/github/home/STMicroelectronics/ - /dev/bus/usb:/dev/bus/usb - options: --user root --device=/dev/ttyACM0 + options: --user root --privileged --device=/dev/ttyACM0 + + steps: + - name: Clean workspace + run: | + rm -rf ocre-runtime || true + rm -rf ../.west || true + continue-on-error: true + + - name: Checkout + uses: actions/checkout@v4 + with: + path: ocre-runtime + submodules: recursive + + - name: Setup west environment + run: | + . /opt/zephyr-venv/bin/activate + west init -l . + west update + west zephyr-export + west packages pip --install + west sdk install -t \ + x86_64-zephyr-elf \ + aarch64-zephyr-elf \ + arm-zephyr-eabi + + - name: Download wasm artifact + uses: actions/download-artifact@v4 + with: + name: wasm-build-artifacts + path: wasm-build-artifacts + + - name: Build and Flash mini sample + run: | + . /opt/zephyr-venv/bin/activate + west build -p always -b b_u585i_iot02a src/samples/mini/zephyr + west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr + + mini-test: + name: Mini Validation Test + needs: mini-flash + runs-on: zephyr-xlarge-runner + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run mini sample Test Case + run: | + cd tests_hw && bash beginTests.sh "mini" + + - name: Print mini sample Test Case Logs + if: always() + run: | + cat /tmp/mini.log + + demo-flash: + name: Demo sample build and flash + needs: [artifact-wasm-files, mini-test] + runs-on: zephyr-xlarge-runner + container: + image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} + volumes: + - /var/ocre-ci-files/:/var/ocre-ci-files/ + - /usr/local/STMicroelectronics/:/usr/local/STMicroelectronics/ + - /github/home/STMicroelectronics/:/github/home/STMicroelectronics/ + - /dev/bus/usb:/dev/bus/usb + options: --user root --privileged --device=/dev/ttyACM0 + + steps: + - name: Clean workspace + run: | + rm -rf ocre-runtime || true + rm -rf ../.west || true + continue-on-error: true + + - name: Checkout + uses: actions/checkout@v4 + with: + path: ocre-runtime + submodules: recursive + + - name: Setup west environment + run: | + . /opt/zephyr-venv/bin/activate + west init -l . + west update + west zephyr-export + west packages pip --install + west sdk install -t \ + x86_64-zephyr-elf \ + aarch64-zephyr-elf \ + arm-zephyr-eabi + + - name: Download wasm artifact + uses: actions/download-artifact@v4 + with: + name: wasm-build-artifacts + path: wasm-build-artifacts + + - name: Build and Flash Demo Sample + run: | + . /opt/zephyr-venv/bin/activate + west build -p always -b b_u585i_iot02a src/samples/demo/zephyr + west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex + + demo-test: + name: Demo Validation Test + needs: demo-flash + runs-on: zephyr-xlarge-runner + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run Demo Sample Test Case + run: | + cd tests_hw && bash beginTests.sh "demo" + + - name: Print Demo Sample Test Case Logs + if: always() + run: | + cat /tmp/demo.log + + build-flash-supervisor-set-1: + name: Build and Flash Supervisor with Image Set 1 + needs: [artifact-wasm-files, demo-test] + runs-on: zephyr-xlarge-runner + container: + image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} + volumes: + - /var/ocre-ci-files/:/var/ocre-ci-files/ + - /usr/local/STMicroelectronics/:/usr/local/STMicroelectronics/ + - /github/home/STMicroelectronics/:/github/home/STMicroelectronics/ + - /dev/bus/usb:/dev/bus/usb + options: --user root --privileged --device=/dev/ttyACM0 steps: - name: Clean workspace @@ -155,18 +302,25 @@ jobs: west build -p always -b b_u585i_iot02a src/samples/supervisor/zephyr -- "-DOCRE_SDK_PRELOADED_IMAGES=hello-world.wasm" west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex - supervisor-hello-world-test: - needs: build-flash-supervisor + supervisor-test-set-1: + name: Supervisor Test Set 1 + needs: build-flash-supervisor-set-1 runs-on: zephyr-xlarge-runner + strategy: + matrix: + test: + - name: Hello-World + group: supervisor-helloWorld + steps: - name: Checkout uses: actions/checkout@v4 - - name: Supervisor Hello-World Testcase + - name: Supervisor ${{ matrix.test.name }} Testcase run: | - cd tests_hw && bash beginTests.sh "supervisor-helloWorld" + cd tests_hw && bash beginTests.sh ${{ matrix.test.group }} - name: Print Hello-World Test Case Logs if: always() - run: cat /tmp/supervisor-helloWorld.log \ No newline at end of file + run: cat /tmp/${{ matrix.test.group }}.log \ No newline at end of file diff --git a/tests_hw/groups/demo/clean.sh b/tests_hw/groups/demo/clean.sh new file mode 100644 index 00000000..6b895bf1 --- /dev/null +++ b/tests_hw/groups/demo/clean.sh @@ -0,0 +1 @@ +echo "Cleanup is complete" \ No newline at end of file diff --git a/tests_hw/groups/demo/config.json b/tests_hw/groups/demo/config.json new file mode 100644 index 00000000..524dcda6 --- /dev/null +++ b/tests_hw/groups/demo/config.json @@ -0,0 +1,28 @@ +{ + "name": "Demo Validation", + "description": "Test the Ocre demo sample with the default containers", + "setup": [ + { + "name": "Demo Validation Setup", + "exec": "bash setup.sh" + } + ], + "test_suites": [ + { + "name": "Demo Validation Tests", + "description": "Reads output from the demo sample to make sure it successfully ran", + "test_cases": [ + { + "name": "Check Demo Hello World", + "exec": "./testcase.py" + } + ] + } + ], + "cleanup": [ + { + "name": "Demo Validation Cleanup", + "exec": "bash clean.sh" + } + ] + } diff --git a/tests_hw/groups/demo/setup.sh b/tests_hw/groups/demo/setup.sh new file mode 100644 index 00000000..78545bd9 --- /dev/null +++ b/tests_hw/groups/demo/setup.sh @@ -0,0 +1 @@ +echo "Setup is complete" \ No newline at end of file diff --git a/tests_hw/groups/demo/testcase.py b/tests_hw/groups/demo/testcase.py new file mode 100755 index 00000000..5f954916 --- /dev/null +++ b/tests_hw/groups/demo/testcase.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +import serial +import time +import sys + +""" +This testcase is to be used following the flashing of the default demo sample to a board. + +The testcase forms a serial connection to the board, sends a break and checks that +the string "powered by Ocre" appears in the output of that break command. +""" + +lines_to_check = [ + "powered by Ocre", + "Generic blinking started.", + "Demo completed successfully", +] + + +# Test stub, add more checks to ensure other containers ran successfully +def main(): + + + conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) + conn.reset_input_buffer() + time.sleep(20) + # Refactor to use conn.read_until to remove need for separate timeout + response = conn.read(2048).decode(errors='ignore') + + print("Container Output:") + print(response) + conn.close() + + for line in lines_to_check: + if line not in response: + sys.exit(1) + + sys.exit(0) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tests_hw/groups/mini/clean.sh b/tests_hw/groups/mini/clean.sh new file mode 100644 index 00000000..6b895bf1 --- /dev/null +++ b/tests_hw/groups/mini/clean.sh @@ -0,0 +1 @@ +echo "Cleanup is complete" \ No newline at end of file diff --git a/tests_hw/groups/mini/config.json b/tests_hw/groups/mini/config.json new file mode 100644 index 00000000..a5c5cea8 --- /dev/null +++ b/tests_hw/groups/mini/config.json @@ -0,0 +1,28 @@ +{ + "name": "Mini Validation", + "description": "Test the Ocre mini sample with the default hello-world container", + "setup": [ + { + "name": "Mini Validation Setup", + "exec": "bash setup.sh" + } + ], + "test_suites": [ + { + "name": "Mini Validation Tests", + "description": "Reads output from mini sample to make sure it successfully ran", + "test_cases": [ + { + "name": "Check Mini Hello World", + "exec": "./testcase.py" + } + ] + } + ], + "cleanup": [ + { + "name": "Mini Validation Cleanup", + "exec": "bash clean.sh" + } + ] + } diff --git a/tests_hw/groups/mini/setup.sh b/tests_hw/groups/mini/setup.sh new file mode 100644 index 00000000..78545bd9 --- /dev/null +++ b/tests_hw/groups/mini/setup.sh @@ -0,0 +1 @@ +echo "Setup is complete" \ No newline at end of file diff --git a/tests_hw/groups/mini/testcase.py b/tests_hw/groups/mini/testcase.py new file mode 100755 index 00000000..ab27cc22 --- /dev/null +++ b/tests_hw/groups/mini/testcase.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import serial +import time +import sys + +""" +This testcase is to be used following the flashing of the default mini sample to a board. + +The testcase forms a serial connection to the board, sends a break and checks that +the string "powered by Ocre" appears in the output of that break command. +""" + +def main(): + + conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) + conn.reset_input_buffer() + time.sleep(5) + # Refactor to use conn.read_until to remove need for separate timeout + response = conn.read(2048).decode(errors='ignore') + + print("Container Output:") + print(response) + conn.close() + + if "powered by Ocre" in response: + sys.exit(0) + sys.exit(1) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py index 6c7eb492..f086b146 100755 --- a/tests_hw/groups/supervisor-helloWorld/testcase.py +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -3,6 +3,12 @@ import serial import sys +""" +This testcase is to be used following the flashing of the supervisor sample to a board with the hello-world container running. + +The testcase forms a serial connection to the board, sends a break and checks that +the string "powered by Ocre" appears in the output of that break command. +""" def main(): From 7b38a1225666bf9af0ab36dba587ddef2cae3b5c Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Fri, 13 Feb 2026 16:34:14 -0500 Subject: [PATCH 05/13] Simplify GHA workflows Combines mini and demo flash and test steps to simply workflow jobs. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 26 ++++++-------------------- tests_hw/groups/demo/testcase.py | 19 ++++++++++--------- tests_hw/groups/mini/testcase.py | 2 ++ 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index cac1d2aa..6c06fc46 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -165,17 +165,10 @@ jobs: west build -p always -b b_u585i_iot02a src/samples/mini/zephyr west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr - mini-test: - name: Mini Validation Test - needs: mini-flash - runs-on: zephyr-xlarge-runner - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Run mini sample Test Case run: | + . /opt/zephyr-venv/bin/activate + pip install pyserial cd tests_hw && bash beginTests.sh "mini" - name: Print mini sample Test Case Logs @@ -185,7 +178,7 @@ jobs: demo-flash: name: Demo sample build and flash - needs: [artifact-wasm-files, mini-test] + needs: [artifact-wasm-files, mini-flash] runs-on: zephyr-xlarge-runner container: image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} @@ -233,17 +226,10 @@ jobs: west build -p always -b b_u585i_iot02a src/samples/demo/zephyr west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex - demo-test: - name: Demo Validation Test - needs: demo-flash - runs-on: zephyr-xlarge-runner - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Run Demo Sample Test Case run: | + . /opt/zephyr-venv/bin/activate + pip install pyserial cd tests_hw && bash beginTests.sh "demo" - name: Print Demo Sample Test Case Logs @@ -253,7 +239,7 @@ jobs: build-flash-supervisor-set-1: name: Build and Flash Supervisor with Image Set 1 - needs: [artifact-wasm-files, demo-test] + needs: [artifact-wasm-files, demo-flash] runs-on: zephyr-xlarge-runner container: image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} diff --git a/tests_hw/groups/demo/testcase.py b/tests_hw/groups/demo/testcase.py index 5f954916..2bbd833a 100755 --- a/tests_hw/groups/demo/testcase.py +++ b/tests_hw/groups/demo/testcase.py @@ -14,28 +14,29 @@ lines_to_check = [ "powered by Ocre", "Generic blinking started.", + "Subscriber initialized", + "Publisher initialized", "Demo completed successfully", ] -# Test stub, add more checks to ensure other containers ran successfully def main(): - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) conn.reset_input_buffer() - time.sleep(20) - # Refactor to use conn.read_until to remove need for separate timeout - response = conn.read(2048).decode(errors='ignore') - + conn.send_break() print("Container Output:") - print(response) - conn.close() - for line in lines_to_check: + response = conn.read_until(line.encode(), 4096).decode(errors='ignore') + print(response) + if line not in response: + conn.reset_output_buffer() + conn.close() sys.exit(1) + conn.reset_output_buffer() + conn.close() sys.exit(0) diff --git a/tests_hw/groups/mini/testcase.py b/tests_hw/groups/mini/testcase.py index ab27cc22..93b2c143 100755 --- a/tests_hw/groups/mini/testcase.py +++ b/tests_hw/groups/mini/testcase.py @@ -15,12 +15,14 @@ def main(): conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) conn.reset_input_buffer() + conn.send_break() time.sleep(5) # Refactor to use conn.read_until to remove need for separate timeout response = conn.read(2048).decode(errors='ignore') print("Container Output:") print(response) + conn.reset_output_buffer() conn.close() if "powered by Ocre" in response: From 36bb7fe05866d4ee7bbf8833bec2ab0d3b74db49 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Tue, 17 Feb 2026 16:53:51 -0500 Subject: [PATCH 06/13] Refactor Testcases to use pexpect Integrated use of pexpect into the demo, mini, and hello-world supervisor tests in order to improve consistency with tests. Includes addition of testlib.py file to include common test functionality such as establishing serial connections and formatting test output. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 3 -- tests_hw/groups/demo/testcase.py | 43 ++++++++++------ tests_hw/groups/mini/testcase.py | 50 ++++++++++++------- .../groups/supervisor-helloWorld/clean.py | 8 ++- .../groups/supervisor-helloWorld/setup.py | 1 + .../groups/supervisor-helloWorld/testcase.py | 43 ++++++++++------ tests_hw/testlib.py | 26 ++++++++++ 7 files changed, 121 insertions(+), 53 deletions(-) create mode 100644 tests_hw/testlib.py diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 6c06fc46..595dcfef 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -97,9 +97,6 @@ jobs: - name: Save .wasm artifact locally if: always() run: | - pwd - ls /var/ - ls /var/ocre-ci-files/ mkdir /var/ocre-ci-files/wasm/${{ matrix.sample.name }}/ cp "ocre-runtime/ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}" diff --git a/tests_hw/groups/demo/testcase.py b/tests_hw/groups/demo/testcase.py index 2bbd833a..685b1dd7 100755 --- a/tests_hw/groups/demo/testcase.py +++ b/tests_hw/groups/demo/testcase.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 import serial -import time import sys +import pexpect +import pexpect.fdpexpect +import testlib """ This testcase is to be used following the flashing of the default demo sample to a board. @@ -14,30 +16,41 @@ lines_to_check = [ "powered by Ocre", "Generic blinking started.", + "Container exited with status 0", "Subscriber initialized", "Publisher initialized", + "Subscriber exited with status 0", + "Publisher exited with status 0", "Demo completed successfully", ] def main(): + full_output = '' + serial_conn, pex = testlib.setup('/dev/ttyACM0') + serial_conn.send_break() - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) - conn.reset_input_buffer() - conn.send_break() - print("Container Output:") + print("Checking Runtime Output:") for line in lines_to_check: - response = conn.read_until(line.encode(), 4096).decode(errors='ignore') - print(response) + print(f"Checking for line: '{line}'") + expect_index = pex.expect([line, pexpect.TIMEOUT], 30) + full_output += bytes(pex.before).decode(errors='ignore') - if line not in response: - conn.reset_output_buffer() - conn.close() - sys.exit(1) - - conn.reset_output_buffer() - conn.close() - sys.exit(0) + if (expect_index == 1): + print(f"Failed to find line: '{line}' in given timeout.") + + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') + testlib.format_runtime_output(full_output, "Failed") + + testlib.full_exit(serial_conn, 1) + + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') + + print("Able to successful verify runtime") + testlib.format_runtime_output(full_output, "Entire") + testlib.full_exit(serial_conn, 0) if __name__ == "__main__": diff --git a/tests_hw/groups/mini/testcase.py b/tests_hw/groups/mini/testcase.py index 93b2c143..a3d8bee3 100755 --- a/tests_hw/groups/mini/testcase.py +++ b/tests_hw/groups/mini/testcase.py @@ -1,8 +1,7 @@ #!/usr/bin/env python3 -import serial -import time -import sys +import pexpect +import testlib """ This testcase is to be used following the flashing of the default mini sample to a board. @@ -11,23 +10,36 @@ the string "powered by Ocre" appears in the output of that break command. """ -def main(): +lines_to_check = [ + "powered by Ocre", +] - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) - conn.reset_input_buffer() - conn.send_break() - time.sleep(5) - # Refactor to use conn.read_until to remove need for separate timeout - response = conn.read(2048).decode(errors='ignore') - - print("Container Output:") - print(response) - conn.reset_output_buffer() - conn.close() - - if "powered by Ocre" in response: - sys.exit(0) - sys.exit(1) +def main(): + full_output = '' + serial_conn, pex = testlib.setup('/dev/ttyACM0') + serial_conn.send_break() + + print("Checking Runtime Output:") + for line in lines_to_check: + print(f"Checking for line: '{line}'") + expect_index = pex.expect([line, pexpect.TIMEOUT], 30) + full_output += bytes(pex.before).decode(errors='ignore') + + if (expect_index == 1): + print(f"Failed to find line: '{line}' in given timeout.") + + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') + testlib.format_runtime_output(full_output, "Failed") + + testlib.full_exit(serial_conn, 1) + + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') + + print("Able to successful verify runtime") + testlib.format_runtime_output(full_output, "Entire") + testlib.full_exit(serial_conn, 0) if __name__ == "__main__": diff --git a/tests_hw/groups/supervisor-helloWorld/clean.py b/tests_hw/groups/supervisor-helloWorld/clean.py index 3b3ddd6a..d6087b89 100755 --- a/tests_hw/groups/supervisor-helloWorld/clean.py +++ b/tests_hw/groups/supervisor-helloWorld/clean.py @@ -9,9 +9,13 @@ def main(): conn.send_break(duration=1) time.sleep(5) print("Cleaning up container hello-world") - conn.write(b'ocre rm hello-world\n') + conn.write(b'ocre container ps\n') response = conn.read(2048).decode(errors='ignore') - print("Runtime Output:") + if ("hello-world" in response): + conn.write(b'ocre rm hello-world\n') + response += conn.read(2048).decode(errors='ignore') + + print("==== Runtime Output: ====") print(response) conn.close() diff --git a/tests_hw/groups/supervisor-helloWorld/setup.py b/tests_hw/groups/supervisor-helloWorld/setup.py index f3e5bb96..ef85ed63 100755 --- a/tests_hw/groups/supervisor-helloWorld/setup.py +++ b/tests_hw/groups/supervisor-helloWorld/setup.py @@ -12,6 +12,7 @@ def main(): print("Creating container on board off of hello-world.wasm") conn.write(b'ocre create -n hello-world -k ocre:api hello-world.wasm\n') response = conn.read(2048).decode(errors='ignore') + print("==== Runtime Output: ====") print(response) conn.close() diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py index f086b146..57074c5a 100755 --- a/tests_hw/groups/supervisor-helloWorld/testcase.py +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -import time -import serial -import sys + +import pexpect +import testlib """ This testcase is to be used following the flashing of the supervisor sample to a board with the hello-world container running. @@ -10,23 +10,38 @@ the string "powered by Ocre" appears in the output of that break command. """ +line = "powered by Ocre" + def main(): + full_output = '' + serial_conn, pex = testlib.setup('/dev/ttyACM0') - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) - conn.reset_input_buffer() - time.sleep(5) print("Running hello-world container:") - conn.write(b'ocre start hello-world\n') - response = conn.read(2048).decode(errors='ignore') + pex.write(b'ocre start hello-world\n') + expect_index = pex.expect([line, pexpect.TIMEOUT], 20) + full_output += bytes(pex.before).decode(errors='ignore') + + if (expect_index == 1): + print(f"Failed to find line: '{line}' in given timeout.") + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') + testlib.format_runtime_output(full_output, "Failed") + + testlib.full_exit(serial_conn, 1) + + pex.expect(["ocre:~$", pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') - print("Container Output:") - print(response) - conn.close() + if (expect_index == 1): + print("Container failed to exit in given timeout") + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) + full_output += bytes(pex.before).decode(errors='ignore') + testlib.format_runtime_output(full_output, "Failed") - if "powered by Ocre" in response: - sys.exit(0) - sys.exit(1) + testlib.full_exit(serial_conn, 1) + testlib.format_runtime_output(full_output, "Entire") + testlib.full_exit(serial_conn, 0) if __name__ == "__main__": main() \ No newline at end of file diff --git a/tests_hw/testlib.py b/tests_hw/testlib.py new file mode 100644 index 00000000..b673872f --- /dev/null +++ b/tests_hw/testlib.py @@ -0,0 +1,26 @@ +import serial +import sys +import pexpect +import pexpect.fdpexpect +from typing import Tuple + +def setup(device_filepath: str) -> Tuple[serial.Serial, pexpect.fdpexpect.fdspawn]: + conn = serial.Serial(device_filepath, 115200, timeout=10) + conn.reset_input_buffer() + pex = pexpect.fdpexpect.fdspawn(conn.fileno()) + return (conn, pex) + + +def full_exit(conn: serial.Serial, status: int): + conn.reset_output_buffer() + conn.close() + sys.exit(status) + + +def format_runtime_output(runtime_output: str, section: str) -> None: + print(f""" +========== {section} runtime output ========== +{runtime_output} +==========--------------------------========== +""") + return \ No newline at end of file From 29a2dd1288a91d58bca87a94fc487941e88b4895 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Thu, 19 Feb 2026 12:16:00 -0500 Subject: [PATCH 07/13] tests_hw: General Code Cleanup Code style updates, remove unnecessary whitespace and unused imports. Signed-off-by: Matthew Gee --- src/ocre/commit_id.h | 2 ++ tests_hw/groups/demo/testcase.py | 4 ---- tests_hw/groups/supervisor-helloWorld/clean.py | 2 -- tests_hw/testlib.py | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) create mode 100644 src/ocre/commit_id.h diff --git a/src/ocre/commit_id.h b/src/ocre/commit_id.h new file mode 100644 index 00000000..4d461771 --- /dev/null +++ b/src/ocre/commit_id.h @@ -0,0 +1,2 @@ +/* Auto-generated file. DO NOT EDIT */ +#define GIT_COMMIT_ID "3097870798196c94ba709e8393ee0eac9f622e25" diff --git a/tests_hw/groups/demo/testcase.py b/tests_hw/groups/demo/testcase.py index 685b1dd7..38e1416f 100755 --- a/tests_hw/groups/demo/testcase.py +++ b/tests_hw/groups/demo/testcase.py @@ -1,9 +1,6 @@ #!/usr/bin/env python3 -import serial -import sys import pexpect -import pexpect.fdpexpect import testlib """ @@ -24,7 +21,6 @@ "Demo completed successfully", ] - def main(): full_output = '' serial_conn, pex = testlib.setup('/dev/ttyACM0') diff --git a/tests_hw/groups/supervisor-helloWorld/clean.py b/tests_hw/groups/supervisor-helloWorld/clean.py index d6087b89..55aa4dac 100755 --- a/tests_hw/groups/supervisor-helloWorld/clean.py +++ b/tests_hw/groups/supervisor-helloWorld/clean.py @@ -20,7 +20,5 @@ def main(): conn.close() - - if __name__ == "__main__": main() \ No newline at end of file diff --git a/tests_hw/testlib.py b/tests_hw/testlib.py index b673872f..f78cbf72 100644 --- a/tests_hw/testlib.py +++ b/tests_hw/testlib.py @@ -4,6 +4,7 @@ import pexpect.fdpexpect from typing import Tuple + def setup(device_filepath: str) -> Tuple[serial.Serial, pexpect.fdpexpect.fdspawn]: conn = serial.Serial(device_filepath, 115200, timeout=10) conn.reset_input_buffer() From bf88000ab5c2ac37a3d421a3fb5c9c4e6605b66f Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Fri, 20 Feb 2026 13:34:47 -0500 Subject: [PATCH 08/13] tests_hw: Clear serial buffer Clear serial buffer at the start and end of every serial connection during test cases to ensure runtime outputs from other github actions runs do not affect other runs. Also includes formatting updates in GHA workflow files and separates the demo and mini flashes to their own jobs outside of the container. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 54 ++++++++++++------- .github/workflows/main.yml | 19 ++++--- tests_hw/groups/demo/testcase.py | 3 ++ tests_hw/groups/mini/testcase.py | 3 ++ .../groups/supervisor-helloWorld/testcase.py | 3 ++ tests_hw/testlib.py | 4 ++ 6 files changed, 56 insertions(+), 30 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 595dcfef..94c76cda 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -3,7 +3,6 @@ # # SPDX-License-Identifier: Apache-2.0 - name: Hardware Checks (b_u585) concurrency: @@ -19,15 +18,14 @@ on: required: false type: string - -jobs: +jobs: setup-local-runner: - name: Setup local runner + name: Setup local runner runs-on: zephyr-xlarge-runner steps: - name: Remove old workflow files run: rm -rf /var/ocre-ci-files/* - + - name: Create wasm directory run: mkdir /var/ocre-ci-files/wasm @@ -84,7 +82,7 @@ jobs: echo "Directory not found: $SAMPLE_DIR" exit 1 fi - + mkdir -p "$SAMPLE_DIR/build" cd "$SAMPLE_DIR/build" cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake @@ -137,7 +135,8 @@ jobs: with: path: ocre-runtime submodules: recursive - + fetch-depth: 0 + - name: Setup west environment run: | . /opt/zephyr-venv/bin/activate @@ -159,13 +158,20 @@ jobs: - name: Build and Flash mini sample run: | . /opt/zephyr-venv/bin/activate - west build -p always -b b_u585i_iot02a src/samples/mini/zephyr + west build -p always -b b_u585i_iot02a src/samples/mini/zephyr west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr + mini-test: + name: Mini Validation Test + needs: mini-flash + runs-on: zephyr-xlarge-runner + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run mini sample Test Case run: | - . /opt/zephyr-venv/bin/activate - pip install pyserial cd tests_hw && bash beginTests.sh "mini" - name: Print mini sample Test Case Logs @@ -175,7 +181,7 @@ jobs: demo-flash: name: Demo sample build and flash - needs: [artifact-wasm-files, mini-flash] + needs: [artifact-wasm-files, mini-test] runs-on: zephyr-xlarge-runner container: image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} @@ -198,7 +204,8 @@ jobs: with: path: ocre-runtime submodules: recursive - + fetch-depth: 0 + - name: Setup west environment run: | . /opt/zephyr-venv/bin/activate @@ -220,13 +227,20 @@ jobs: - name: Build and Flash Demo Sample run: | . /opt/zephyr-venv/bin/activate - west build -p always -b b_u585i_iot02a src/samples/demo/zephyr + west build -p always -b b_u585i_iot02a src/samples/demo/zephyr west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex + demo-test: + name: Demo Validation Test + needs: demo-flash + runs-on: zephyr-xlarge-runner + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run Demo Sample Test Case run: | - . /opt/zephyr-venv/bin/activate - pip install pyserial cd tests_hw && bash beginTests.sh "demo" - name: Print Demo Sample Test Case Logs @@ -236,7 +250,7 @@ jobs: build-flash-supervisor-set-1: name: Build and Flash Supervisor with Image Set 1 - needs: [artifact-wasm-files, demo-flash] + needs: [artifact-wasm-files, demo-test] runs-on: zephyr-xlarge-runner container: image: ghcr.io/${{ github.repository }}/devcontainer-zephyr:${{ inputs.devcontainer-tag }} @@ -259,7 +273,7 @@ jobs: with: path: ocre-runtime submodules: recursive - + - name: Setup west environment run: | @@ -293,8 +307,8 @@ jobs: strategy: matrix: test: - - name: Hello-World - group: supervisor-helloWorld + - name: Hello-World + group: supervisor-helloWorld steps: - name: Checkout @@ -306,4 +320,4 @@ jobs: - name: Print Hello-World Test Case Logs if: always() - run: cat /tmp/${{ matrix.test.group }}.log \ No newline at end of file + run: cat /tmp/${{ matrix.test.group }}.log diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a2ce8f40..f4ec3196 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,20 +65,19 @@ jobs: devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} zephyr-systests: - name: Zephyr System Tests - needs: - - zephyr-devcontainer - uses: ./.github/workflows/zephyr-systests.yml - secrets: inherit - with: - devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} + name: Zephyr System Tests + needs: + - zephyr-devcontainer + uses: ./.github/workflows/zephyr-systests.yml + secrets: inherit + with: + devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} hardware-b_u585i_iot02a: name: Hardware b_u585i_iot02a needs: - - zephyr-devcontainer + - zephyr-devcontainer uses: ./.github/workflows/hardware-bu585.yml secrets: inherit with: - devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} - + devcontainer-tag: ${{ needs.zephyr-devcontainer.outputs.devcontainer-tag }} diff --git a/tests_hw/groups/demo/testcase.py b/tests_hw/groups/demo/testcase.py index 38e1416f..4ed681bf 100755 --- a/tests_hw/groups/demo/testcase.py +++ b/tests_hw/groups/demo/testcase.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +import sys +sys.path.append("../..") + import pexpect import testlib diff --git a/tests_hw/groups/mini/testcase.py b/tests_hw/groups/mini/testcase.py index a3d8bee3..fa25a383 100755 --- a/tests_hw/groups/mini/testcase.py +++ b/tests_hw/groups/mini/testcase.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +import sys +sys.path.append("../..") + import pexpect import testlib diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py index 57074c5a..2283b294 100755 --- a/tests_hw/groups/supervisor-helloWorld/testcase.py +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +import sys +sys.path.append("../..") + import pexpect import testlib diff --git a/tests_hw/testlib.py b/tests_hw/testlib.py index f78cbf72..d4e241ed 100644 --- a/tests_hw/testlib.py +++ b/tests_hw/testlib.py @@ -8,12 +8,16 @@ def setup(device_filepath: str) -> Tuple[serial.Serial, pexpect.fdpexpect.fdspawn]: conn = serial.Serial(device_filepath, 115200, timeout=10) conn.reset_input_buffer() + conn.reset_output_buffer() + conn.flush() pex = pexpect.fdpexpect.fdspawn(conn.fileno()) return (conn, pex) def full_exit(conn: serial.Serial, status: int): + conn.reset_input_buffer() conn.reset_output_buffer() + conn.flush() conn.close() sys.exit(status) From 146ae1ca7f2d16f66adef9d9474b3953cfe08244 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Fri, 20 Feb 2026 15:08:39 -0500 Subject: [PATCH 09/13] tests_hw: Refactor test scripts Refactor test scripts to be using more direct python string comparison rather than using pexect.expect() for output detection. Also includes minor format updates for related GHA file. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 1 - tests_hw/groups/demo/testcase.py | 20 ++++------- tests_hw/groups/mini/testcase.py | 18 +++------- .../groups/supervisor-helloWorld/clean.py | 31 +++++++++-------- .../groups/supervisor-helloWorld/setup.py | 34 +++++++++++-------- .../groups/supervisor-helloWorld/testcase.py | 33 +++++++----------- 6 files changed, 59 insertions(+), 78 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 94c76cda..3794f2ba 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -274,7 +274,6 @@ jobs: path: ocre-runtime submodules: recursive - - name: Setup west environment run: | . /opt/zephyr-venv/bin/activate diff --git a/tests_hw/groups/demo/testcase.py b/tests_hw/groups/demo/testcase.py index 4ed681bf..260b4c8b 100755 --- a/tests_hw/groups/demo/testcase.py +++ b/tests_hw/groups/demo/testcase.py @@ -10,7 +10,7 @@ This testcase is to be used following the flashing of the default demo sample to a board. The testcase forms a serial connection to the board, sends a break and checks that -the string "powered by Ocre" appears in the output of that break command. +the strings from each section of a successful run appears in the output of that break command. """ lines_to_check = [ @@ -25,30 +25,22 @@ ] def main(): - full_output = '' serial_conn, pex = testlib.setup('/dev/ttyACM0') serial_conn.send_break() + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 45) + runtime_output = bytes(pex.before).decode(errors='ignore') print("Checking Runtime Output:") for line in lines_to_check: print(f"Checking for line: '{line}'") - expect_index = pex.expect([line, pexpect.TIMEOUT], 30) - full_output += bytes(pex.before).decode(errors='ignore') - - if (expect_index == 1): + if (line not in runtime_output): print(f"Failed to find line: '{line}' in given timeout.") - pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') - testlib.format_runtime_output(full_output, "Failed") - + testlib.format_runtime_output(runtime_output, "Failed") testlib.full_exit(serial_conn, 1) - pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') - print("Able to successful verify runtime") - testlib.format_runtime_output(full_output, "Entire") + testlib.format_runtime_output(runtime_output, "Entire") testlib.full_exit(serial_conn, 0) diff --git a/tests_hw/groups/mini/testcase.py b/tests_hw/groups/mini/testcase.py index fa25a383..9a57bc01 100755 --- a/tests_hw/groups/mini/testcase.py +++ b/tests_hw/groups/mini/testcase.py @@ -18,30 +18,22 @@ ] def main(): - full_output = '' serial_conn, pex = testlib.setup('/dev/ttyACM0') serial_conn.send_break() + pex.expect([pexpect.EOF, pexpect.TIMEOUT], 45) + runtime_output = bytes(pex.before).decode(errors='ignore') print("Checking Runtime Output:") for line in lines_to_check: print(f"Checking for line: '{line}'") - expect_index = pex.expect([line, pexpect.TIMEOUT], 30) - full_output += bytes(pex.before).decode(errors='ignore') - - if (expect_index == 1): + if (line not in runtime_output): print(f"Failed to find line: '{line}' in given timeout.") - pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') - testlib.format_runtime_output(full_output, "Failed") - + testlib.format_runtime_output(runtime_output, "Failed") testlib.full_exit(serial_conn, 1) - pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') - print("Able to successful verify runtime") - testlib.format_runtime_output(full_output, "Entire") + testlib.format_runtime_output(runtime_output, "Entire") testlib.full_exit(serial_conn, 0) diff --git a/tests_hw/groups/supervisor-helloWorld/clean.py b/tests_hw/groups/supervisor-helloWorld/clean.py index 55aa4dac..a751d939 100755 --- a/tests_hw/groups/supervisor-helloWorld/clean.py +++ b/tests_hw/groups/supervisor-helloWorld/clean.py @@ -1,24 +1,25 @@ #!/usr/bin/env python3 -import time -import serial + +import sys +sys.path.append("../..") + +import pexpect +import testlib def main(): - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) - conn.reset_input_buffer() - conn.send_break(duration=1) - time.sleep(5) - print("Cleaning up container hello-world") - conn.write(b'ocre container ps\n') - response = conn.read(2048).decode(errors='ignore') - if ("hello-world" in response): - conn.write(b'ocre rm hello-world\n') - response += conn.read(2048).decode(errors='ignore') + serial_conn, pex = testlib.setup('/dev/ttyACM0') - print("==== Runtime Output: ====") - print(response) - conn.close() + print("Cleaning up container hello-world") + pex.write(b'ocre container ps\n') + pex.expect(["ocre:~$", pexpect.TIMEOUT], 30) + runtime_output = bytes(pex.before).decode(errors='ignore') + if ("hello-world" in runtime_output): + pex.write(b'ocre rm hello-world\n') + runtime_output += bytes(pex.before).decode(errors='ignore') + testlib.format_runtime_output(runtime_output, "Cleanup") + testlib.full_exit(serial_conn, 0) if __name__ == "__main__": main() \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/setup.py b/tests_hw/groups/supervisor-helloWorld/setup.py index ef85ed63..e8421105 100755 --- a/tests_hw/groups/supervisor-helloWorld/setup.py +++ b/tests_hw/groups/supervisor-helloWorld/setup.py @@ -1,25 +1,31 @@ #!/usr/bin/env python3 -import serial -import time + import sys +sys.path.append("../..") -def main(): +import testlib +import pexpect - conn = serial.Serial('/dev/ttyACM0', 115200, timeout=10) - time.sleep(5) - conn.reset_input_buffer() +def main(): + serial_conn, pex = testlib.setup('/dev/ttyACM0') print("Creating container on board off of hello-world.wasm") - conn.write(b'ocre create -n hello-world -k ocre:api hello-world.wasm\n') - response = conn.read(2048).decode(errors='ignore') - print("==== Runtime Output: ====") - print(response) - - conn.close() + pex.write(b'ocre create -n hello-world -k ocre:api hello-world.wasm\n') + expect_index = pex.expect(["ocre:~$", pexpect.TIMEOUT], 30) + runtime_output = bytes(pex.before).decode(errors='ignore') + + if (expect_index == 1): + print("Container failed to create container in given timeout") + testlib.format_runtime_output(runtime_output, "Failed") + testlib.full_exit(serial_conn, 1) - if "Failed to create container" in response: - sys.exit(1) + if "Failed to create container" in runtime_output: + print("Failed to create container") + testlib.format_runtime_output(runtime_output, "Failed") + testlib.full_exit(serial_conn, 1) + testlib.full_exit(serial_conn, 0) + if __name__ == "__main__": main() \ No newline at end of file diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py index 2283b294..bf1a46f5 100755 --- a/tests_hw/groups/supervisor-helloWorld/testcase.py +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -7,43 +7,34 @@ import testlib """ -This testcase is to be used following the flashing of the supervisor sample to a board with the hello-world container running. +This testcase is to be used following the flashing of the supervisor sample to a board with the hello-world container put up. -The testcase forms a serial connection to the board, sends a break and checks that -the string "powered by Ocre" appears in the output of that break command. +The testcase forms a serial connection to the board, runs the hello-world container +and checks the string "powered by Ocre" appears in the output of the container. """ line = "powered by Ocre" def main(): - full_output = '' serial_conn, pex = testlib.setup('/dev/ttyACM0') print("Running hello-world container:") pex.write(b'ocre start hello-world\n') - expect_index = pex.expect([line, pexpect.TIMEOUT], 20) - full_output += bytes(pex.before).decode(errors='ignore') - - if (expect_index == 1): - print(f"Failed to find line: '{line}' in given timeout.") - pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') - testlib.format_runtime_output(full_output, "Failed") - - testlib.full_exit(serial_conn, 1) - - pex.expect(["ocre:~$", pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') + + expect_index = pex.expect(["ocre:~$", pexpect.TIMEOUT], 30) + runtime_output = bytes(pex.before).decode(errors='ignore') if (expect_index == 1): print("Container failed to exit in given timeout") - pex.expect([pexpect.EOF, pexpect.TIMEOUT], 10) - full_output += bytes(pex.before).decode(errors='ignore') - testlib.format_runtime_output(full_output, "Failed") + testlib.format_runtime_output(runtime_output, "Failed") + testlib.full_exit(serial_conn, 1) + if (line not in runtime_output): + print(f"Failed to find line: '{line}' in given timeout.") + testlib.format_runtime_output(runtime_output, "Failed") testlib.full_exit(serial_conn, 1) - testlib.format_runtime_output(full_output, "Entire") + testlib.format_runtime_output(runtime_output, "Entire") testlib.full_exit(serial_conn, 0) if __name__ == "__main__": From 3b0034616f326f49a602d7b35c5c0e5c3da9f8d4 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Tue, 24 Feb 2026 12:10:19 -0500 Subject: [PATCH 10/13] tests_hw: Remove unnecessary files Removed autogenerated files not relevant to the PR. Signed-off-by: Matthew Gee --- src/ocre/commit_id.h | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 src/ocre/commit_id.h diff --git a/src/ocre/commit_id.h b/src/ocre/commit_id.h deleted file mode 100644 index 4d461771..00000000 --- a/src/ocre/commit_id.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Auto-generated file. DO NOT EDIT */ -#define GIT_COMMIT_ID "3097870798196c94ba709e8393ee0eac9f622e25" From ee28ae22a5c5181746973ca50e841ab4164c180a Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Tue, 24 Feb 2026 12:49:49 -0500 Subject: [PATCH 11/13] tests_hw: Fix inconsistent supervisor test timeout Add extra check after pexpect timeout for the ocre shell prompt to make sure the shell prompt is not missed and cause a false negative on the testcase. Signed-off-by: Matthew Gee --- tests_hw/groups/supervisor-helloWorld/testcase.py | 6 +++--- tests_hw/testlib.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests_hw/groups/supervisor-helloWorld/testcase.py b/tests_hw/groups/supervisor-helloWorld/testcase.py index bf1a46f5..4b6bd759 100755 --- a/tests_hw/groups/supervisor-helloWorld/testcase.py +++ b/tests_hw/groups/supervisor-helloWorld/testcase.py @@ -20,11 +20,11 @@ def main(): print("Running hello-world container:") pex.write(b'ocre start hello-world\n') - - expect_index = pex.expect(["ocre:~$", pexpect.TIMEOUT], 30) + + expect_index = pex.expect([testlib.shell_prompt, pexpect.TIMEOUT], 30) runtime_output = bytes(pex.before).decode(errors='ignore') - if (expect_index == 1): + if (expect_index == 1 and testlib.shell_prompt not in runtime_output): print("Container failed to exit in given timeout") testlib.format_runtime_output(runtime_output, "Failed") testlib.full_exit(serial_conn, 1) diff --git a/tests_hw/testlib.py b/tests_hw/testlib.py index d4e241ed..a138c633 100644 --- a/tests_hw/testlib.py +++ b/tests_hw/testlib.py @@ -4,6 +4,7 @@ import pexpect.fdpexpect from typing import Tuple +shell_prompt = "ocre:~$" def setup(device_filepath: str) -> Tuple[serial.Serial, pexpect.fdpexpect.fdspawn]: conn = serial.Serial(device_filepath, 115200, timeout=10) From 5f14ce577ca0b0d250aff1f99711113004142aac Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Thu, 26 Feb 2026 12:30:17 -0500 Subject: [PATCH 12/13] tests_hw: Simply GHA west setup Removes additional unneeded steps in the GHA actions workflow regarding the west setup which should be unnecessary when using the dev container. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 36 ---------------------------- 1 file changed, 36 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 3794f2ba..34d04e2a 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -137,18 +137,6 @@ jobs: submodules: recursive fetch-depth: 0 - - name: Setup west environment - run: | - . /opt/zephyr-venv/bin/activate - west init -l . - west update - west zephyr-export - west packages pip --install - west sdk install -t \ - x86_64-zephyr-elf \ - aarch64-zephyr-elf \ - arm-zephyr-eabi - - name: Download wasm artifact uses: actions/download-artifact@v4 with: @@ -206,18 +194,6 @@ jobs: submodules: recursive fetch-depth: 0 - - name: Setup west environment - run: | - . /opt/zephyr-venv/bin/activate - west init -l . - west update - west zephyr-export - west packages pip --install - west sdk install -t \ - x86_64-zephyr-elf \ - aarch64-zephyr-elf \ - arm-zephyr-eabi - - name: Download wasm artifact uses: actions/download-artifact@v4 with: @@ -274,18 +250,6 @@ jobs: path: ocre-runtime submodules: recursive - - name: Setup west environment - run: | - . /opt/zephyr-venv/bin/activate - west init -l . - west update - west zephyr-export - west packages pip --install - west sdk install -t \ - x86_64-zephyr-elf \ - aarch64-zephyr-elf \ - arm-zephyr-eabi - - name: Download wasm artifact uses: actions/download-artifact@v4 with: From d6b2b1f4bc83029f0c9a93b206176b6ab5182260 Mon Sep 17 00:00:00 2001 From: Matthew Gee Date: Thu, 26 Feb 2026 13:10:38 -0500 Subject: [PATCH 13/13] tests_hw: GHA Align workspace setup with other tests Aligns the hardware-bu585 west enviornment setup with how other GHA zephyr tests setup and manage the west enviornment. Signed-off-by: Matthew Gee --- .github/workflows/hardware-bu585.yml | 35 +++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index 34d04e2a..9bff6bd0 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -126,16 +126,20 @@ jobs: steps: - name: Clean workspace run: | - rm -rf ocre-runtime || true rm -rf ../.west || true - continue-on-error: true + find . -name . -o -prune -exec rm -rf -- {} + - name: Checkout uses: actions/checkout@v4 with: path: ocre-runtime submodules: recursive - fetch-depth: 0 + + - name: Setup west environment + run: | + . /opt/zephyr-venv/bin/activate + west init -l ocre-runtime + west update - name: Download wasm artifact uses: actions/download-artifact@v4 @@ -146,7 +150,7 @@ jobs: - name: Build and Flash mini sample run: | . /opt/zephyr-venv/bin/activate - west build -p always -b b_u585i_iot02a src/samples/mini/zephyr + west build -p always -b b_u585i_iot02a ocre-runtime/src/samples/mini/zephyr west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr mini-test: @@ -183,16 +187,20 @@ jobs: steps: - name: Clean workspace run: | - rm -rf ocre-runtime || true rm -rf ../.west || true - continue-on-error: true + find . -name . -o -prune -exec rm -rf -- {} + - name: Checkout uses: actions/checkout@v4 with: path: ocre-runtime submodules: recursive - fetch-depth: 0 + + - name: Setup west environment + run: | + . /opt/zephyr-venv/bin/activate + west init -l ocre-runtime + west update - name: Download wasm artifact uses: actions/download-artifact@v4 @@ -203,7 +211,7 @@ jobs: - name: Build and Flash Demo Sample run: | . /opt/zephyr-venv/bin/activate - west build -p always -b b_u585i_iot02a src/samples/demo/zephyr + west build -p always -b b_u585i_iot02a ocre-runtime/src/samples/demo/zephyr west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex demo-test: @@ -240,9 +248,8 @@ jobs: steps: - name: Clean workspace run: | - rm -rf ocre-runtime || true rm -rf ../.west || true - continue-on-error: true + find . -name . -o -prune -exec rm -rf -- {} + - name: Checkout uses: actions/checkout@v4 @@ -250,6 +257,12 @@ jobs: path: ocre-runtime submodules: recursive + - name: Setup west environment + run: | + . /opt/zephyr-venv/bin/activate + west init -l ocre-runtime + west update + - name: Download wasm artifact uses: actions/download-artifact@v4 with: @@ -259,7 +272,7 @@ jobs: - name: Build and Flash Supervisor run: | . /opt/zephyr-venv/bin/activate - west build -p always -b b_u585i_iot02a src/samples/supervisor/zephyr -- "-DOCRE_SDK_PRELOADED_IMAGES=hello-world.wasm" + west build -p always -b b_u585i_iot02a ocre-runtime/src/samples/supervisor/zephyr -- "-DOCRE_SDK_PRELOADED_IMAGES=hello-world.wasm" west flash --extload=/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/ExternalLoader/MX25LM51245G_STM32U585I-IOT02A.stldr --hex-file build/zephyr/merged.hex supervisor-test-set-1: