Skip to content

Commit 827e7c8

Browse files
committed
test: add gptimer tests
currently only for esp32/s2/s3/c3
1 parent d9fab0d commit 827e7c8

File tree

7 files changed

+103
-6
lines changed

7 files changed

+103
-6
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,17 @@ jobs:
5353
strategy:
5454
matrix:
5555
test_name:
56-
- psram
57-
- crypto
5856
- adc
57+
- crypto
58+
- gptimer
59+
- i2c
60+
- nvs_flash
5961
- pcnt
60-
- wifi_function
62+
- psram
6163
- spi_master
62-
- nvs_flash
63-
- i2c
64-
- uart
6564
- timer
65+
- uart
66+
- wifi_function
6667
fail-fast: false
6768
steps:
6869
- uses: actions/checkout@v4

test/gptimer/diagram.esp32.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": 1,
3+
"author": "Uri Shaked",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-devkit-c-v4",
8+
"id": "esp",
9+
"top": 0,
10+
"left": 0,
11+
"attrs": { "cpuFrequency": "16" }
12+
}
13+
],
14+
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
15+
"serialMonitor": { "display": "terminal" },
16+
"dependencies": {}
17+
}

test/gptimer/diagram.esp32c3.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": 1,
3+
"author": "Uri Shaked",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-c3-devkitm-1",
8+
"id": "esp",
9+
"top": -0.3,
10+
"left": -42.18,
11+
"attrs": { "cpuFrequency": "16" }
12+
}
13+
],
14+
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
15+
"dependencies": {}
16+
}

test/gptimer/diagram.esp32s2.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": 1,
3+
"author": "Uri Shaked",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-s2-devkitm-1",
8+
"id": "esp",
9+
"top": -13.91,
10+
"left": 4.57,
11+
"attrs": { "cpuFrequency": "16" }
12+
}
13+
],
14+
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
15+
"dependencies": {}
16+
}

test/gptimer/diagram.esp32s3.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": 1,
3+
"author": "Uri Shaked",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-s3-devkitc-1",
8+
"id": "esp",
9+
"top": -0.18,
10+
"left": 4.57,
11+
"attrs": { "cpuFrequency": "16" }
12+
}
13+
],
14+
"connections": [ [ "esp:TX", "$serialMonitor:RX", "", [] ], [ "esp:RX", "$serialMonitor:TX", "", [] ] ],
15+
"dependencies": {}
16+
}

test/test_gptimer.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import subprocess
2+
3+
import pytest
4+
5+
6+
@pytest.mark.parametrize("chip", ["esp32", "esp32s2", "esp32s3", "esp32c3"])
7+
def test_gptimer(chip: str):
8+
9+
# Run the Wokwi CLI
10+
result = subprocess.run(
11+
[
12+
"wokwi-cli",
13+
"--elf",
14+
f"../bin/{chip}/idf/latest/components/esp_driver_gptimer/test_apps/gptimer/firmware.uf2",
15+
"--timeout",
16+
"20000",
17+
"--scenario",
18+
"test_gptimer.scenario.yaml",
19+
"--diagram-file",
20+
f"gptimer/diagram.{chip}.json",
21+
]
22+
)
23+
assert result.returncode == 0

test/test_gptimer.scenario.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: GPTimer Unity Tests
2+
version: 1
3+
author: Uri Shaked
4+
5+
steps:
6+
- wait-serial: 'Press ENTER to see the list of tests'
7+
- write-serial: "*\n"
8+
- wait-serial: ' Tests 0 Failures 0 Ignored'

0 commit comments

Comments
 (0)