blob: 401e811057ee2cd7ed6414dac43cc864cc430996 [file] [log] [blame]
# Copyright 2020 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/config/fuchsia/zircon.gni")
import("zircon_host_test.gni")
# This file should only be used in the host toolchain.
assert(current_toolchain == host_toolchain)
########################
# Metadata
# Produce a list of host tests by reading metadata generated by the ZN build.
zircon_test_specs = read_file("$zircon_root_build_dir/tests.json", "json")
available_tests = []
foreach(entry, zircon_test_specs) {
test = { # Clear from previous iteration.
}
test = entry.test
if (test.os == host_os && test.cpu == host_cpu) {
zircon_host_test("test_${test.name}") {
spec = test
}
available_tests += [ test.name ]
}
}
# Keep a local list of ZN-provided host tests.
# This ensures the GN build fails when a test gets removed from ZN, which is
# critical when migrating tests from ZN to GN.
listed_tests = [
#------------------
#------------------
#------------------
#------------------
#------------------
"fidl-compiler",
#------------------
#------------------
#------------------
#------------------
#------------------
#------------------
"hwreg-asm-header",
#------------------
#------------------
#------------------
#------------------
#------------------
#------------------
#------------------
#------------------
"kazoo-unittests",
#------------------
#------------------
#------------------
#------------------
#------------------
"uart-unittests",
#------------------
#------------------
#------------------
#------------------
]
if (current_os == "linux") {
listed_tests += [
#------------------
#------------------
#------------------
#------------------
#------------------
#------------------
]
}
# Check that the test lists are identical.
foreach(test, listed_tests) {
assert(available_tests + [ test ] - [ test ] != available_tests,
"Test missing from ZN: $test")
}
foreach(test, available_tests) {
assert(listed_tests + [ test ] - [ test ] != listed_tests,
"New test not accounted for: $test")
}
########################
# Tests
# Tests built by ZN.
# This list is automatically generated based on metadata.
group("legacy-tests") {
testonly = true
deps = []
foreach(test, available_tests) {
deps += [ ":test_$test" ]
}
}
# Tests build by GN.
# Tests should be manually added to this list when migrated away from ZN.
group("migrated-tests") {
testonly = true
deps = [
"//zircon/system/ulib/fbl/test:fbl",
"//zircon/system/ulib/ffl/test:ffl",
"//zircon/system/ulib/fit/test",
"//zircon/system/ulib/fs/transaction/test",
"//zircon/system/ulib/libzbi/test:zbi",
"//zircon/system/utest/cmdline",
#------------------
"//zircon/system/ulib/blobfs/test:blobfs-host",
#------------------
#------------------
"//zircon/system/utest/fidl",
#------------------
#------------------
#"fidl-compiler",
#------------------
#------------------
"//zircon/system/utest/fs-host",
#------------------
#------------------
# Disabled because of fxbug.dev/37779 (20min+ run-time)
#"//zircon/system/utest/fvm-host",
#------------------
"//zircon/system/ulib/fdio/test/host",
#------------------
"//zircon/system/ulib/fvm/test:fvm-unit",
#------------------
#------------------
"//zircon/system/ulib/minfs/test:minfs-host",
#------------------
#------------------
#"tests",
#------------------
#------------------
"//zircon/system/ulib/trace-reader/test:trace-reader-test",
#------------------
#------------------
"//zircon/system/utest/util",
#------------------
#------------------
"//zircon/system/ulib/zxtest/test:zxtest",
#------------------
#------------------
"//zircon/system/ulib/zxtest/test/integration:zxtest-integration",
#------------------
]
if (current_os == "linux") {
deps += [
"//src/devices/usb/drivers/usb-peripheral-test",
"//zircon/system/utest/mtd",
"//zircon/system/utest/nand-redundant-storage",
#------------------
"//zircon/system/ulib/ftl-mtd/test:ftl-volume-wrapper",
#------------------
#------------------
"//zircon/system/utest/ftl-mtd:ftl-volume-wrapper-integration",
#------------------
#------------------
"//zircon/system/ulib/ftl-mtd/test:nand-volume-driver",
#------------------
]
}
}
group("host") {
testonly = true
metadata = {
# Prevent migrated host tests from being identified as "tools".
tool_barrier = []
}
deps = [
":legacy-tests",
":migrated-tests",
]
}
########################
# Verification
# Generate a file listing legacy tests.
write_file("$root_build_dir/legacy_zircon_host_tests.json",
available_tests,
"json")
raw_test_specs_file = "$root_build_dir/raw_migrated_zircon_host_tests.json"
test_list_file = "$root_build_dir/migrated_zircon_host_tests.json"
# Generate a file listing migrated tests.
generated_file("migrated-tests-list") {
testonly = true
deps = [ ":migrated-tests" ]
data_keys = [ "tests" ]
outputs = [ raw_test_specs_file ]
output_conversion = "json"
}
action("filter-migrated-tests-list") {
testonly = true
script = "//build/unification/tests/host/get_test_list.py"
inputs = [ raw_test_specs_file ]
outputs = [ test_list_file ]
args = [
"--source",
rebase_path(raw_test_specs_file),
"--output",
rebase_path(test_list_file),
]
deps = [ ":migrated-tests-list" ]
}
group("metadata") {
testonly = true
deps = [ ":filter-migrated-tests-list" ]
}