mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
feat(test_build_system): add --buildv2 pytest option and buildv2 test app
The IDF build system v2 should be backward compatible with IDF build system v1 in most situations. Therefore, it makes sense to reuse the existing v1 tests and run them for v2 as well. This approach will help ensure that v2 maintains backward compatibility. Introduce a new --buildv2 option, which switches the existing tests to use the newly added buildv2_test_app for v2. The goal is to enable the existing v1 tests incrementally in CI as the v2 implementation progresses. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
# placeholder_before_include_project_cmake
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmakev2/idf.cmake)
|
||||
|
||||
# placeholder_after_include_project_cmake
|
||||
|
||||
# FIXME: Replace the following with idf_project_default when it becomes
|
||||
# available.
|
||||
project(buildv2_test_app C CXX ASM)
|
||||
|
||||
__generate_project_info()
|
||||
@@ -0,0 +1 @@
|
||||
Information about this test app can be found [here](../README.md#application-under-test).
|
||||
@@ -0,0 +1,5 @@
|
||||
# placeholder_before_idf_component_register
|
||||
|
||||
idf_component_register(SRCS "buildv2_test_app.c"
|
||||
# placeholder_inside_idf_component_register
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
# Misspelled Kconfig file checks whether it is picked up by the build system
|
||||
config FROM_MISSPELLED_KCONFIG
|
||||
bool "From misspelled Kconfig"
|
||||
default y
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
// placeholder_before_main
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
// placeholder_inside_main
|
||||
}
|
||||
@@ -44,6 +44,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
|
||||
'--cleanup-idf-copy', action='store_true',
|
||||
help='Always clean up the IDF copy after the test. By default, the copy is cleaned up only if the test passes.'
|
||||
)
|
||||
parser.addoption(
|
||||
'--buildv2',
|
||||
action='store_true',
|
||||
help='Use the IDF build system v2 project for testing.',
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
@@ -94,7 +99,10 @@ def work_dir(request: FixtureRequest, _session_work_dir: typing.Tuple[Path, bool
|
||||
def test_app_copy(func_work_dir: Path, request: FixtureRequest) -> typing.Generator[Path, None, None]:
|
||||
# by default, use hello_world app and copy it to a temporary directory with
|
||||
# the name resembling that of the test
|
||||
copy_from = 'tools/test_build_system/build_test_app'
|
||||
if request.config.getoption('buildv2', False):
|
||||
copy_from = 'tools/test_build_system/buildv2_test_app'
|
||||
else:
|
||||
copy_from = 'tools/test_build_system/build_test_app'
|
||||
# sanitize test name in case pytest.mark.parametrize was used
|
||||
test_name_sanitized = request.node.name.replace('[', '_').replace(']', '')
|
||||
copy_to = test_name_sanitized + '_app'
|
||||
|
||||
Reference in New Issue
Block a user