Commit Graph

154 Commits

Author SHA1 Message Date
Sudeep Mohanty
aa67c578fb test(cmakev2): Add pytest test for multi-binary build support
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
a1306a094c test(cmakev2): Add pytest tests for v1-to-v2 migration and utility APIs
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
d6b1fd56a4 test(cmakev2): Assert ELF output in Linux target build test
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
f00d5db927 test(cmakev2): Expand pytest tests for v2 Kconfig and sdkconfig behavior
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
3f477b9d80 test(cmakev2): Add pytest tests for v2 component model
Made-with: Cursor
2026-03-18 09:27:51 +01:00
Sudeep Mohanty
c2cba58409 test(cmakev2): Add pytest tests for build APIs
Made-with: Cursor
2026-03-18 09:25:12 +01:00
Sudeep Mohanty
4d15351959 Merge branch 'test/buildv2_pytest_project' into 'master'
test(cmakev2): Add pytest tests for project APIs

See merge request espressif/esp-idf!46286
2026-03-18 07:50:54 +01:00
Marius Vikhammer
4e000a41d5 docs(test_build_system): add supported targets table to kconfig_test_app README
The check-all-apps-readmes pre-commit hook detected that
kconfig_test_app/README.md was missing the supported targets table.
Added the full table including esp32h21, esp32h4, and esp32s31.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-18 10:40:13 +08:00
Jakub Kocka
31b36e4428 fix(ci): Fixed Tools related CI tests 2026-03-16 12:55:57 +01:00
Sudeep Mohanty
e53d8e9a74 test(cmakev2): Add pytest tests for project APIs 2026-03-16 10:57:26 +01:00
Jan Beran
a2277f14df ci(tools): Move misspelled KConfig test to dedicated kconfig_test_app
Separate the misspelled KConfig.projbuild test case into its own test app
so it doesn't interfere with the general-purpose build_test_app. The test
now uses a pytest marker to select kconfig_test_app as the source.
2026-03-16 08:57:40 +01:00
Jakub Kocka
7551e82048 ci(tools): Changed the approach of some build tests to cmake reconfigure
Where actually building the app is not needed cmake reconfigure was introduced instead.
This should be performance upgrade especially for Windows runners, where build is quite slow
2026-03-16 08:57:40 +01:00
Jakub Kocka
82cc3b55b6 ci(tools): Updated approach of copying files to using git worktree 2026-03-16 08:53:47 +01:00
Jakub Kocka
d860da47c0 ci(tools): Avoiding full rebuilds where not needed to improve performance 2026-03-16 08:53:41 +01:00
Sudeep Mohanty
e7848fc243 test(cmakev2): Add placeholder hooks to buildv2_test_app
Made-with: Cursor
2026-03-11 13:52:16 +01:00
Sudeep Mohanty
7f7f40404b Merge branch 'feat/buildv2_component_cb_framework' into 'master'
feat(cmakev2): Add build event callback framework for components

See merge request espressif/esp-idf!46018
2026-03-04 15:12:53 +01:00
Sudeep Mohanty
152ff182cc test(buildv2): enable test_cmake.py for cmakev2
Add buildv2 path and option handling for idf_as_lib, import_lib, and
related tests. Use cmakev2 examples when running with buildv2.
2026-02-27 12:56:38 +01:00
Sudeep Mohanty
873428d3a2 test(buildv2): skip test_post_elf_dependency for cmakev2
Post-ELF dependency API is not used in cmakev2; component callback method
replaces this. Skip the test when running buildv2.
2026-02-27 12:56:04 +01:00
Sudeep Mohanty
8fbf899d83 test(buildv2): skip test_spaces bundles not yet ported to buildv2 2026-02-27 12:54:16 +01:00
Sudeep Mohanty
ea4489d7c9 refactor(test_spaces): ruff formatting to test_spaces.py 2026-02-27 12:53:04 +01:00
Sudeep Mohanty
19040b761b test(cmakev2): add POST_ELF build event callback test 2026-02-24 15:17:08 +01:00
Roland Dobai
7a6405e824 Merge branch 'fix/cmakev2_ai_preserve_sdkconfig_managed_component_options' into 'master'
fix(cmakev2/kconfig): preserve sdkconfig options from managed components

Closes IDF-15347

See merge request espressif/esp-idf!45944
2026-02-24 10:46:22 +01:00
Roland Dobai
5410fc0d5c Merge branch 'feat/esp_idf_sbom' into 'master'
feat(tools): esp-idf-sbom integration into idf.py

Closes IDF-15120

