esp-idf/components/wear_levelling/test_apps/component_ut_test.py
Ivan Grokhotkov 5962a7e931 wear_levelling: move tests from unit-test-app to a component test app
* Migrate test cases from IDF test runner to Unity fixture.
* Tighten heap checks in the test case a bit.
* Run formatting script on test_wl.c
* NEW: Define 4 test configurations, including configs with 512 byte
  sector size. Previously these configs weren't tested in CI.
* NEW: The test app only runs for ESP32 and ESP32-C3 (one chip for
  each architecture). The component is pretty high level so we don't
  need to test it for each chip. This reduces the load on CI.
2021-11-03 09:56:20 +01:00

29 lines
1.1 KiB
Python

# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import glob
import os
import ttfw_idf
from tiny_test_fw import Utility
@ttfw_idf.idf_component_unit_test(env_tag='COMPONENT_UT_GENERIC', target=['esp32', 'esp32c3'])
def test_component_ut_wear_levelling(env, _): # type: (ttfw_idf.TinyFW.Env, None) -> None
# Get the names of all configs (sdkconfig.ci.* files)
config_files = glob.glob(os.path.join(os.path.dirname(__file__), 'sdkconfig.ci.*'))
config_names = [os.path.basename(s).replace('sdkconfig.ci.', '') for s in config_files]
# Run test once with binaries built for each config
for name in config_names:
Utility.console_log("Checking config \"{}\"... ".format(name), end='')
dut = env.get_dut('wear_levelling', 'components/wear_levelling/test_apps', app_config_name=name)
dut.start_app()
stdout = dut.expect('Tests finished', full_stdout=True, timeout=30)
ttfw_idf.ComponentUTResult.parse_result(stdout)
env.close_dut(dut.name)
Utility.console_log('done')
if __name__ == '__main__':
test_component_ut_wear_levelling()