blob: 03793592c29fe553f88688deb6c1234710128812 [file] [log] [blame]
# Copyright 2019 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.
##########################################
# Though under //zircon, this build file #
# is meant to be used in the Fuchsia GN #
# build. #
# See fxbug.dev/36139. #
##########################################
assert(!defined(zx) || zx != "/",
"This file can only be used in the Fuchsia GN build.")
import("//build/test.gni")
import("//build/testing/bootfs_test.gni")
import("//src/sys/build/fuchsia_unittest_package.gni")
# Common pieces.
source_set("common") {
testonly = true
visibility = [ ":*" ]
sources = [
"engine_tests.cc",
"event_tests.c",
"event_tests.cc",
"event_tests_ntrace.c",
"event_tests_ntrace.cc",
"fields_tests.cc",
"no_optimization.c",
"record_tests.cc",
]
deps = [
"//zircon/public/lib/async",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/fbl",
"//zircon/system/ulib/async-default",
"//zircon/system/ulib/async-loop",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/trace",
# The engine is chosen by the binary, we just need engine headers here.
"//zircon/public/lib/zx",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/trace-engine:trace-engine-headers-for-reader",
"//zircon/system/ulib/trace-reader",
"//zircon/system/ulib/trace-test-utils",
# fdio is here so that things like printf work.
# Otherwise they silently fail (output is dropped).
"//sdk/lib/fdio",
]
# TODO(fxbug.dev/41900): UBSan has found an instance of undefined behavior in this target.
# Disable UBSan for this target temporarily until it is migrated into CI/CQ.
configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
}
# Version of test that uses libtrace-engine.so.
test("trace") {
if (is_fuchsia) {
configs += [ "//build/unification/config:zircon-migrated" ]
}
if (is_fuchsia) {
fdio_config = [ "//build/config/fuchsia:fdio_config" ]
if (configs + fdio_config - fdio_config != configs) {
configs -= fdio_config
}
}
output_dir = "$root_out_dir/zircon-migrated"
deps = [
":common",
"//zircon/system/ulib/trace-engine",
]
data_deps = [ ":trace-static-engine" ]
}
# And again using libtrace-engine.a.
test("trace-static-engine") {
if (is_fuchsia) {
configs += [ "//build/unification/config:zircon-migrated" ]
}
if (is_fuchsia) {
fdio_config = [ "//build/config/fuchsia:fdio_config" ]
if (configs + fdio_config - fdio_config != configs) {
configs -= fdio_config
}
}
deps = [
":common",
"//zircon/system/ulib/trace-engine",
]
}
bootfs_test("trace-bootfs-test") {
name = "trace"
deps = [ ":trace" ]
}
fuchsia_unittest_package("trace-static-engine-test-pkg") {
package_name = "trace-static-engine"
executable_path = "test/trace-static-engine"
deps = [ ":trace-static-engine" ]
}
group("tests") {
testonly = true
deps = [ ":trace-static-engine-test-pkg" ]
}