See merge request espressif/esp-idf!45696
2026-02-20 10:18:47 +01:00
Sudeep Mohanty
c856426c30 test(cmakev2): Enable test_build_loadable_elf for buildv2
Remove the buildv2_skip marker from test_build_loadable_elf.
2026-02-18 11:07:46 +01:00
Frantisek Hrbata
7bc635bd9e fix(test_build_system): add __init__.py to buildv2 test directory
Pytest's default import mode (prepend/rootdir) imports test modules as
top-level modules keyed by filename. When two directories contain test
files with the same basename (e.g. test_sdkconfig.py in both
test_build_system/ and test_build_system/buildv2/), pytest tries to
register both as the module name "test_sdkconfig". The second collection
fails with "import file mismatch" because the module object already
cached in sys.modules points to the first file.

Adding __init__.py to the buildv2/ directory makes it a proper Python
package. Pytest then imports its test modules under the package
namespace (buildv2.test_sdkconfig), which is distinct from the
top-level test_sdkconfig, resolving the collision.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-02-18 17:29:18 +08:00
Frantisek Hrbata
0f349ee404 fix(cmakev2/kconfig): preserve sdkconfig options from managed components
The sdkconfig file may contain configuration options defined in Kconfig
files of managed components. Since kconfgen runs before the component
manager fetches these components, the Kconfig definitions for managed
component options are not yet available. The kconfgen --output config
flag regenerates sdkconfig from kconfiglib's internal state, which only
knows about options with loaded Kconfig definitions. This causes unknown
options (i.e., those from managed components) to be silently dropped
from sdkconfig during intermediate regeneration rounds.

Note that kconfgen's --config flag (used for reading sdkconfig) only
performs deprecated option name replacement and does NOT drop unknown
options. The problem is exclusively in --output config, which writes a
fresh sdkconfig from the parsed Kconfig tree state.

Fix this by introducing a __SDKCONFIG_ORIG build property that provides
an indirection layer for the --config input path:

- Before the component manager runs: __SDKCONFIG_ORIG points to a copy
  of the original sdkconfig (build/sdkconfig.orig), created by the new
  __create_sdkconfig_orig_copy() function. This copy preserves all
  original options, including those from managed components.

- During intermediate kconfgen runs: --config reads from the preserved
  copy (so unknown options survive as input), while --output config
  writes to the real sdkconfig (unknown options may be dropped there,
  but this is harmless since kconfgen always reads from the copy).

- After the component manager completes: __SDKCONFIG_ORIG is reset to
  point to the real sdkconfig and __BASE_KCONFGEN_CMD is rebuilt, so
  that subsequent operations (menuconfig, save-defconfig, confserver)
  read and write the actual sdkconfig file directly.

The flow is:

  __create_sdkconfig_orig_copy()
    -> __SDKCONFIG_ORIG = build/sdkconfig.orig

  __generate_sdkconfig()
    -> --config build/sdkconfig.orig --output config project/sdkconfig

  __fetch_components_from_registry():
    loop:
      download_components()
      __generate_sdkconfig()
        -> --config build/sdkconfig.orig --output config project/sdkconfig
      if success: break
    endloop
    -> __SDKCONFIG_ORIG = project/sdkconfig
    -> rebuild __BASE_KCONFGEN_CMD

  idf_create_menuconfig() / save-defconfig / confserver
    -> uses --config project/sdkconfig (the real file)

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-02-18 17:29:18 +08:00
Sudeep Mohanty
f3456ea214 fix(cmakev2): Fixed test_hint_components_loading for buildv2
The test_hint_components_loading fails for buildv2 because the build
system only links the main component but not the components with the
hints.yml. Updated the test to explicitly include the new components in
the build.
2026-02-17 16:51:07 +01:00
Sudeep Mohanty
13830bcaff fix(cmakev2): Skip test_minimal_build_without_main_component for cmakev2
Build System v2 does not support the MINIMAL_BUILD property hence the
test test_minimal_build_without_main_component is not applicable for
cmakev2.
2026-02-16 17:42:37 +01:00
Frantisek Hrbata
b90098a9f2 feat(tools): esp-idf-sbom integration into idf.py
While the `esp-idf-sbom` `idf.py` extension is implemented within the
`esp-idf-sbom` python package, a few minor changes are also required on
the `idf.py` side.

1. Add `esp-idf-sbom` as a core requirement so it is automatically
   installed by the installation scripts.
2. Add the `sbom-create` action to the list of actions for which the
   flashing-related closing message is displayed.
3. Update the documentation in the api-guides for tools.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-02-16 09:03:17 +01:00
Marek Fiala
c311fb0db3 test(tools): Added test for coponent hints loading 2026-02-13 15:59:31 +08:00
Frantisek Hrbata
795904a41c fix(build): ensure the main component exists when MINIMAL_BUILD is enabled
The minimal build property is simply a shorthand for `set(COMPONENTS
main)`. The issue is that there is currently no check to verify whether
the `main` component actually exists or is known to the build system.
If the `main` component is not present, print an error message along
with suggestions on how to fix this inconsistency.

