blob: fd4df956a2ac4242b49193a671bfd78ae3b087e8 [file] [log] [blame]
Marc Lepaged3e76ec2021-10-27 18:03:28 -04001# Copyright (c) 2020-2021 Project CHIP Authors
Robert Szewczyk38cf7312020-06-29 09:07:49 -07002#
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 Spangefa630b2020-07-08 22:23:08 -04007# http://www.apache.org/licenses/LICENSE-2.0
Robert Szewczyk38cf7312020-06-29 09:07:49 -07008#
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 Szewczyk38cf7312020-06-29 09:07:49 -070014
Łukasz Duda4e1faf22021-01-27 17:47:25 +010015import("//build_overrides/build.gni")
Michael Spangefa630b2020-07-08 22:23:08 -040016import("//build_overrides/chip.gni")
Michael Spang871ce0b2020-06-26 11:47:03 -040017
Sharad Binjola2937f1a2021-08-24 14:25:16 -070018import("${build_root}/config/compiler/compiler.gni")
Andrei Litvind0b9eb42023-05-29 15:24:10 -040019import("${chip_root}/build/chip/java/config.gni")
Michael Spang09611bf2021-03-02 16:31:57 -050020import("${chip_root}/build/chip/tests.gni")
Damian Królik56ea6a52020-10-14 21:10:08 +020021import("${chip_root}/src/ble/ble.gni")
Michael Spangb7dd6562020-09-16 21:40:17 -040022import("${chip_root}/src/lwip/lwip.gni")
Michael Spangdf712982020-09-18 10:39:35 -040023import("${chip_root}/src/platform/device.gni")
Andrei Litvin42425262023-06-08 18:29:54 -040024import("${chip_root}/src/tracing/tracing_args.gni")
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +020025
Michael Spang9928b522021-03-29 13:34:14 -040026declare_args() {
27 # Build monolithic test library.
28 chip_monolithic_tests = false
29}
30
Karsten Sperling5927a9a2023-04-05 22:40:35 +120031# chip_root relative to root_build_dir for macro-prefix-map.
32# "/." avoids trailing "/" in result when chip_root is "//"
33build_relative_chip_root = rebase_path("${chip_root}/.", root_build_dir)
34
Michael Spangefa630b2020-07-08 22:23:08 -040035config("includes") {
Michael Spang1fcb6dd2020-08-24 11:19:04 -040036 include_dirs = [
37 "include",
38 ".",
39 "${root_gen_dir}/include",
40 ]
Michael Spangefa630b2020-07-08 22:23:08 -040041
Andrei Litvin1ae045e2021-08-25 11:56:29 -040042 # TODO: generated file dependency should be a lib NOT an include
43 include_dirs += [ "${chip_root}/zzz_generated/app-common" ]
44
Michael Spangf6a6c1b2020-10-22 19:45:40 -040045 defines = [ "CHIP_HAVE_CONFIG_H=1" ]
Karsten Sperling5927a9a2023-04-05 22:40:35 +120046
47 # Make __FILE__ and related macros relative to chip_root
48 cflags = [ "-fmacro-prefix-map=${build_relative_chip_root}/=" ]
Michael Spangefa630b2020-07-08 22:23:08 -040049}
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +020050
51if (chip_build_tests) {
Michael Spang09611bf2021-03-02 16:31:57 -050052 import("${chip_root}/build/chip/chip_test_group.gni")
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +020053
54 chip_test_group("tests") {
55 deps = [
Marc Lepaged3e76ec2021-10-27 18:03:28 -040056 "${chip_root}/src/access/tests",
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +020057 "${chip_root}/src/crypto/tests",
58 "${chip_root}/src/inet/tests",
Vivien Nicolasb5904312022-12-14 22:49:56 +010059 "${chip_root}/src/lib/address_resolve/tests",
Andrei Litvin2f169042020-12-01 10:58:43 -050060 "${chip_root}/src/lib/asn1/tests",
61 "${chip_root}/src/lib/core/tests",
Yufeng Wang4fc19f12020-10-22 16:14:32 -070062 "${chip_root}/src/messaging/tests",
Trevor Holbrook934f89c2020-11-18 15:34:14 -080063 "${chip_root}/src/protocols/bdx/tests",
chrisdecenzo31c62492021-08-10 11:47:15 -070064 "${chip_root}/src/protocols/user_directed_commissioning/tests",
Andrei Litvin992775c2020-10-01 20:20:52 -040065 "${chip_root}/src/transport/retransmit/tests",
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +020066 ]
67
Artur Tynecki19034012021-11-15 22:57:36 +010068 # Skip DNSSD tests for Mbed platform due to flash memory size limitations
69 if (current_os != "mbed") {
70 deps += [
71 "${chip_root}/src/lib/dnssd/minimal_mdns/core/tests",
72 "${chip_root}/src/lib/dnssd/minimal_mdns/responders/tests",
73 "${chip_root}/src/lib/dnssd/minimal_mdns/tests",
74 "${chip_root}/src/lib/dnssd/tests",
75 ]
76 }
77
Artur Tynecki35fb13e2021-10-12 18:23:45 +020078 if (current_os != "zephyr" && current_os != "mbed") {
Kamil Kasperczykd9e02a02021-10-12 09:19:23 +020079 deps += [ "${chip_root}/src/lib/dnssd/minimal_mdns/records/tests" ]
rgoliverd9393932021-08-11 15:59:23 -040080 }
81
Artur Tynecki35fb13e2021-10-12 18:23:45 +020082 if (current_os != "zephyr" && current_os != "mbed" &&
83 chip_device_platform != "efr32") {
Michael Spang9928b522021-03-29 13:34:14 -040084 deps += [
Michael Spang9928b522021-03-29 13:34:14 -040085 "${chip_root}/src/setup_payload/tests",
86 "${chip_root}/src/transport/raw/tests",
87 ]
88 }
89
rgoliverd9393932021-08-11 15:59:23 -040090 if (chip_device_platform != "efr32") {
91 deps += [
rgoliver2ea9fbc2021-11-04 10:08:32 -040092 # TODO(#10447): App test has HF on EFR32.
93 "${chip_root}/src/app/tests",
rgoliverd9393932021-08-11 15:59:23 -040094 "${chip_root}/src/credentials/tests",
95 "${chip_root}/src/lib/support/tests",
96 "${chip_root}/src/protocols/secure_channel/tests",
97 "${chip_root}/src/system/tests",
98 "${chip_root}/src/transport/tests",
99 ]
Andrei Litvin42425262023-06-08 18:29:54 -0400100
101 if (matter_enable_tracing_support) {
102 deps += [ "${chip_root}/src/tracing/tests" ]
103 }
rgoliverd9393932021-08-11 15:59:23 -0400104 }
105
Michael Spang56970432020-11-30 17:44:42 -0500106 if (chip_device_platform != "none") {
Kamil Kasperczykd9e02a02021-10-12 09:19:23 +0200107 deps += [ "${chip_root}/src/lib/dnssd/minimal_mdns/tests" ]
Michael Spang56970432020-11-30 17:44:42 -0500108 }
109
pankore544da73c2021-10-19 02:51:16 +0800110 if (chip_device_platform != "esp32" && chip_device_platform != "efr32" &&
111 chip_device_platform != "ameba") {
Andrei Litvin2f169042020-12-01 10:58:43 -0500112 deps += [ "${chip_root}/src/platform/tests" ]
Michael Spangdf712982020-09-18 10:39:35 -0400113 }
114
Andrei Litvin2f169042020-12-01 10:58:43 -0500115 if (chip_config_network_layer_ble) {
Damian Królik56ea6a52020-10-14 21:10:08 +0200116 deps += [ "${chip_root}/src/ble/tests" ]
117 }
118
Boris Zbarskybc2d74b2021-09-13 16:14:23 -0400119 # On nrfconnect, the controller tests run into
120 # https://github.com/project-chip/connectedhomeip/issues/9630
rgoliver2ea9fbc2021-11-04 10:08:32 -0400121 if (chip_device_platform != "nrfconnect" &&
122 chip_device_platform != "efr32") {
123 # TODO(#10447): Controller test has HF on EFR32.
Artur Tynecki0efd3182022-12-05 20:18:32 +0100124 deps += [ "${chip_root}/src/controller/tests/data_model" ]
125
126 # Skip controller test for Open IoT SDK
127 # https://github.com/project-chip/connectedhomeip/issues/23747
128 if (chip_device_platform != "openiotsdk") {
129 deps += [ "${chip_root}/src/controller/tests" ]
130 }
Sharad Binjola2937f1a2021-08-24 14:25:16 -0700131 }
132
Artur Tynecki35fb13e2021-10-12 18:23:45 +0200133 if (current_os != "zephyr" && current_os != "mbed" &&
pankore544da73c2021-10-19 02:51:16 +0800134 chip_device_platform != "esp32" && chip_device_platform != "ameba") {
Michael Spangb7dd6562020-09-16 21:40:17 -0400135 deps += [ "${chip_root}/src/lib/shell/tests" ]
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +0200136 }
Michael Spang9928b522021-03-29 13:34:14 -0400137
138 if (chip_monolithic_tests) {
139 build_monolithic_library = true
140 output_name = "libCHIP_tests"
141 output_dir = "${root_out_dir}/lib"
142 }
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +0200143 }
Song Guo30123da2020-10-13 19:30:39 +0800144
C Freeman79c93152021-08-18 00:20:05 -0400145 chip_test_group("fake_platform_tests") {
Kamil Kasperczykd9e02a02021-10-12 09:19:23 +0200146 deps = [ "${chip_root}/src/lib/dnssd/platform/tests" ]
C Freeman79c93152021-08-18 00:20:05 -0400147 }
Michael Spang4b77b8e2022-07-21 19:39:24 -0400148
149 # Tests to run with each Crypto PAL
150 chip_test_group("crypto_tests") {
151 deps = [
152 "${chip_root}/src/credentials/tests",
153 "${chip_root}/src/crypto/tests",
154 ]
155 }
Andrei Litvind0b9eb42023-05-29 15:24:10 -0400156
157 if (matter_enable_java_compilation) {
158 group("java_controller_tests") {
159 deps = [ "${chip_root}/src/controller/java:unit_tests" ]
160 }
161 }
Rafał Kuźnia6b3ee1a2020-09-04 03:08:16 +0200162}