From 7443501378e2678c444b24fd293c874f4a3f6d8b Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Thu, 18 Sep 2025 11:37:37 +0200 Subject: [PATCH 1/5] change(requirements): Update pytest-embedded packages to version 2.0.0a1 and esptool to 5.1.0 --- tests/requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index b2bae3b86d0..2baec3c5729 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,8 +1,8 @@ cryptography==44.0.1 --only-binary cryptography pytest-cov==5.0.0 -pytest-embedded-serial-esp==1.12.0 -pytest-embedded-arduino==1.12.0 -pytest-embedded-wokwi==1.12.0 -pytest-embedded-qemu==1.12.0 -esptool==4.8.1 +pytest-embedded-serial-esp==2.0.0a1 +pytest-embedded-arduino==2.0.0a1 +pytest-embedded-wokwi==2.0.0a1 +pytest-embedded-qemu==2.0.0a1 +esptool==5.1.0 From 349922cecd290311cf81ed76bb767e1eac442133 Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Thu, 18 Sep 2025 11:38:06 +0200 Subject: [PATCH 2/5] change(workflow): Remove extra index URL from pip install command in Wokwi tests - for testing --- .github/workflows/tests_wokwi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_wokwi.yml b/.github/workflows/tests_wokwi.yml index cfea30a501d..0879e536ca5 100644 --- a/.github/workflows/tests_wokwi.yml +++ b/.github/workflows/tests_wokwi.yml @@ -269,7 +269,7 @@ jobs: if: ${{ steps.check-tests.outputs.enabled == 'true' }} run: | pip install -U pip - pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi + pip install -r tests/requirements.txt - name: Install Wokwi CLI if: ${{ steps.check-tests.outputs.enabled == 'true' }} From 299d8b865bfa0bf8b8ac69a1cd85fd131e5ab72a Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Thu, 18 Sep 2025 11:51:45 +0200 Subject: [PATCH 3/5] change(tests): Simplify Wokwi test script arguments and remove timeout variable --- .github/scripts/tests_run.sh | 7 +------ .github/workflows/tests_wokwi.yml | 9 +-------- docs/en/contributing.rst | 5 ++--- tests/validation/gpio/test_gpio.py | 17 +++++++++-------- 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/scripts/tests_run.sh b/.github/scripts/tests_run.sh index c85db2e984a..26ec1a10d43 100755 --- a/.github/scripts/tests_run.sh +++ b/.github/scripts/tests_run.sh @@ -88,10 +88,7 @@ function run_test { fi if [ $platform == "wokwi" ]; then - extra_args=("--target" "$target" "--embedded-services" "arduino,wokwi" "--wokwi-timeout=$wokwi_timeout") - if [[ -f "$sketchdir/scenario.yaml" ]]; then - extra_args+=("--wokwi-scenario" "$sketchdir/scenario.yaml") - fi + extra_args=("--target" "$target" "--embedded-services" "arduino,wokwi") if [[ -f "$sketchdir/diagram.$target.json" ]]; then extra_args+=("--wokwi-diagram" "$sketchdir/diagram.$target.json") fi @@ -137,7 +134,6 @@ SCRIPTS_DIR="./.github/scripts" COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count" platform="hardware" -wokwi_timeout=60000 chunk_run=0 options=0 erase=0 @@ -156,7 +152,6 @@ while [ -n "$1" ]; do ;; -W ) shift - wokwi_timeout=$1 if [[ -z $WOKWI_CLI_TOKEN ]]; then echo "Wokwi CLI token is not set" exit 1 diff --git a/.github/workflows/tests_wokwi.yml b/.github/workflows/tests_wokwi.yml index 0879e536ca5..d12579c68ca 100644 --- a/.github/workflows/tests_wokwi.yml +++ b/.github/workflows/tests_wokwi.yml @@ -10,9 +10,6 @@ on: permissions: contents: read -env: - WOKWI_TIMEOUT: 600000 # Milliseconds - jobs: get-artifacts: name: Get required artifacts @@ -271,10 +268,6 @@ jobs: pip install -U pip pip install -r tests/requirements.txt - - name: Install Wokwi CLI - if: ${{ steps.check-tests.outputs.enabled == 'true' }} - run: curl -L https://wokwi.com/ci/install.sh | sh - - name: Wokwi CI Server if: ${{ steps.check-tests.outputs.enabled == 'true' }} uses: wokwi/wokwi-ci-server-action@a6fabb5a49e080158c7a1d121ea5b789536a82c3 # v1 @@ -294,7 +287,7 @@ jobs: env: WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }} run: | - bash .github/scripts/tests_run.sh -c -type ${{ matrix.type }} -t ${{ matrix.chip }} -i 0 -m 1 -W ${{ env.WOKWI_TIMEOUT }} + bash .github/scripts/tests_run.sh -c -type ${{ matrix.type }} -t ${{ matrix.chip }} -i 0 -m 1 -W - name: Upload ${{ matrix.chip }} ${{ matrix.type }} Wokwi results as cache uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 diff --git a/docs/en/contributing.rst b/docs/en/contributing.rst index ae07bb57706..0a2ff38b95f 100644 --- a/docs/en/contributing.rst +++ b/docs/en/contributing.rst @@ -365,7 +365,7 @@ After the test is finished, you can check the output in the terminal and the gen Additionally, for performance tests, you can check the generated JSON file in the same folder. You can also run the tests in `Wokwi `_ or `Espressif's QEMU `_ -by using the ``-W `` and ``-Q`` flags respectively. You will need to have the Wokwi and/or QEMU installed in your system +by using the ``-W`` and ``-Q`` flags respectively. You will need to have the Wokwi and/or QEMU installed in your system and set the ``WOKWI_CLI_TOKEN`` and/or ``QEMU_PATH`` environment variables. The ``WOKWI_CLI_TOKEN`` is the CI token that can be obtained from the `Wokwi website `_ and the ``QEMU_PATH`` is the path to the QEMU binary. @@ -373,7 +373,7 @@ For example, to run the ``uart`` test using Wokwi, you would run: .. code-block:: bash - WOKWI_CLI_TOKEN= ./.github/scripts/tests_run.sh -s uart -t esp32c3 -W + WOKWI_CLI_TOKEN= ./.github/scripts/tests_run.sh -s uart -t esp32c3 -W And to run the ``uart`` test using QEMU, you would run: @@ -398,7 +398,6 @@ A test suite contains the following files: * ``.ino``: The sketch that will be tested. Required. * ``ci.json``: The file that specifies how the test suite will be run in the CI system. Optional. * ``diagram..json``: The diagram file that specifies the connections between the components in Wokwi. Optional. -* ``scenario.yaml``: The scenario file that specifies how Wokwi will interact with the components. Optional. * Any other files that are needed for the test suite. You can read more about the test python API in the `pytest-embedded documentation `_. diff --git a/tests/validation/gpio/test_gpio.py b/tests/validation/gpio/test_gpio.py index 8aa3a42dcc6..42010ab520b 100644 --- a/tests/validation/gpio/test_gpio.py +++ b/tests/validation/gpio/test_gpio.py @@ -1,16 +1,17 @@ import logging +from pytest_embedded_wokwi import Wokwi +from pytest_embedded import Dut -def test_gpio(dut): +def test_gpio(dut: Dut, wokwi: Wokwi): LOGGER = logging.getLogger(__name__) + LOGGER.info("Waiting for Button test begin...") dut.expect_exact("Button test") - LOGGER.info("Expecting button press 1") - dut.expect_exact("Button pressed 1 times") + for i in range(3): + LOGGER.info(f"Setting button pressed for {i + 1} seconds") + wokwi.client.set_control("btn1", "pressed", 1) - LOGGER.info("Expecting button press 2") - dut.expect_exact("Button pressed 2 times") - - LOGGER.info("Expecting button press 3") - dut.expect_exact("Button pressed 3 times") + dut.expect_exact(f"Button pressed {i + 1} times") + wokwi.client.set_control("btn1", "pressed", 0) From eff83798571a38f8740a6885bc8e9548453a8d3f Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Wed, 24 Sep 2025 09:23:16 +0200 Subject: [PATCH 4/5] change(requirements): Update pytest-embedded packages to version 2.0.0 --- tests/requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 2baec3c5729..001b26855a9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,8 +1,8 @@ cryptography==44.0.1 --only-binary cryptography pytest-cov==5.0.0 -pytest-embedded-serial-esp==2.0.0a1 -pytest-embedded-arduino==2.0.0a1 -pytest-embedded-wokwi==2.0.0a1 -pytest-embedded-qemu==2.0.0a1 +pytest-embedded-serial-esp==2.0.0 +pytest-embedded-arduino==2.0.0 +pytest-embedded-wokwi==2.0.0 +pytest-embedded-qemu==2.0.0 esptool==5.1.0 From 237406e66965e815177bbb2a2b19de3aea3444d6 Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Wed, 24 Sep 2025 09:32:35 +0200 Subject: [PATCH 5/5] Revert "change(workflow): Remove extra index URL from pip install command in Wokwi tests - for testing" This reverts commit 349922cecd290311cf81ed76bb767e1eac442133. --- .github/workflows/tests_wokwi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_wokwi.yml b/.github/workflows/tests_wokwi.yml index d12579c68ca..3038a7ce59c 100644 --- a/.github/workflows/tests_wokwi.yml +++ b/.github/workflows/tests_wokwi.yml @@ -266,7 +266,7 @@ jobs: if: ${{ steps.check-tests.outputs.enabled == 'true' }} run: | pip install -U pip - pip install -r tests/requirements.txt + pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi - name: Wokwi CI Server if: ${{ steps.check-tests.outputs.enabled == 'true' }}