From d4827e75aec027c06d49a73dff63d87cf49a263d Mon Sep 17 00:00:00 2001 From: WanqQixiang Date: Fri, 12 Apr 2024 10:29:57 +0800 Subject: [PATCH] Enable CONFIG_BUILD_FOR_HOST_UNIT_TEST to fix CHIP test build --- .../esp32/main/Kconfig.projbuild | 4 -- .../esp32/main/include/CHIPProjectConfig.h | 38 ------------------- .../esp32/main/Kconfig.projbuild | 4 -- .../esp32/main/include/CHIPProjectConfig.h | 38 ------------------- src/platform/ESP32/CHIPPlatformConfig.h | 6 +++ .../esp32/main/include/CHIPProjectConfig.h | 2 - 6 files changed, 6 insertions(+), 86 deletions(-) delete mode 100644 examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h delete mode 100644 examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index e1d8805e689326..2cec0c32093734 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -59,10 +59,6 @@ menu "Demo" depends on IDF_TARGET_ESP32H2 endchoice - config CHIP_PROJECT_CONFIG - string "CHIP Project Configuration file" - default "main/include/CHIPProjectConfig.h" - choice prompt "Rendezvous Mode" default RENDEZVOUS_MODE_BLE if BT_ENABLED diff --git a/examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h deleted file mode 100644 index 9fff1bd10e67b4..00000000000000 --- a/examples/all-clusters-app/esp32/main/include/CHIPProjectConfig.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#pragma once - -/** - * @def CONFIG_BUILD_FOR_HOST_UNIT_TEST - * - * @brief Defines whether we're currently building for unit testing, which enables a set of features - * that are only utilized in those tests. This flag should not be enabled on devices. If you have a test - * that uses this flag, either appropriately conditionalize the entire test on this flag, or to exclude - * the compliation of that test source file entirely. - */ -#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1 diff --git a/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild index 9fe8f460e6b0a4..171af4f0ba2c24 100644 --- a/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-minimal-app/esp32/main/Kconfig.projbuild @@ -48,10 +48,6 @@ menu "Demo" depends on IDF_TARGET_ESP32C2 endchoice - config CHIP_PROJECT_CONFIG - string "CHIP Project Configuration file" - default "main/include/CHIPProjectConfig.h" - choice prompt "Rendezvous Mode" default RENDEZVOUS_MODE_BLE if BT_ENABLED diff --git a/examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h b/examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h deleted file mode 100644 index 9fff1bd10e67b4..00000000000000 --- a/examples/all-clusters-minimal-app/esp32/main/include/CHIPProjectConfig.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#pragma once - -/** - * @def CONFIG_BUILD_FOR_HOST_UNIT_TEST - * - * @brief Defines whether we're currently building for unit testing, which enables a set of features - * that are only utilized in those tests. This flag should not be enabled on devices. If you have a test - * that uses this flag, either appropriately conditionalize the entire test on this flag, or to exclude - * the compliation of that test source file entirely. - */ -#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1 diff --git a/src/platform/ESP32/CHIPPlatformConfig.h b/src/platform/ESP32/CHIPPlatformConfig.h index 041b8e99612891..d9012d41da58a8 100644 --- a/src/platform/ESP32/CHIPPlatformConfig.h +++ b/src/platform/ESP32/CHIPPlatformConfig.h @@ -101,3 +101,9 @@ #ifdef CONFIG_CHIP_ENABLE_BDX_LOG_TRANSFER #define CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER 1 #endif // CONFIG_CHIP_ENABLE_BDX_LOG_TRANSFER + +#ifdef CONFIG_BUILD_CHIP_TESTS +// CHIP tests use APIs that are declared when CONFIG_BUILD_FOR_HOST_UNIT_TEST is enabled +// Enable CONFIG_BUILD_FOR_HOST_UNIT_TEST when building CHIP test binaries +#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1 +#endif diff --git a/src/test_driver/esp32/main/include/CHIPProjectConfig.h b/src/test_driver/esp32/main/include/CHIPProjectConfig.h index 1e4dc9626b5033..3a25601cfd884e 100644 --- a/src/test_driver/esp32/main/include/CHIPProjectConfig.h +++ b/src/test_driver/esp32/main/include/CHIPProjectConfig.h @@ -30,6 +30,4 @@ // Enable support functions for parsing command-line arguments #define CHIP_CONFIG_ENABLE_ARG_PARSER 1 -#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1 - #endif // CHIP_PROJECT_CONFIG_H