Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / inet / tests / BUILD.gn
1 # Copyright (c) 2020 Project CHIP Authors
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 #
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
14
15 import("//build_overrides/build.gni")
16 import("//build_overrides/chip.gni")
17 import("//build_overrides/nlunit_test.gni")
18
19 import("${chip_root}/build/chip/chip_test_suite.gni")
20 import("${chip_root}/build/chip/tests.gni")
21 import("${chip_root}/src/lwip/lwip.gni")
22 import("${chip_root}/src/platform/device.gni")
23
24 config("tests_config") {
25   include_dirs = [ "." ]
26 }
27
28 static_library("helpers") {
29   output_name = "libInetTestHelpers"
30   output_dir = "${root_out_dir}/lib"
31
32   sources = [
33     "TestInetCommon.h",
34     "TestInetCommonOptions.cpp",
35     "TestInetCommonOptions.h",
36     "TestInetCommonPosix.cpp",
37     "TestInetLayer.cpp",
38     "TestInetLayerCommon.cpp",
39     "TestSetupFaultInjection.h",
40     "TestSetupFaultInjectionPosix.cpp",
41     "TestSetupSignalling.h",
42     "TestSetupSignallingPosix.cpp",
43   ]
44
45   cflags = [ "-Wconversion" ]
46
47   public_deps = [
48     "${chip_root}/src/inet",
49     "${chip_root}/src/lib/core",
50     "${nlunit_test_root}:nlunit-test",
51   ]
52 }
53
54 chip_test_suite("tests") {
55   output_name = "libInetLayerTests"
56
57   public_configs = [ ":tests_config" ]
58
59   public_deps = [
60     ":helpers",
61     "${chip_root}/src/inet",
62     "${chip_root}/src/lib/core",
63     "${nlunit_test_root}:nlunit-test",
64   ]
65
66   test_sources = [
67     "TestInetAddress.cpp",
68     "TestInetErrorStr.cpp",
69   ]
70   sources = []
71
72   if (current_os != "zephyr") {
73     test_sources += [ "TestInetEndPoint.cpp" ]
74   }
75
76   # This fails on Raspberry Pi (Linux arm64), so only enable on Linux
77   # x64.
78   if (current_os != "mac" && current_os != "zephyr" &&
79       chip_device_platform != "esp32" && current_cpu == "x64") {
80     test_sources += [ "TestInetLayerDNS.cpp" ]
81
82     # TODO: This test does not seem executed
83     sources += [ "TestLwIPDNS.cpp" ]
84   }
85 }
86
87 if (chip_enable_happy_tests) {
88   # The following binaries should be executed by happy.
89   chip_test_suite("happy_tests") {
90     output_name = "libHappyTestInetCommon"
91
92     sources = [ "TestInetLayerMulticast.cpp" ]
93
94     public_configs = [ ":tests_config" ]
95
96     public_deps = [
97       ":tests_lib",
98       "${chip_root}/src/inet",
99       "${chip_root}/src/lib/core",
100       "${nlunit_test_root}:nlunit-test",
101     ]
102
103     tests = [ "TestInetLayerMulticast" ]
104   }
105 }