Skip to content

Commit

Permalink
test: wifi_function tests
Browse files Browse the repository at this point in the history
  • Loading branch information
urish committed Jun 14, 2024
1 parent 117ae61 commit 2f362b1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,27 @@ jobs:
run: pytest test_pcnt.py
env:
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}

test-wifi-function:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- run: pip install -r test/requirements.txt

- name: Run a Wokwi CI server
uses: wokwi/wokwi-ci-server-action@v1

- name: Install Wokwi CLI
run: curl -L https://wokwi.com/ci/install.sh | sh

- name: Test on Wokwi
working-directory: test
run: pytest test_wifi_function.py
env:
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
24 changes: 24 additions & 0 deletions test/test_wifi_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import subprocess

import pytest


@pytest.mark.parametrize("chip", ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c6"])
def test_hello_world(chip: str):

# Run the Wokwi CLI
result = subprocess.run(
[
"wokwi-cli",
"--elf",
f"../bin/{chip}/idf/latest/components/esp_wifi/test_apps/wifi_function/firmware.uf2",
"--timeout",
"5000",
"--scenario",
"test_wifi_function.scenario.yaml",
"--diagram-file",
f"diagram.{chip}.json",
]
)
assert result.returncode == 0
8 changes: 8 additions & 0 deletions test/test_wifi_function.scenario.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: WiFi Function unity tests
version: 1
author: Uri Shaked

steps:
- wait-serial: 'Press ENTER to see the list of tests'
- write-serial: "*\n"
- wait-serial: ' Tests 0 Failures 0 Ignored'

0 comments on commit 2f362b1

Please sign in to comment.