Marc Lepage | d3e76ec | 2021-10-27 18:03:28 -0400 | [diff] [blame] | 1 | # Copyright (c) 2020-2021 Project CHIP Authors |
Robert Szewczyk | 38cf731 | 2020-06-29 09:07:49 -0700 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
Robert Szewczyk | 38cf731 | 2020-06-29 09:07:49 -0700 | [diff] [blame] | 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
Robert Szewczyk | 38cf731 | 2020-06-29 09:07:49 -0700 | [diff] [blame] | 14 | |
Łukasz Duda | 4e1faf2 | 2021-01-27 17:47:25 +0100 | [diff] [blame] | 15 | import("//build_overrides/build.gni") |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 16 | import("//build_overrides/chip.gni") |
Michael Spang | 871ce0b | 2020-06-26 11:47:03 -0400 | [diff] [blame] | 17 | |
Sharad Binjola | 2937f1a | 2021-08-24 14:25:16 -0700 | [diff] [blame] | 18 | import("${build_root}/config/compiler/compiler.gni") |
Andrei Litvin | d0b9eb4 | 2023-05-29 15:24:10 -0400 | [diff] [blame] | 19 | import("${chip_root}/build/chip/java/config.gni") |
Michael Spang | 09611bf | 2021-03-02 16:31:57 -0500 | [diff] [blame] | 20 | import("${chip_root}/build/chip/tests.gni") |
Damian Królik | 56ea6a5 | 2020-10-14 21:10:08 +0200 | [diff] [blame] | 21 | import("${chip_root}/src/ble/ble.gni") |
Michael Spang | df71298 | 2020-09-18 10:39:35 -0400 | [diff] [blame] | 22 | import("${chip_root}/src/platform/device.gni") |
Andrei Litvin | 4242526 | 2023-06-08 18:29:54 -0400 | [diff] [blame] | 23 | import("${chip_root}/src/tracing/tracing_args.gni") |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 24 | |
Michael Spang | 9928b52 | 2021-03-29 13:34:14 -0400 | [diff] [blame] | 25 | declare_args() { |
| 26 | # Build monolithic test library. |
| 27 | chip_monolithic_tests = false |
| 28 | } |
| 29 | |
Karsten Sperling | 5927a9a | 2023-04-05 22:40:35 +1200 | [diff] [blame] | 30 | # chip_root relative to root_build_dir for macro-prefix-map. |
| 31 | # "/." avoids trailing "/" in result when chip_root is "//" |
| 32 | build_relative_chip_root = rebase_path("${chip_root}/.", root_build_dir) |
| 33 | |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 34 | config("includes") { |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 35 | include_dirs = [ |
| 36 | "include", |
| 37 | ".", |
| 38 | "${root_gen_dir}/include", |
| 39 | ] |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 40 | |
Wang Qixiang | 8686f21 | 2024-01-04 15:52:35 +0800 | [diff] [blame] | 41 | if (chip_device_platform == "external" && |
| 42 | chip_external_platform_include_dir != "") { |
| 43 | include_dirs += [ "${chip_external_platform_include_dir}" ] |
| 44 | } |
| 45 | |
Michael Spang | f6a6c1b | 2020-10-22 19:45:40 -0400 | [diff] [blame] | 46 | defines = [ "CHIP_HAVE_CONFIG_H=1" ] |
Karsten Sperling | 5927a9a | 2023-04-05 22:40:35 +1200 | [diff] [blame] | 47 | |
| 48 | # Make __FILE__ and related macros relative to chip_root |
| 49 | cflags = [ "-fmacro-prefix-map=${build_relative_chip_root}/=" ] |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 50 | } |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 51 | |
| 52 | if (chip_build_tests) { |
Michael Spang | 09611bf | 2021-03-02 16:31:57 -0500 | [diff] [blame] | 53 | import("${chip_root}/build/chip/chip_test_group.gni") |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 54 | |
| 55 | chip_test_group("tests") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 56 | deps = [] |
| 57 | tests = [ |
Marc Lepage | d3e76ec | 2021-10-27 18:03:28 -0400 | [diff] [blame] | 58 | "${chip_root}/src/access/tests", |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 59 | "${chip_root}/src/crypto/tests", |
| 60 | "${chip_root}/src/inet/tests", |
Vivien Nicolas | b590431 | 2022-12-14 22:49:56 +0100 | [diff] [blame] | 61 | "${chip_root}/src/lib/address_resolve/tests", |
Andrei Litvin | 2f16904 | 2020-12-01 10:58:43 -0500 | [diff] [blame] | 62 | "${chip_root}/src/lib/asn1/tests", |
| 63 | "${chip_root}/src/lib/core/tests", |
Yufeng Wang | 4fc19f1 | 2020-10-22 16:14:32 -0700 | [diff] [blame] | 64 | "${chip_root}/src/messaging/tests", |
Trevor Holbrook | 934f89c | 2020-11-18 15:34:14 -0800 | [diff] [blame] | 65 | "${chip_root}/src/protocols/bdx/tests", |
Tennessee Carmel-Veilleux | f7cd2d6 | 2023-12-20 14:26:07 -0500 | [diff] [blame] | 66 | "${chip_root}/src/protocols/interaction_model/tests", |
chrisdecenzo | 31c6249 | 2021-08-10 11:47:15 -0700 | [diff] [blame] | 67 | "${chip_root}/src/protocols/user_directed_commissioning/tests", |
Andrei Litvin | 992775c | 2020-10-01 20:20:52 -0400 | [diff] [blame] | 68 | "${chip_root}/src/transport/retransmit/tests", |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 69 | ] |
| 70 | |
Artur Tynecki | 1903401 | 2021-11-15 22:57:36 +0100 | [diff] [blame] | 71 | # Skip DNSSD tests for Mbed platform due to flash memory size limitations |
| 72 | if (current_os != "mbed") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 73 | tests += [ |
Artur Tynecki | 1903401 | 2021-11-15 22:57:36 +0100 | [diff] [blame] | 74 | "${chip_root}/src/lib/dnssd/minimal_mdns/core/tests", |
| 75 | "${chip_root}/src/lib/dnssd/minimal_mdns/responders/tests", |
| 76 | "${chip_root}/src/lib/dnssd/minimal_mdns/tests", |
| 77 | "${chip_root}/src/lib/dnssd/tests", |
| 78 | ] |
| 79 | } |
| 80 | |
Artur Tynecki | 35fb13e | 2021-10-12 18:23:45 +0200 | [diff] [blame] | 81 | if (current_os != "zephyr" && current_os != "mbed") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 82 | tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/records/tests" ] |
rgoliver | d939393 | 2021-08-11 15:59:23 -0400 | [diff] [blame] | 83 | } |
| 84 | |
Artur Tynecki | 35fb13e | 2021-10-12 18:23:45 +0200 | [diff] [blame] | 85 | if (current_os != "zephyr" && current_os != "mbed" && |
| 86 | chip_device_platform != "efr32") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 87 | tests += [ |
Michael Spang | 9928b52 | 2021-03-29 13:34:14 -0400 | [diff] [blame] | 88 | "${chip_root}/src/setup_payload/tests", |
| 89 | "${chip_root}/src/transport/raw/tests", |
| 90 | ] |
| 91 | } |
| 92 | |
rgoliver | d939393 | 2021-08-11 15:59:23 -0400 | [diff] [blame] | 93 | if (chip_device_platform != "efr32") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 94 | tests += [ |
rgoliver | 2ea9fbc | 2021-11-04 10:08:32 -0400 | [diff] [blame] | 95 | # TODO(#10447): App test has HF on EFR32. |
| 96 | "${chip_root}/src/app/tests", |
rgoliver | d939393 | 2021-08-11 15:59:23 -0400 | [diff] [blame] | 97 | "${chip_root}/src/credentials/tests", |
Andrei Litvin | 3956092 | 2023-07-11 09:13:57 -0400 | [diff] [blame] | 98 | "${chip_root}/src/lib/format/tests", |
rgoliver | d939393 | 2021-08-11 15:59:23 -0400 | [diff] [blame] | 99 | "${chip_root}/src/lib/support/tests", |
| 100 | "${chip_root}/src/protocols/secure_channel/tests", |
| 101 | "${chip_root}/src/system/tests", |
| 102 | "${chip_root}/src/transport/tests", |
| 103 | ] |
Andrei Litvin | 4242526 | 2023-06-08 18:29:54 -0400 | [diff] [blame] | 104 | |
Andrei Litvin | d356484 | 2023-06-23 12:30:50 -0400 | [diff] [blame] | 105 | if (matter_enable_tracing_support && |
| 106 | matter_trace_config == "multiplexed") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 107 | tests += [ "${chip_root}/src/tracing/tests" ] |
Andrei Litvin | 4242526 | 2023-06-08 18:29:54 -0400 | [diff] [blame] | 108 | } |
rgoliver | d939393 | 2021-08-11 15:59:23 -0400 | [diff] [blame] | 109 | } |
| 110 | |
Michael Spang | 5697043 | 2020-11-30 17:44:42 -0500 | [diff] [blame] | 111 | if (chip_device_platform != "none") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 112 | tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/tests" ] |
Michael Spang | 5697043 | 2020-11-30 17:44:42 -0500 | [diff] [blame] | 113 | } |
| 114 | |
pankore | 544da73c | 2021-10-19 02:51:16 +0800 | [diff] [blame] | 115 | if (chip_device_platform != "esp32" && chip_device_platform != "efr32" && |
| 116 | chip_device_platform != "ameba") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 117 | tests += [ "${chip_root}/src/platform/tests" ] |
Michael Spang | df71298 | 2020-09-18 10:39:35 -0400 | [diff] [blame] | 118 | } |
| 119 | |
Andrei Litvin | 2f16904 | 2020-12-01 10:58:43 -0500 | [diff] [blame] | 120 | if (chip_config_network_layer_ble) { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 121 | tests += [ "${chip_root}/src/ble/tests" ] |
Damian Królik | 56ea6a5 | 2020-10-14 21:10:08 +0200 | [diff] [blame] | 122 | } |
| 123 | |
Boris Zbarsky | bc2d74b | 2021-09-13 16:14:23 -0400 | [diff] [blame] | 124 | # On nrfconnect, the controller tests run into |
| 125 | # https://github.com/project-chip/connectedhomeip/issues/9630 |
rgoliver | 2ea9fbc | 2021-11-04 10:08:32 -0400 | [diff] [blame] | 126 | if (chip_device_platform != "nrfconnect" && |
| 127 | chip_device_platform != "efr32") { |
| 128 | # TODO(#10447): Controller test has HF on EFR32. |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 129 | tests += [ "${chip_root}/src/controller/tests/data_model" ] |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 130 | |
| 131 | # Skip controller test for Open IoT SDK |
| 132 | # https://github.com/project-chip/connectedhomeip/issues/23747 |
| 133 | if (chip_device_platform != "openiotsdk") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 134 | tests += [ "${chip_root}/src/controller/tests" ] |
Artur Tynecki | 0efd318 | 2022-12-05 20:18:32 +0100 | [diff] [blame] | 135 | } |
Sharad Binjola | 2937f1a | 2021-08-24 14:25:16 -0700 | [diff] [blame] | 136 | } |
| 137 | |
Artur Tynecki | 35fb13e | 2021-10-12 18:23:45 +0200 | [diff] [blame] | 138 | if (current_os != "zephyr" && current_os != "mbed" && |
pankore | 544da73c | 2021-10-19 02:51:16 +0800 | [diff] [blame] | 139 | chip_device_platform != "esp32" && chip_device_platform != "ameba") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 140 | tests += [ "${chip_root}/src/lib/shell/tests" ] |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 141 | } |
Michael Spang | 9928b52 | 2021-03-29 13:34:14 -0400 | [diff] [blame] | 142 | |
| 143 | if (chip_monolithic_tests) { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 144 | # TODO [PW_MIGRATION] Remove this if after migartion to PW_TEST is completed for all platforms |
| 145 | # TODO [PW_MIGRATION] There will be a list of already migrated platforms |
Jakub Latusek | c2f58e4 | 2024-03-07 13:25:18 +0100 | [diff] [blame] | 146 | if (chip_device_platform == "esp32" || |
Jakub Latusek | 11c0af3 | 2024-03-13 20:59:07 +0100 | [diff] [blame] | 147 | chip_device_platform == "nrfconnect" || |
| 148 | chip_device_platform == "openiotsdk") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 149 | deps += [ "${chip_root}/src/lib/support:pw_tests_wrapper" ] |
| 150 | } |
Michael Spang | 9928b52 | 2021-03-29 13:34:14 -0400 | [diff] [blame] | 151 | build_monolithic_library = true |
| 152 | output_name = "libCHIP_tests" |
| 153 | output_dir = "${root_out_dir}/lib" |
| 154 | } |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 155 | } |
Song Guo | 30123da | 2020-10-13 19:30:39 +0800 | [diff] [blame] | 156 | |
C Freeman | 79c9315 | 2021-08-18 00:20:05 -0400 | [diff] [blame] | 157 | chip_test_group("fake_platform_tests") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 158 | tests = [ "${chip_root}/src/lib/dnssd/platform/tests" ] |
C Freeman | 79c9315 | 2021-08-18 00:20:05 -0400 | [diff] [blame] | 159 | } |
Michael Spang | 4b77b8e | 2022-07-21 19:39:24 -0400 | [diff] [blame] | 160 | |
| 161 | # Tests to run with each Crypto PAL |
| 162 | chip_test_group("crypto_tests") { |
Jakub Latusek | 9c93583 | 2024-01-23 12:55:15 +0100 | [diff] [blame] | 163 | tests = [ |
Michael Spang | 4b77b8e | 2022-07-21 19:39:24 -0400 | [diff] [blame] | 164 | "${chip_root}/src/credentials/tests", |
| 165 | "${chip_root}/src/crypto/tests", |
| 166 | ] |
| 167 | } |
Andrei Litvin | d0b9eb4 | 2023-05-29 15:24:10 -0400 | [diff] [blame] | 168 | |
| 169 | if (matter_enable_java_compilation) { |
| 170 | group("java_controller_tests") { |
| 171 | deps = [ "${chip_root}/src/controller/java:unit_tests" ] |
| 172 | } |
| 173 | } |
Rafał Kuźnia | 6b3ee1a | 2020-09-04 03:08:16 +0200 | [diff] [blame] | 174 | } |