From 7443501378e2678c444b24fd293c874f4a3f6d8b Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Thu, 18 Sep 2025 11:37:37 +0200 Subject: [PATCH 1/6] 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/6] 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/6] 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 16a88ef34a1069e4b922ab8db581a0ca445e6390 Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Wed, 24 Sep 2025 09:23:16 +0200 Subject: [PATCH 4/6] 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 920eb897a53ce190fc9c3398fe805f4f233c9a4f Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Wed, 24 Sep 2025 09:32:35 +0200 Subject: [PATCH 5/6] 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' }} From 3eab8d7926be6094e14011e308b02ce83052630f Mon Sep 17 00:00:00 2001 From: Jakub Andrysek Date: Wed, 24 Sep 2025 11:32:26 +0200 Subject: [PATCH 6/6] change(tests): Add comment for CI testing purposes in Arduino.h --- cores/esp32/Arduino.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/esp32/Arduino.h b/cores/esp32/Arduino.h index 5a5b0c6814c..04ef7681ca0 100644 --- a/cores/esp32/Arduino.h +++ b/cores/esp32/Arduino.h @@ -17,6 +17,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +// small random change to test CI + #ifndef Arduino_h #define Arduino_h