blob: 038ff6aaed668a40ff3482b7045f1aff4cbb196c [file]
# Copyright (c) 2020 Project CHIP Authors
#
# 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.
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/fuzz_test.gni")
import("${chip_root}/src/platform/device.gni")
declare_args() {
# Platform DNSsd should always be running on darwin. On Linux
# this depends on avahi being available and running.
chip_enable_dnssd_tests = chip_device_platform == "darwin"
}
if (chip_device_platform != "none") {
import("${chip_root}/build/chip/chip_test_suite.gni")
chip_test_suite("tests") {
output_name = "libPlatformTests"
test_sources = [ "TestGeneralFaults.cpp" ]
defines = [ "CALLER_HANDLES_CRITICAL_FAILURE=1" ]
if (current_os != "zephyr") {
# TODO: unclear as to why this fails on zephyr
# pre-conversion this test was not registered as CHIP_REGISTER_TEST_SUITE
test_sources += [ "TestPlatformMgr.cpp" ]
}
public_deps = [
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/platform",
"${chip_root}/src/system",
]
if (chip_mdns != "none" && chip_enable_dnssd_tests &&
(chip_device_platform == "linux" || chip_device_platform == "darwin")) {
test_sources += [ "TestDnssd.cpp" ]
public_deps += [
"${chip_root}/src/lib/dnssd",
"${chip_root}/src/lib/dnssd/minimal_mdns",
]
}
# These tests appear to be broken on Mac.
if (current_os != "mac") {
test_sources += [
"TestConfigurationMgr.cpp",
"TestPlatformTime.cpp",
]
if (chip_device_platform == "esp32") {
# SleepMillis can undersleep by as much as 10ms on esp32-qemu.
defines += [ "CONFIG_WIDER_SLEEP_MARGIN" ]
}
}
if (chip_enable_thread) {
# FIXME: TestThreadStackMgr requires ot-br-posix daemon to be running
# test_sources += [ "TestThreadStackMgr.cpp" ]
# configs = [ "//${chip_root}/third_party/ot-br-posix:dbus_config" ]
}
if (chip_enable_ble &&
(chip_device_platform == "linux" || chip_device_platform == "darwin")) {
# FIXME: TestCHIPoBLEStackMgr requires bluetoothd daemon to be running
#
# TODO: Driver code has a check for only running the test
# if the first argument to the test is a '1'.
# This is very odd and test should probably be moved as an integration
# test rather than a unit test
#
sources = [
"TestCHIPoBLEStackMgr.cpp",
"TestCHIPoBLEStackMgrDriver.cpp",
]
tests = [ "TestCHIPoBLEStackMgr" ]
}
if (current_os == "zephyr" || current_os == "android" ||
current_os == "cmsis-rtos") {
test_sources += [ "TestKeyValueStoreMgr.cpp" ]
}
if (chip_device_platform == "linux") {
test_sources += [ "TestConnectivityMgr.cpp" ]
}
}
} else {
import("${chip_root}/build/chip/chip_test_group.gni")
chip_test_group("tests") {
tests = []
}
}
if (enable_fuzz_test_targets) {
source_set("tizen_fuzzer_stubs") {
public = [
"tizen_stubs/ble/Ble.h",
"tizen_stubs/ble/BleUUID.h",
"tizen_stubs/bluetooth.h",
"tizen_stubs/bluetooth_internal.h",
"tizen_stubs/chip_support_stubs.h",
"tizen_stubs/glib.h",
"tizen_stubs/lib/core/CHIPError.h",
"tizen_stubs/lib/support/CHIPMemString.h",
"tizen_stubs/lib/support/CodeUtils.h",
"tizen_stubs/lib/support/Span.h",
"tizen_stubs/lib/support/logging/CHIPLogging.h",
"tizen_stubs/platform/CHIPDeviceConfig.h",
"tizen_stubs/platform/GLibTypeDeleter.h",
"tizen_stubs/platform/NetworkCommissioning.h",
"tizen_stubs/platform/PlatformError.h",
"tizen_stubs/platform/PlatformManager.h",
"tizen_stubs/platform/internal/DeviceNetworkInfo.h",
"tizen_stubs/system/SystemClock.h",
"tizen_stubs/tizen.h",
"tizen_stubs/tizen_api_stubs.h",
"tizen_stubs/wifi-manager.h",
]
}
chip_fuzz_target("fuzz-tizen-ble-scan-parser") {
sources = [
"FuzzTizenBLEScanParser.cpp",
"tizen_stubs/tizenrt_ble_service_data.c",
]
public_deps = [ ":tizen_fuzzer_stubs" ]
cflags = [ "-funsigned-char" ]
include_dirs = [
"tizen_stubs",
"${chip_root}/src",
]
}
chip_fuzz_target("fuzz-tizen-wifi-manager") {
sources = [ "FuzzTizenWiFiManager.cpp" ]
defines = [
"CHIP_DEVICE_CONFIG_ENABLE_WIFI=1",
"CHIP_ENABLE_OPENTHREAD=0",
]
public_deps = [ ":tizen_fuzzer_stubs" ]
include_dirs = [
"tizen_stubs",
"${chip_root}/src",
]
}
}