Skip to content

Commit

Permalink
test: add gptimer tests
Browse files Browse the repository at this point in the history
currently only for esp32/s2/s3/c3
  • Loading branch information
urish committed Jul 4, 2024
1 parent d9fab0d commit 827e7c8
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,17 @@ jobs:
strategy:
matrix:
test_name:
- psram
- crypto
- adc
- crypto
- gptimer
- i2c
- nvs_flash
- pcnt
- wifi_function
- psram
- spi_master
- nvs_flash
- i2c
- uart
- timer
- uart
- wifi_function
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down
17 changes: 17 additions & 0 deletions test/gptimer/diagram.esp32.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": 1,
"author": "Uri Shaked",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-devkit-c-v4",
"id": "esp",
"top": 0,
"left": 0,
"attrs": { "cpuFrequency": "16" }
}
],
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
"serialMonitor": { "display": "terminal" },
"dependencies": {}
}
16 changes: 16 additions & 0 deletions test/gptimer/diagram.esp32c3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": 1,
"author": "Uri Shaked",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-c3-devkitm-1",
"id": "esp",
"top": -0.3,
"left": -42.18,
"attrs": { "cpuFrequency": "16" }
}
],
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
"dependencies": {}
}
16 changes: 16 additions & 0 deletions test/gptimer/diagram.esp32s2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": 1,
"author": "Uri Shaked",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-s2-devkitm-1",
"id": "esp",
"top": -13.91,
"left": 4.57,
"attrs": { "cpuFrequency": "16" }
}
],
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
"dependencies": {}
}
16 changes: 16 additions & 0 deletions test/gptimer/diagram.esp32s3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": 1,
"author": "Uri Shaked",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-s3-devkitc-1",
"id": "esp",
"top": -0.18,
"left": 4.57,
"attrs": { "cpuFrequency": "16" }
}
],
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
"dependencies": {}
}
23 changes: 23 additions & 0 deletions test/test_gptimer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import subprocess

import pytest


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

# Run the Wokwi CLI
result = subprocess.run(
[
"wokwi-cli",
"--elf",
f"../bin/{chip}/idf/latest/components/esp_driver_gptimer/test_apps/gptimer/firmware.uf2",
"--timeout",
"20000",
"--scenario",
"test_gptimer.scenario.yaml",
"--diagram-file",
f"gptimer/diagram.{chip}.json",
]
)
assert result.returncode == 0
8 changes: 8 additions & 0 deletions test/test_gptimer.scenario.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: GPTimer 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 827e7c8

Please sign in to comment.