Skip to content

Commit b993a42

Browse files
Add xtask command for running HIL tests (#912)
* feat: Initial test * feat: Initial HIL tests in xtask * refactor: End test if possible before timeout * rebase * Add checking for output from monitor * CI: use xtask command instead of bash scripts * clippy * help find cargo * Try increase duration for failing test * remove bash tests * reviews * simplify * Add a local_espflash flag to allow running espflash without re-building (CI) and re-building (locally) * reviews --------- Co-authored-by: Sergio Gasquez <[email protected]>
1 parent f679e03 commit b993a42

17 files changed

+1272
-637
lines changed

.github/workflows/hil.yml

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,29 @@ jobs:
4646
run: apt-get update && apt-get -y install curl musl-tools pkg-config
4747

4848
- name: Install toolchain
49-
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
49+
run: |
50+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5051
5152
- name: Build espflash
5253
run: $HOME/.cargo/bin/cargo build --release
5354
working-directory: espflash
5455

56+
- name: Build xtask
57+
run: $HOME/.cargo/bin/cargo build --release --locked
58+
working-directory: xtask
59+
5560
- uses: actions/upload-artifact@v4
5661
with:
5762
name: espflash
5863
path: target/release/espflash
5964
if-no-files-found: error
6065

66+
- uses: actions/upload-artifact@v4
67+
with:
68+
name: xtask
69+
path: target/release/xtask
70+
if-no-files-found: error
71+
6172
run-target:
6273
if: github.repository_owner == 'esp-rs'
6374
name: ${{ matrix.board.mcu }}${{ matrix.board.freq }}
@@ -95,44 +106,17 @@ jobs:
95106
name: espflash
96107
path: espflash_app
97108

109+
- uses: actions/download-artifact@v4
110+
with:
111+
name: xtask
112+
path: xtask_app
113+
98114
- name: Set up espflash binary
99115
run: |
100116
chmod +x espflash_app/espflash
101117
echo "$PWD/espflash_app" >> "$GITHUB_PATH"
118+
chmod +x xtask_app/xtask
119+
echo "$PWD/xtask_app" >> "$GITHUB_PATH"
102120
103-
- name: board-info test
104-
run: timeout 10 bash espflash/tests/scripts/board-info.sh
105-
106-
- name: flash test
107-
run: timeout 80 bash espflash/tests/scripts/flash.sh ${{ matrix.board.mcu }}
108-
109-
- name: monitor test
110-
run: timeout 10 bash espflash/tests/scripts/monitor.sh
111-
112-
- name: erase-flash test
113-
run: timeout 60 bash espflash/tests/scripts/erase-flash.sh
114-
115-
- name: save-image/write-bin test
116-
run: |
117-
timeout 180 bash espflash/tests/scripts/save-image_write-bin.sh ${{ matrix.board.mcu }}
118-
119-
- name: erase-region test
120-
run: timeout 30 bash espflash/tests/scripts/erase-region.sh
121-
122-
- name: hold-in-reset test
123-
run: timeout 10 bash espflash/tests/scripts/hold-in-reset.sh
124-
125-
- name: reset test
126-
run: timeout 10 bash espflash/tests/scripts/reset.sh
127-
128-
- name: checksum-md5 test
129-
run: timeout 40 bash espflash/tests/scripts/checksum-md5.sh
130-
131-
- name: list-ports test
132-
run: timeout 10 bash espflash/tests/scripts/list-ports.sh
133-
134-
- name: write-bin test
135-
run: timeout 20 bash espflash/tests/scripts/write-bin.sh
136-
137-
- name: read-flash test
138-
run: timeout 60 bash espflash/tests/scripts/read-flash.sh
121+
- name: Run all tests
122+
run: xtask run-tests --chip ${{ matrix.board.mcu }} -t 60 --no-build

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Generated during tests
2+
*.bin
3+
14
# Generated by Cargo
25
# will have compiled files and executables
36
debug/

espflash/tests/scripts/board-info.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

espflash/tests/scripts/checksum-md5.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

espflash/tests/scripts/erase-flash.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

espflash/tests/scripts/erase-region.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

espflash/tests/scripts/flash.sh

Lines changed: 0 additions & 90 deletions
This file was deleted.

espflash/tests/scripts/hold-in-reset.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

espflash/tests/scripts/list-ports.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

espflash/tests/scripts/monitor.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)