blob: 0a0f3681ffd37363501d670c38a5faaad1686877 [file] [log] [blame]
# Copyright 2024 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/components.gni")
import("//build/test.gni")
source_set("logging") {
sources = [ "logging.h" ]
public_deps = [ "//zircon/system/public" ]
visibility = [ ":*" ]
}
# Implementation of the logging compatibility layer for DFv1 drivers.
# If a DFv1 driver has `:zxlogf` in its dependency, it must also add this target
# to its `deps`.
source_set("logging-dfv1") {
sources = [ "logging-dfv1.cc" ]
public_deps = [ ":logging" ]
deps = [
"//src/lib/ddk",
"//zircon/system/public",
]
}
# Implementation of the logging compatibility layer for DFv2 drivers.
# If a DFv2 driver has `:zxlogf` in its dependency, it must also add this target
# to its `deps`.
source_set("logging-dfv2") {
sources = [ "logging-dfv2.cc" ]
public_deps = [ ":logging" ]
deps = [
"//sdk/lib/driver/logging/cpp",
"//zircon/system/public",
]
}
# Headers defining logging macros that are compatible with both DFv1 and DFv2
# runtimes.
source_set("zxlogf") {
sources = [ "zxlogf.h" ]
public_deps = [ ":logging" ]
}
test("logging-dfv1-tests-bin") {
output_name = "logging-dfv1-tests"
sources = [
"logging-dfv1-driver-test.cc",
"logging-dfv1-hardware-module-test.cc",
]
deps = [
":logging-dfv1",
"testing:dfv1-driver-with-logging",
"testing:logging-hardware-module",
"//src/devices/testing/mock-ddk",
"//src/lib/ddk",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/predicates",
"//third_party/googletest:gtest",
]
}
fuchsia_unittest_package("logging-dfv1-tests") {
deps = [ ":logging-dfv1-tests-bin" ]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
test("logging-dfv2-tests-bin") {
output_name = "logging-dfv2-tests"
sources = [
"logging-dfv2-driver-test.cc",
"logging-dfv2-hardware-module-test.cc",
]
deps = [
":logging-dfv2",
"testing:dfv2-driver-with-logging",
"testing:logging-hardware-module",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_cpp",
"//sdk/lib/driver/component/cpp",
"//sdk/lib/driver/logging/cpp",
"//sdk/lib/driver/testing/cpp",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
"//zircon/system/ulib/zx",
]
}
fuchsia_unittest_package("logging-dfv2-tests") {
deps = [ ":logging-dfv2-tests-bin" ]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
deps = [
":logging-dfv1-tests",
":logging-dfv2-tests",
]
}