mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
add pytest for example deep sleep wake stub
This commit is contained in:
parent
24a38e3153
commit
4f5f235208
@ -0,0 +1,28 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytest_embedded import Dut
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.esp32s2
|
||||||
|
@pytest.mark.esp32s3
|
||||||
|
@pytest.mark.esp32c3
|
||||||
|
@pytest.mark.generic
|
||||||
|
@pytest.mark.parametrize('config', ['default',], indirect=True)
|
||||||
|
def test_deep_sleep_wake_stub(config: str, dut: Dut) -> None:
|
||||||
|
if config == 'default':
|
||||||
|
dut.expect_exact('Enabling timer wakeup, 10s', timeout=10)
|
||||||
|
dut.expect_exact('Entering deep sleep', timeout=10)
|
||||||
|
|
||||||
|
start_sleep = time.time()
|
||||||
|
logging.info('Waiting for wakeup...')
|
||||||
|
dut.expect_exact('wake stub: going to deep sleep')
|
||||||
|
|
||||||
|
sleep_time = time.time() - start_sleep
|
||||||
|
logging.info('Host measured sleep time at {:.2f}s'.format(sleep_time))
|
||||||
|
assert 8 < sleep_time < 12 # note: high tolerance as measuring time on the host may have some timing skew
|
Loading…
x
Reference in New Issue
Block a user