esp-idf/examples/system/flash_suspend/pytest_flash_suspend.py
Omar Chebib 79598b1db7 Flash: fix flash_suspend example to include worst case
flash_suspend example will now test the worst case in order to be able
to detect real regression:
- shorter response time is acceptable, as the tested function may be in the cache already
- response time longer than 120us will be considered a potential regression
2022-09-15 14:37:59 +08:00

22 lines
774 B
Python

# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded.dut import Dut
@pytest.mark.esp32c3
@pytest.mark.flash_suspend
@pytest.mark.parametrize('config', [
'flash_suspend',
], indirect=True)
def test_flash_suspend_example(dut: Dut) -> None:
dut.expect_exact('found partition')
res = dut.expect(r'During Erase, ISR callback function\(in flash\) response time:\s+(\d+(\.\d{1,2})) us')
response_time = res.group(1).decode('utf8')
assert 0 <= float(response_time) < 120
res = dut.expect(r'During Erase, ISR callback function\(in iram\) response time:\s+(\d+(\.\d{1,2})) us')
response_time = res.group(1).decode('utf8')
assert 0 <= float(response_time) < 5