Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / 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}/src/platform/device.gni")
20
21 if (chip_device_platform != "none") {
22   import("${chip_root}/build/chip/chip_test_suite.gni")
23
24   chip_test_suite("tests") {
25     output_name = "libPlatformTests"
26
27     test_sources = []
28
29     if (current_os != "zephyr") {
30       # TODO: unclear as to why this fails on zephyr
31       #       pre-conversion this test was not registered as CHIP_REGISTER_TEST_SUITE
32       test_sources += [ "TestPlatformMgr.cpp" ]
33     }
34
35     if (chip_mdns != "none" && chip_enable_happy_tests &&
36         (chip_device_platform == "linux" || chip_device_platform == "darwin")) {
37       test_sources += [ "TestMdns.cpp" ]
38     }
39
40     public_deps = [
41       "${chip_root}/src/lib/support",
42       "${chip_root}/src/platform",
43       "${chip_root}/src/system",
44       "${nlunit_test_root}:nlunit-test",
45     ]
46
47     # These tests appear to be broken on Mac.
48     if (current_os != "mac") {
49       test_sources += [
50         "TestConfigurationMgr.cpp",
51         "TestPlatformTime.cpp",
52       ]
53     }
54
55     if (chip_enable_openthread) {
56       # FIXME: TestThreadStackMgr requires ot-br-posix daemon to be running
57       # test_sources += [ "TestThreadStackMgr.cpp" ]
58     }
59
60     if (chip_enable_ble) {
61       # FIXME: TestCHIPoBLEStackMgr requires bluetoothd daemon to be running
62       #
63       # TODO: Driver code has a check for only running the test
64       #       if the first argument to the test is a '1'.
65       #       This is very odd and test should probably be moved as an integration
66       #       test rather than a unit test
67       #
68       sources = [
69         "TestCHIPoBLEStackMgr.cpp",
70         "TestCHIPoBLEStackMgr.h",
71         "TestCHIPoBLEStackMgrDriver.cpp",
72       ]
73       tests = [ "TestCHIPoBLEStackMgr" ]
74     }
75
76     if (current_os == "zephyr") {
77       test_sources += [ "TestKeyValueStoreMgr.cpp" ]
78     }
79   }
80 } else {
81   import("${chip_root}/build/chip/chip_test_group.gni")
82   chip_test_group("tests") {
83     deps = []
84   }
85 }