blob: e873b87cb8321278fbc18388e5e6f4cbd5a76420 [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.
import("$zx/public/gn/test/zbi_test.gni")
# Each subdirectory just provides an eponymous source_set().
core_tests = [
"debug",
"c11-condvar",
"c11-mutex",
"c11-thread",
"channel",
"channel-write-etc",
"clock",
"elf-tls",
"event-pair",
"fifo",
"fpu",
"futex",
"handle-close",
"handle-dup",
"handle-info",
"handle-transfer",
"handle-wait",
"job",
"memory-mapping",
"object-child",
"object-info",
"pager",
"port",
"process",
"pthread",
"pthread-barrier",
"pthread-tls",
"socket",
"stack",
"sync-completion",
"sync-condition",
"sync-mutex",
"threads",
"time",
"vmar",
"vmo",
]
# These tests need get_root_resource(), which is only available in the
# unified core-tests binary.
unified_only = [
"bad-syscall",
"bti",
"debug:unified-only",
"interrupt",
"profile",
"resource",
"system-event",
]
group("core") {
testonly = true
# The zbi_test() doesn't go into any other zbi() image. This just brings
# it into the dependency graph for building and test-running metadata.
deps = [
":core-tests", # Together.
]
foreach(test, core_tests) {
deps += [ ":$test" ] # And alone.
}
# If we are building for x64, make sure to run a version of the core tests
# which forces use of the HPET in addition to using the default TSC
if (current_cpu == "x64") {
deps += [ ":core-tests-hpet" ]
}
}
# Build each test as a standalone binary meant to be run by runtests.
foreach(test_name, core_tests) {
zx_test(test_name) {
test_group = "core"
deps = [
test_name,
]
}
}
# Now build all of those (and more) together into the standalone core-tests
# binary. This can and must be run directly from userboot because it
# requires the root resource handle but no system services whatsoever.
zx_test("standalone") {
test_group = "core"
deps = core_tests + unified_only
sources = [
"main.c",
]
deps += [
"$zx/system/ulib/unittest",
"$zx/system/ulib/zircon",
"$zx/system/ulib/zxtest",
]
}
# Make that into a bootable ZBI with just the kernel.
zbi_test("core-tests") {
assert(current_cpu != "")
args = [
"userboot=test/core/standalone-test",
"kernel.enable-debugging-syscalls=true",
]
deps = [
":standalone",
"$zx/kernel",
]
assert_no_deps = [
"$zx/system/core/*",
"$zx/system/dev/*",
]
}
# If we are building for x64, make sure to run the core tests on a system which
# has been configured to force selection of HPET as the timing source instead
# of choosing TSC if possible.
if (current_cpu == "x64") {
# Make that into a bootable ZBI with just the kernel.
zbi_test("core-tests-hpet") {
args = [
"userboot=test/core/standalone-test",
"kernel.wallclock=hpet",
"kernel.enable-debugging-syscalls=true",
]
deps = [
":standalone",
"$zx/kernel",
]
assert_no_deps = [
"$zx/system/core/*",
"$zx/system/dev/*",
]
}
}