blob: b46d33f0d5b87e68d349325cb5c2faa3d2822312 [file] [log] [blame]
# Copyright 2020 The Pigweed 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
#
# https://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/pigweed.gni")
import("$dir_pw_build/module_config.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_protobuf_compiler/proto.gni")
import("$dir_pw_unit_test/test.gni")
declare_args() {
# The build target that overrides the default configuration options for this
# module. This should point to a source set that provides defines through a
# public config (which may -include a file or add defines directly).
pw_unit_test_CONFIG = pw_build_DEFAULT_MODULE_CONFIG
}
config("default_config") {
include_dirs = [
"public",
"public_overrides",
]
}
pw_source_set("config") {
public = [ "public/pw_unit_test/config.h" ]
public_configs = [ ":default_config" ]
public_deps = [
dir_pw_polyfill,
pw_unit_test_CONFIG,
]
visibility = [ ":*" ]
}
# pw_unit_test core library.
pw_source_set("pw_unit_test") {
public_configs = [ ":default_config" ]
public_deps = [
":config",
dir_pw_polyfill,
dir_pw_preprocessor,
dir_pw_string,
]
public = [
"public/pw_unit_test/event_handler.h",
"public/pw_unit_test/framework.h",
"public_overrides/gtest/gtest.h",
]
sources = [ "framework.cc" ]
}
# Library providing an event handler which outputs human-readable text.
pw_source_set("simple_printing_event_handler") {
public_deps = [
":pw_unit_test",
"$dir_pw_preprocessor",
]
public = [ "public/pw_unit_test/simple_printing_event_handler.h" ]
sources = [ "simple_printing_event_handler.cc" ]
}
# Library providing a standard desktop main function for the pw_unit_test
# framework. Unit test files can link against this library to build runnable
# unit test executables.
pw_source_set("simple_printing_main") {
public_deps = [ ":pw_unit_test" ]
deps = [
":simple_printing_event_handler",
"$dir_pw_sys_io",
]
sources = [ "simple_printing_main.cc" ]
}
# Library providing an event handler which logs using pw_log.
pw_source_set("logging_event_handler") {
public_deps = [
":pw_unit_test",
"$dir_pw_log",
"$dir_pw_preprocessor",
]
public = [ "public/pw_unit_test/logging_event_handler.h" ]
sources = [ "logging_event_handler.cc" ]
}
pw_source_set("logging_main") {
public_deps = [ ":pw_unit_test" ]
deps = [
":logging_event_handler",
"$dir_pw_sys_io",
]
sources = [ "logging_main.cc" ]
}
pw_source_set("rpc_service") {
public_configs = [ ":default_config" ]
public_deps = [
":pw_unit_test",
":unit_test_proto.pwpb",
":unit_test_proto.raw_rpc",
"$dir_pw_containers:vector",
]
deps = [ dir_pw_log ]
public = [
"public/pw_unit_test/internal/rpc_event_handler.h",
"public/pw_unit_test/unit_test_service.h",
]
sources = [
"rpc_event_handler.cc",
"unit_test_service.cc",
]
}
pw_source_set("rpc_main") {
public_deps = [ ":pw_unit_test" ]
deps = [
":rpc_service",
"$dir_pw_rpc/system_server",
dir_pw_log,
]
sources = [ "rpc_main.cc" ]
}
pw_executable("test_rpc_server") {
sources = [ "test_rpc_server.cc" ]
deps = [
":pw_unit_test",
":rpc_service",
"$dir_pw_rpc/system_server",
"$dir_pw_rpc/system_server:socket",
dir_pw_log,
]
}
pw_proto_library("unit_test_proto") {
sources = [ "pw_unit_test_proto/unit_test.proto" ]
}
pw_doc_group("docs") {
sources = [ "docs.rst" ]
}
pw_test("framework_test") {
sources = [ "framework_test.cc" ]
}
pw_test_group("tests") {
tests = [ ":framework_test" ]
}