mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
test(cmakev2): Enable test_rebuild.py for buildv2 CI tests
The test_rebuild_no_changes test verifies that running idf.py build successively without any file changes results in identical build artifacts on the second run (i.e., nothing gets rebuilt). This test was failing in buildv2 because it expected kconfig_menus.json to be present in build/config/ after a normal build. However, in cmakev2, kconfig_menus.json is not generated during regular builds. In cmakev1, kconfig_menus.json was generated globally during every build alongside other config files (sdkconfig.h, sdkconfig.cmake, etc). In cmakev2, kconfig_menus.json generation does not happend for normal builds because it depends on the Kconfig menu hierarchy and cannot be generated globally. It must be generated per-executable. Hence, this commit updates the artefacts list for cmakev2 to not expect the kconfig_menus.json file during a build/re-build action.
This commit is contained in:
@@ -287,6 +287,7 @@ pytest_buildv2_system:
|
|||||||
test_components.py
|
test_components.py
|
||||||
test_cmake.py
|
test_cmake.py
|
||||||
test_idf_extension.py
|
test_idf_extension.py
|
||||||
|
test_rebuild.py
|
||||||
|
|
||||||
pytest_build_system_macos:
|
pytest_build_system_macos:
|
||||||
extends:
|
extends:
|
||||||
|
|||||||
@@ -179,3 +179,4 @@ pytest_buildv2_system_win:
|
|||||||
test_components.py
|
test_components.py
|
||||||
test_cmake.py
|
test_cmake.py
|
||||||
test_idf_extension.py
|
test_idf_extension.py
|
||||||
|
test_rebuild.py
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
from .build_constants import ALL_ARTIFACTS
|
from .build_constants import ALL_ARTIFACTS
|
||||||
|
from .build_constants import ALL_ARTIFACTS_BUILDV1
|
||||||
|
from .build_constants import ALL_ARTIFACTS_BUILDV2
|
||||||
from .build_constants import APP_BINS
|
from .build_constants import APP_BINS
|
||||||
from .build_constants import BOOTLOADER_BINS
|
from .build_constants import BOOTLOADER_BINS
|
||||||
from .build_constants import JSON_METADATA
|
from .build_constants import JSON_METADATA
|
||||||
@@ -10,21 +12,38 @@ from .file_utils import bin_file_contains
|
|||||||
from .file_utils import bin_files_differ
|
from .file_utils import bin_files_differ
|
||||||
from .file_utils import file_contains
|
from .file_utils import file_contains
|
||||||
from .file_utils import replace_in_file
|
from .file_utils import replace_in_file
|
||||||
from .idf_utils import EnvDict
|
|
||||||
from .idf_utils import EXT_IDF_PATH
|
from .idf_utils import EXT_IDF_PATH
|
||||||
|
from .idf_utils import EnvDict
|
||||||
|
from .idf_utils import IdfPyFunc
|
||||||
from .idf_utils import find_python
|
from .idf_utils import find_python
|
||||||
from .idf_utils import get_idf_build_env
|
from .idf_utils import get_idf_build_env
|
||||||
from .idf_utils import IdfPyFunc
|
|
||||||
from .idf_utils import run_cmake
|
from .idf_utils import run_cmake
|
||||||
from .idf_utils import run_cmake_and_build
|
from .idf_utils import run_cmake_and_build
|
||||||
from .idf_utils import run_idf_py
|
from .idf_utils import run_idf_py
|
||||||
from .snapshot import get_snapshot
|
|
||||||
from .snapshot import Snapshot
|
from .snapshot import Snapshot
|
||||||
|
from .snapshot import get_snapshot
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'append_to_file', 'replace_in_file',
|
'append_to_file',
|
||||||
'get_idf_build_env', 'run_idf_py', 'EXT_IDF_PATH', 'EnvDict', 'IdfPyFunc',
|
'replace_in_file',
|
||||||
'Snapshot', 'get_snapshot', 'run_cmake', 'APP_BINS', 'BOOTLOADER_BINS',
|
'get_idf_build_env',
|
||||||
'PARTITION_BIN', 'JSON_METADATA', 'ALL_ARTIFACTS',
|
'run_idf_py',
|
||||||
'run_cmake_and_build', 'find_python', 'file_contains', 'bin_file_contains', 'bin_files_differ'
|
'EXT_IDF_PATH',
|
||||||
|
'EnvDict',
|
||||||
|
'IdfPyFunc',
|
||||||
|
'Snapshot',
|
||||||
|
'get_snapshot',
|
||||||
|
'run_cmake',
|
||||||
|
'APP_BINS',
|
||||||
|
'BOOTLOADER_BINS',
|
||||||
|
'PARTITION_BIN',
|
||||||
|
'JSON_METADATA',
|
||||||
|
'ALL_ARTIFACTS',
|
||||||
|
'ALL_ARTIFACTS_BUILDV1',
|
||||||
|
'ALL_ARTIFACTS_BUILDV2',
|
||||||
|
'run_cmake_and_build',
|
||||||
|
'find_python',
|
||||||
|
'file_contains',
|
||||||
|
'bin_file_contains',
|
||||||
|
'bin_files_differ',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
BOOTLOADER_BINS = ['build/bootloader/bootloader.elf', 'build/bootloader/bootloader.bin']
|
BOOTLOADER_BINS = ['build/bootloader/bootloader.elf', 'build/bootloader/bootloader.bin']
|
||||||
APP_BINS = ['build/build_test_app.elf', 'build/build_test_app.bin']
|
APP_BINS = ['build/build_test_app.elf', 'build/build_test_app.bin']
|
||||||
PARTITION_BIN = ['build/partition_table/partition-table.bin']
|
PARTITION_BIN = ['build/partition_table/partition-table.bin']
|
||||||
JSON_METADATA = ['build/project_description.json', 'build/flasher_args.json', 'build/config/kconfig_menus.json', 'build/config/sdkconfig.json']
|
JSON_METADATA = ['build/project_description.json', 'build/flasher_args.json', 'build/config/sdkconfig.json']
|
||||||
ALL_ARTIFACTS = [
|
|
||||||
*BOOTLOADER_BINS,
|
# kconfig_menus.json is only generated during build in cmakev1.
|
||||||
*APP_BINS,
|
KCONFIG_MENUS_JSON = ['build/config/kconfig_menus.json']
|
||||||
*PARTITION_BIN,
|
|
||||||
*JSON_METADATA
|
# Build system v1 artifacts
|
||||||
]
|
ALL_ARTIFACTS_BUILDV1 = [*BOOTLOADER_BINS, *APP_BINS, *PARTITION_BIN, *JSON_METADATA, *KCONFIG_MENUS_JSON]
|
||||||
|
|
||||||
|
# Build system v2 artifacts
|
||||||
|
ALL_ARTIFACTS_BUILDV2 = [*BOOTLOADER_BINS, *APP_BINS, *PARTITION_BIN, *JSON_METADATA]
|
||||||
|
|
||||||
|
# Default artifacts for tests that don't specify build version
|
||||||
|
ALL_ARTIFACTS = ALL_ARTIFACTS_BUILDV1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# These tests check whether the build system rebuilds some files or not
|
# These tests check whether the build system rebuilds some files or not
|
||||||
# depending on the changes to the project.
|
# depending on the changes to the project.
|
||||||
@@ -7,7 +7,8 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from test_build_system_helpers import ALL_ARTIFACTS
|
from test_build_system_helpers import ALL_ARTIFACTS_BUILDV1
|
||||||
|
from test_build_system_helpers import ALL_ARTIFACTS_BUILDV2
|
||||||
from test_build_system_helpers import APP_BINS
|
from test_build_system_helpers import APP_BINS
|
||||||
from test_build_system_helpers import BOOTLOADER_BINS
|
from test_build_system_helpers import BOOTLOADER_BINS
|
||||||
from test_build_system_helpers import PARTITION_BIN
|
from test_build_system_helpers import PARTITION_BIN
|
||||||
@@ -17,7 +18,7 @@ from test_build_system_helpers import replace_in_file
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures('test_app_copy')
|
@pytest.mark.usefixtures('test_app_copy')
|
||||||
def test_rebuild_no_changes(idf_py: IdfPyFunc) -> None:
|
def test_rebuild_no_changes(idf_py: IdfPyFunc, request: pytest.FixtureRequest) -> None:
|
||||||
logging.info('initial build')
|
logging.info('initial build')
|
||||||
idf_py('build')
|
idf_py('build')
|
||||||
logging.info('get the first snapshot')
|
logging.info('get the first snapshot')
|
||||||
@@ -32,7 +33,8 @@ def test_rebuild_no_changes(idf_py: IdfPyFunc) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
logging.info('check that all build artifacts were generated')
|
logging.info('check that all build artifacts were generated')
|
||||||
for artifact in ALL_ARTIFACTS:
|
all_artifacts = ALL_ARTIFACTS_BUILDV2 if request.config.getoption('buildv2', False) else ALL_ARTIFACTS_BUILDV1
|
||||||
|
for artifact in all_artifacts:
|
||||||
assert Path(artifact).exists()
|
assert Path(artifact).exists()
|
||||||
|
|
||||||
logging.info('build again with no changes')
|
logging.info('build again with no changes')
|
||||||
|
|||||||
Reference in New Issue
Block a user