Closes https://github.com/espressif/esp-idf/issues/18219

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-02-10 03:36:48 +08:00
Frantisek Hrbata
cc294eee2b feat(test_build_system): add buildv2 test for linux target build
Add a simple test to verify that the buildv2_test_app can be built for
the Linux target.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-01-22 18:00:37 +01:00
Frantisek Hrbata
6e5d6b75ae feat(test_build_system): allow buildv2 specific tests
Currently, cmakev2 is being tested only in backward-compatible mode by
using the existing cmakev1 tests with the cmakev2 test application. We
also need to add tests specific to cmakev2, and it is convenient to
reuse the existing build system testing framework. Let's add a `buildv2`
subdirectory to the existing `tools/test_build_system` directory and use
the `pytest_collection_modifyitems` hook to ignore tests in this
directory unless the `--buildv2` option is used.

Without the `--buildv2` option, only the existing cmakev1 tests are
executed and tests in `buildv2` directory are skipped. With the
`--buildv2` option, the existing cmakev1 tests run with the cmakev2
testing application for backward compatibility testing, and all cmakev2
tests within the `buildv2` subdirectory are also executed.

Note: we cannot use the `pytest_ignore_collect` hook, because the
`--buildv2` option is not known to the pytest, so the
`config.getoption('--buildv2', False)` returns always False. We would
likely need to add the `--buildv2` option in the conftest.py in the
esp-idf root directory.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>

fix: lsadjf las jflasjfl aslfsald asl fsadlf sladsal jfsadfas

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-01-22 15:41:05 +01:00
Frantisek Hrbata
d1270b62b8 feat(test_build_system): add pytest header whether buildv1 or buildv2 is running
This adds a clear header to the pytest output, indicating which build
system version is currently being tested.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-01-22 15:41:05 +01:00
Sudeep Mohanty
6a4d6eb6ac test(cmakev2): Enabled component validation tests for cmakev2 2025-12-18 13:54:18 +01:00
Sudeep Mohanty
cad80548b1 test(cmakev2): Enable test_build_uf2 for buildv2 CI tests 2025-11-18 15:08:56 +05:30
Sudeep Mohanty
a609d5bcd2 test(cmakev2): Enable test_build_dfu for buildv2 CI tests 2025-11-18 15:08:20 +05:30
Sudeep Mohanty
f72292b0d7 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.
2025-11-18 10:12:12 +05:30
Alexey Lapshin
583a9075fa fix(test): fix tests according to the new toolchain flags 2025-11-14 21:04:58 +07:00
Roland Dobai
a0b589c147 Merge branch 'feat/cmakev2' into 'master'
feat(cmakev2): introduce cmake-based build system v2

See merge request espressif/esp-idf!42691
2025-11-04 02:53:36 +01:00
Sudeep Mohanty
496ebf0583 feat(cmakev2): Enabled test_cmake.py for cmakev2 in CI 2025-10-30 17:17:49 +08:00
Sudeep Mohanty
f3ffef0075 feat(cmakev2): ruff formatting changes for test_cmake.py 2025-10-30 17:17:49 +08:00
Sudeep Mohanty
22eb926468 feat(cmakev2): Enabled all component manager tests for cmakev2 2025-10-30 17:17:49 +08:00
Frantisek Hrbata
1139551fde fix(test_build_system): disable tests related to outside component dependencies
The commit adb2d5deee ("feat(cmake): Produce warnings when component dependen..")
introduced additional checks for source files and include directories
used by a component that are located outside the component's directory.
If these files and directories belong to another component, a warning is
issued. This feature has not yet been implemented in cmakev2, so related
tests are temporary disabled.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2025-10-30 17:17:49 +08:00
Sudeep Mohanty
84e65e5d24 feat(cmakev2): Enable test_components.py for cmakev2 in CI 2025-10-30 17:17:49 +08:00
Sudeep Mohanty
bb3ce41141 feat(cmakev2): ruff formatting changes for test_components.py 2025-10-30 17:17:49 +08:00
Sudeep Mohanty
0666fb28ea feat(cmakev2): Enabled test_common.py for cmakev2 2025-10-30 17:17:49 +08:00
Sudeep Mohanty
7fe743896d feat(cmakev2): Rename buildv2_test_app source file
This commit renames the buildv2_test_app.c file to build_test_app.c in
the buildv2_test_app template to enable tests to refer to the same
source file name when writing tests for both cmakev1 and cmakev2.
2025-10-30 17:17:49 +08:00
Sudeep Mohanty
c63063f3f6 feat(cmakev2): Enabled test_versions.py for cmakev2 2025-10-30 17:17:49 +08:00
Sudeep Mohanty
f51b79dbe0 feat(cmakev2): ruff formatting changes for test_versions.py 2025-10-30 17:17:49 +08:00