Skip to content

Commit

Permalink
ci: Adapt HIL tests to use RPi
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Apr 22, 2024
1 parent 3dfea21 commit b208f24
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 16 deletions.
83 changes: 69 additions & 14 deletions .github/workflows/hil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ env:
CARGO_TERM_COLOR: always

jobs:
hil:
name: HIL Test | ${{ matrix.target.soc }}
runs-on:
labels: [self-hosted, "${{ matrix.target.runner }}"]
build-tests:
name: Build Tests | ${{ matrix.target.soc }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
target:
# RISC-V devices:
- soc: esp32c3
runner: rustboard
rust-target: riscv32imc-unknown-none-elf
# - soc: esp32c3
# runner: rustboard
# rust-target: riscv32imc-unknown-none-elf
- soc: esp32c6
runner: esp32c6-usb
rust-target: riscv32imac-unknown-none-elf
- soc: esp32h2
runner: esp32h2-usb
# runner: esp32c6-usb
rust-target: riscv32imac-unknown-none-elf
# Xtensa devices:
- soc: esp32s3
runner: esp32s3-usb
# - soc: esp32h2
# runner: esp32h2-usb
# rust-target: riscv32imac-unknown-none-elf
# # Xtensa devices:
# - soc: esp32s3
# runner: esp32s3-usb
steps:
- uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch'
Expand Down Expand Up @@ -65,3 +65,58 @@ jobs:

- name: Run tests
run: cargo xtask run-tests ${{ matrix.target.soc }}

- name: Prepare artifact
run: |
# Create the 'tests' directory if it doesn't exist
mkdir -p tests
# Find ELF files in the specified path and move them to 'tests'
find "hil-test/target/${{ matrix.target.rust-target }}/release/deps/" -type f -exec file {} + | \
grep ELF | \
awk -F: '{print $1}' | \
xargs -I {} mv {} tests
# Rename files in 'tests' by removing everything after the first dash
for file in tests/*-*; do
base_name="$(basename "$file" | cut -d'-' -f1)"
mv "$file" "tests/$base_name"
done
- uses: actions/upload-artifact@v4
with:
name: tests
path: /home/runner/work/esp-hal/esp-hal/tests
if-no-files-found: error

hil:
name: HIL Test | ${{ matrix.target.soc }}
needs: build-tests
runs-on:
labels: [self-hosted, "${{ matrix.target.runner }}"]
strategy:
fail-fast: false
matrix:
target:
# RISC-V devices:
# - soc: esp32c3
# runner: rustboard
# rust-target: riscv32imc-unknown-none-elf
- soc: esp32c6
runner: esp32c6-usb
# - soc: esp32h2
# runner: esp32h2-usb
# rust-target: riscv32imac-unknown-none-elf
# # Xtensa devices:
# - soc: esp32s3
# runner: esp32s3-usb
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: tests
path: tests
- run: whoami
- run: probe-rs --version
- run: for file in "tests"/*; do probe-rs run --chip ${{ matrix.target.soc }} "$file"; done

2 changes: 1 addition & 1 deletion hil-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Our Virtual Machines have the following setup:
- ESP32-C6 (`esp32c6-usb`):
- Devkit: `ESP32-C6-DevKitC-1 V1.2` connected via USB-Serial-JTAG (`USB` port).
- `GPIO2` and `GPIO4` are connected.
- VM: Ubuntu 20.04.5 configured with the following [setup](#vm-setup)
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
- ESP32-H2 (`esp32h2-usb`):
- Devkit: `ESP32-H2-DevKitM-1` connected via USB-Serial-JTAG (`USB` port).
- `GPIO2` and `GPIO4` are connected.
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub fn run_example(
let (bin, subcommand) = if package.starts_with("src/bin") {
(format!("--bin={}", example.name()), "run")
} else if package.starts_with("tests") {
(format!("--test={}", example.name()), "test")
(format!("--test={}", example.name()), "build")
} else {
(format!("--example={}", example.name()), "run")
};
Expand Down

0 comments on commit b208f24

Please sign in to comment.