forked from espressif/arduino-esp32
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtest_periman.py
42 lines (34 loc) · 1.19 KB
/
test_periman.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import logging
def test_periman(dut):
LOGGER = logging.getLogger(__name__)
peripherals = [
"GPIO",
"SigmaDelta",
"LEDC",
"RMT",
"I2S",
"I2C",
"SPI",
"ADC_Oneshot",
"ADC_Continuous",
"DAC",
"Touch",
]
pattern = rb"(?:\b\w+\b test: This should(?: not)? be printed|Peripheral Manager test done)"
while True:
try:
res = dut.expect(pattern, timeout=10)
except Exception as e: # noqa: F841
assert False, "Could not detect end of test"
console_output = res.group(0).decode("utf-8")
peripheral = console_output.split()[0]
if "Peripheral Manager test done" in console_output:
break
if peripheral in peripherals:
if "not" in console_output:
assert False, f"Output printed when it should not after peripheral {peripheral}"
LOGGER.info(f"Correct output after peripheral: {peripheral}")
peripherals.remove(peripheral)
else:
assert False, f"Unknown peripheral: {peripheral}"
assert peripherals == [], f"Missing output after peripherals: {peripherals}"