update hil test to run on new pi5

This commit is contained in:
hathach 2024-07-15 17:46:20 +07:00
parent bd15f65e81
commit cc6806144f
No known key found for this signature in database
GPG Key ID: 26FAB84F615C3C52
3 changed files with 22 additions and 17 deletions

View File

@ -17,6 +17,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env:
HIL_JSON: test/hil/rpi.json
jobs: jobs:
# --------------------------------------- # ---------------------------------------
# Build Non Espressif # Build Non Espressif
@ -36,7 +39,7 @@ jobs:
sudo apt install -y jq sudo apt install -y jq
# Non-Espresif boards # Non-Espresif boards
BOARDS_LIST=$(jq -r '.boards[] | select(.flasher != "esptool") | "-b " + .name' test/hil/pi4.json | tr '\n' ' ') BOARDS_LIST=$(jq -r '.boards[] | select(.flasher != "esptool") | "-b " + .name' ${{ env.HIL_JSON }} | tr '\n' ' ')
echo "BOARDS_LIST=$BOARDS_LIST" echo "BOARDS_LIST=$BOARDS_LIST"
echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_ENV echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_ENV
echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_OUTPUT echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_OUTPUT
@ -57,7 +60,7 @@ jobs:
- name: Upload Artifacts for Hardware Testing - name: Upload Artifacts for Hardware Testing
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: hil_pi4 name: hil_rpi
path: | path: |
cmake-build/cmake-build-*/*/*/*.elf cmake-build/cmake-build-*/*/*/*.elf
cmake-build/cmake-build-*/*/*/*.bin cmake-build/cmake-build-*/*/*/*.bin
@ -78,7 +81,7 @@ jobs:
run: | run: |
sudo apt install -y jq sudo apt install -y jq
# Espressif boards # Espressif boards
BOARDS_LIST=$(jq -r '.boards[] | select(.flasher == "esptool") | "-b " + .name' test/hil/pi4.json | tr '\n' ' ') BOARDS_LIST=$(jq -r '.boards[] | select(.flasher == "esptool") | "-b " + .name' ${{ env.HIL_JSON }} | tr '\n' ' ')
echo "BOARDS_LIST=$BOARDS_LIST" echo "BOARDS_LIST=$BOARDS_LIST"
echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_ENV echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_ENV
echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_OUTPUT echo "BOARDS_LIST=$BOARDS_LIST" >> $GITHUB_OUTPUT
@ -102,7 +105,7 @@ jobs:
- name: Upload Artifacts for Hardware Testing - name: Upload Artifacts for Hardware Testing
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: hil_pi4_esp name: hil_rpi_esp
path: | path: |
cmake-build/cmake-build-*/*/*/*.bin cmake-build/cmake-build-*/*/*/*.bin
cmake-build/cmake-build-*/*/*/bootloader/bootloader.bin cmake-build/cmake-build-*/*/*/bootloader/bootloader.bin
@ -112,14 +115,14 @@ jobs:
# --------------------------------------- # ---------------------------------------
# Hardware in the loop (HIL) # Hardware in the loop (HIL)
# Current self-hosted instance is running on an RPI4. For attached hardware checkout test/hil/pi4.json # self-hosted running on an RPI. For attached hardware checkout test/hil/rpi.json
# --------------------------------------- # ---------------------------------------
hil-pi4: hil-rpi:
if: github.repository_owner == 'hathach' if: github.repository_owner == 'hathach'
needs: needs:
- build - build
- build-esp - build-esp
runs-on: [self-hosted, rp2040, nrf52840, esp32s3, hardware-in-the-loop] runs-on: [self-hosted, ARM64, rpi, hardware-in-the-loop]
env: env:
BOARDS_LIST: "${{ needs.build.outputs.BOARDS_LIST }} ${{ needs.build-esp.outputs.BOARDS_LIST }}" BOARDS_LIST: "${{ needs.build.outputs.BOARDS_LIST }} ${{ needs.build-esp.outputs.BOARDS_LIST }}"
steps: steps:
@ -129,12 +132,12 @@ jobs:
rm -rf "${{ github.workspace }}" rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}" mkdir -p "${{ github.workspace }}"
# USB bus on rpi4 is not stable, reset it before testing # USB bus on rpi is not stable, reset it before testing
- name: Reset USB bus # - name: Reset USB bus
run: | # run: |
# reset VIA Labs 2.0 hub # # reset VIA Labs 2.0 hub
sudo usbreset 001/002 # sudo usbreset 001/002
lsusb -t # lsusb -t
- name: Checkout TinyUSB - name: Checkout TinyUSB
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -144,13 +147,13 @@ jobs:
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: hil_pi4 name: hil_rpi
path: cmake-build path: cmake-build
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: hil_pi4_esp name: hil_rpi_esp
path: cmake-build path: cmake-build
- name: Test on actual hardware - name: Test on actual hardware
@ -159,4 +162,4 @@ jobs:
echo "::group::{cmake-build contents}" echo "::group::{cmake-build contents}"
tree cmake-build tree cmake-build
echo "::endgroup::" echo "::endgroup::"
python3 test/hil/hil_test.py $BOARDS_LIST pi4.json python3 test/hil/hil_test.py $BOARDS_LIST ${{ env.HIL_JSON }}

View File

@ -330,7 +330,9 @@ def main():
config_file = args.config_file config_file = args.config_file
boards = args.board boards = args.board
config_file = os.path.join(os.path.dirname(__file__), config_file) # if config file is not found, try to find it in the same directory as this script
if not os.path.exists(config_file):
config_file = os.path.join(os.path.dirname(__file__), config_file)
with open(config_file) as f: with open(config_file) as f:
config = json.load(f) config = json.load(f)