From 9538f9c5ff4be903d858cdaebc1c47564f5ee801 Mon Sep 17 00:00:00 2001 From: KonstantinKondrashov Date: Sat, 5 Nov 2022 15:46:13 +0800 Subject: [PATCH] ci: Fix environment variable IDF_CI_BUILD is not set --- .gitlab-ci.yml | 2 ++ Kconfig | 2 +- components/esp_common/include/esp_attr.h | 2 +- components/esp_hw_support/test/test_rtc_clk.c | 4 ++-- components/espcoredump/test_apps/CMakeLists.txt | 4 ++-- components/unity/include/unity_test_runner.h | 4 ++-- tools/ci/configure_ci_environment.sh | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed7a85d60c..bca07d6a22 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,6 +99,8 @@ variables: # This is used only if CI_PYTHON_TOOL_REPO is not empty. CI_PYTHON_TOOL_BRANCH: "" + IDF_CI_BUILD: 1 + cache: # pull only for most of the use cases since it's cache dir. # Only set "push" policy for "upload_cache" stage jobs diff --git a/Kconfig b/Kconfig index 9fd4bd3601..7eb862adeb 100644 --- a/Kconfig +++ b/Kconfig @@ -17,7 +17,7 @@ mainmenu "Espressif IoT Development Framework Configuration" config IDF_CI_BUILD bool - option env="IDF_CI_BUILD" + default y if "$(IDF_CI_BUILD)" = "y" || "$(IDF_CI_BUILD)" = 1 config IDF_TARGET_ARCH_RISCV bool diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index d49f76141c..ade3b3d903 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -180,7 +180,7 @@ FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a = a << b; return a; } /* Use IDF_DEPRECATED attribute to mark anything deprecated from use in ESP-IDF's own source code, but not deprecated for external users. */ -#ifdef IDF_CI_BUILD +#ifdef CONFIG_IDF_CI_BUILD #define IDF_DEPRECATED(REASON) __attribute__((deprecated(REASON))) #else #define IDF_DEPRECATED(REASON) diff --git a/components/esp_hw_support/test/test_rtc_clk.c b/components/esp_hw_support/test/test_rtc_clk.c index c45357ede3..3911ad0571 100644 --- a/components/esp_hw_support/test/test_rtc_clk.c +++ b/components/esp_hw_support/test/test_rtc_clk.c @@ -200,7 +200,7 @@ TEST_CASE("Test fast switching between PLL and XTAL", "[rtc_clk]") /* In CI environments, the 32kXTAL runners don't have 8MB psram for bank switching. So can only test one config or the other. */ -#if !IDF_CI_BUILD || !CONFIG_SPIRAM_BANKSWITCH_ENABLE +#if !defined(CONFIG_IDF_CI_BUILD) || !CONFIG_SPIRAM_BANKSWITCH_ENABLE #define COUNT_TEST 3 #define TIMEOUT_TEST_MS (5 + CONFIG_RTC_CLK_CAL_CYCLES / 16) @@ -345,7 +345,7 @@ TEST_CASE("Test starting 'External 32kHz XTAL' on the board without it.", "[rtc_ start_freq(SOC_RTC_SLOW_CLK_SRC_RC_SLOW, 0); } -#endif // !IDF_CI_BUILD || !CONFIG_SPIRAM_BANKSWITCH_ENABLE +#endif // !defined(CONFIG_IDF_CI_BUILD) || !CONFIG_SPIRAM_BANKSWITCH_ENABLE #endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3, ESP32C3) diff --git a/components/espcoredump/test_apps/CMakeLists.txt b/components/espcoredump/test_apps/CMakeLists.txt index cef5f46515..dc204cb116 100644 --- a/components/espcoredump/test_apps/CMakeLists.txt +++ b/components/espcoredump/test_apps/CMakeLists.txt @@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.16) # Here for reproducible builds, we use the CI compile options to make sure they're same. # Use -ffile-prefix-map to map the local path prefix to ci path prefix -set(ENV{EXTRA_CFLAGS} "-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable \ +set(ENV{EXTRA_CFLAGS} "-Werror -Werror=deprecated-declarations -Werror=unused-variable \ -Werror=unused-but-set-variable -Werror=unused-function -Wstrict-prototypes \ -ffile-prefix-map=$ENV{IDF_PATH}=/builds/espressif/esp-idf") -set(ENV{EXTRA_CXXFLAGS} "-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable \ +set(ENV{EXTRA_CXXFLAGS} "-Werror -Werror=deprecated-declarations -Werror=unused-variable \ -Werror=unused-but-set-variable -Werror=unused-function \ -ffile-prefix-map=$ENV{IDF_PATH}=/builds/espressif/esp-idf") diff --git a/components/unity/include/unity_test_runner.h b/components/unity/include/unity_test_runner.h index b14e3c0f77..aea074bbee 100644 --- a/components/unity/include/unity_test_runner.h +++ b/components/unity/include/unity_test_runner.h @@ -151,9 +151,9 @@ void unity_testcase_register(test_desc_t* desc); /* Test case macro to be ignored in CI. - Tests will still be built (to check for compile error) but not linked if IDF_CI_BUILD. + Tests will still be built (to check for compile error) but not linked if CONFIG_IDF_CI_BUILD. */ -#if IDF_CI_BUILD +#ifdef CONFIG_IDF_CI_BUILD #define TEST_CASE_CI_IGNORE(name_, desc_) \ __attribute__((unused)) static void UNITY_TEST_UID(test_func_) (void) #else diff --git a/tools/ci/configure_ci_environment.sh b/tools/ci/configure_ci_environment.sh index 417663742f..a177683020 100644 --- a/tools/ci/configure_ci_environment.sh +++ b/tools/ci/configure_ci_environment.sh @@ -16,7 +16,7 @@ DEBUG_SHELL=${DEBUG_SHELL:-"0"} # Compiler flags to thoroughly check the IDF code in some CI jobs # (Depends on default options '-Wno-error=XXX' used in the IDF build system) -PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" +PEDANTIC_FLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" export PEDANTIC_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" export PEDANTIC_CXXFLAGS="${PEDANTIC_FLAGS}"