Skip to content

test(ci): added separate qemu_output.log file #5

test(ci): added separate qemu_output.log file

test(ci): added separate qemu_output.log file #5

name: TFLMWrapper ESP32 Integration Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO packages
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-platformio-
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install platformio
sudo apt-get update
sudo apt-get install -y wget xz-utils libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0
- name: Install ESP32 toolchain
run: |
platformio platform install espressif32
platformio platform install native
- name: Set up QEMU for ESP32-S3
run: |
wget https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz
tar xf qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz
sudo mv qemu/bin/qemu-system-xtensa /usr/local/bin/
sudo chmod +x /usr/local/bin/qemu-system-xtensa
- name: Build tests
run: |
# First just build the test firmware
platformio test --without-uploading --without-testing -e esp32-s3-devkitc-1-qemu
- name: Run tests with QEMU
run: |
# Create an empty flash file
dd if=/dev/zero of=flash.bin bs=1M count=4
# Create output file
touch test_output.log
# Run QEMU directly with the test firmware
timeout 300 qemu-system-xtensa \
-machine esp32s3 \
-nographic \
-drive file=flash.bin,if=mtd,format=raw \
-global driver=timer.esp32.timg,property=wdt_disable,value=true \
-kernel .pio/build/esp32-s3-devkitc-1/firmware.elf \
-serial file:test_output.log \
2>&1 | tee qemu_output.log &
# Give QEMU some time to run the tests
sleep 30
# Check test results
if grep -q "PASSED" test_output.log; then
echo "Tests passed successfully!"
exit 0
else
echo "Tests failed or didn't complete!"
cat test_output.log
cat qemu_output.log
exit 1
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
test_output.log
qemu_output.log
.pio/build/esp32-s3-devkitc-1/firmware.elf