From 28c1a64007515ef5e7c69bf6151052dc33ced636 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Sat, 26 Jul 2025 14:52:34 +0200 Subject: [PATCH] feat(cmakev2/kconfig): Added basic test for Kconfig generation --- tools/cmakev2/test/CMakeLists.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/cmakev2/test/CMakeLists.txt b/tools/cmakev2/test/CMakeLists.txt index 7c9463f35a5..2e35e154166 100644 --- a/tools/cmakev2/test/CMakeLists.txt +++ b/tools/cmakev2/test/CMakeLists.txt @@ -130,12 +130,38 @@ function(test_idf_build_library) endif() endfunction() +function(test_kconfig) + # Check that kconfig output files were generated + idf_build_get_property(config_dir CONFIG_DIR) + set(output_files sdkconfig.h sdkconfig.cmake sdkconfig.json kconfig_menus.json) + + foreach(file ${output_files}) + set(file_path "${config_dir}/${file}") + if(NOT EXISTS "${file_path}") + idf_die("Missing kconfig output: ${file_path}") + endif() + file(SIZE "${file_path}" file_size) + if(file_size EQUAL 0) + idf_die("Empty kconfig output: ${file_path}") + endif() + endforeach() + + # Check that kconfig targets were created + set(targets menuconfig confserver save-defconfig) + foreach(target ${targets}) + if(NOT TARGET ${target}) + idf_die("Missing kconfig target: ${target}") + endif() + endforeach() +endfunction() + # Run tests test_component_priority() test_idf_version() test_python() test_toolchain() test_idf_build_library() +test_kconfig() __dump_all_properties() message("ALL TESTS PASSED")