blob: eb7cb10bafd76645cbad572c082f5cc46aa563c8 [file] [log] [blame]
# Copyright 2022 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/dist/renamed_binary.gni")
import("//build/test.gni")
group("tests") {
testonly = true
deps = [ ":fuzzer-test-integration-tests-pkg" ]
# Realm fuzzers are designed to be built with a dedicated toolchain variant and use
# `fuchsia.debugdata.Publisher` to transport code coverage via test_manager's fuzz_coverage
# component. The integration tests provide a fake fuzz_coverage component that is explicitly
# routed to fuzzers. Unfortunately, in 'coverage' builds the test realm prefers the route
# provided by the 'debug' field of test_manager's "test_env" environment over the explicit one. As
# a result, these integration tests are disabled under 'coverage' builds.
if (!is_coverage) {
deps += [ ":fuzzer-integration-tests-pkg" ]
}
}
# This package contains integration tests that use the "real" fuzzing engine, which generates inputs
# to drive a simple test fuzzer, to imitates a real fuzzer.
executable("fuzzer-bin") {
testonly = true
output_name = "realmfuzzer_test_fuzzer"
deps = [
"//src/sys/fuzzing/common/testing:sanitizer",
"//src/sys/fuzzing/common/tests:fuzzer-lib",
"//src/sys/fuzzing/realmfuzzer/adapters:llvm",
"//src/sys/fuzzing/realmfuzzer/target",
]
exclude_toolchain_tags = [ "instrumented" ]
}
fuchsia_test_component("fuzzer") {
manifest = "meta/fuzzer.cml"
deps = [
":fuzzer-bin",
"//src/sys/fuzzing/common/testing/data:corpus",
]
}
test("integration-test-bin") {
output_name = "realmfuzzer_integration_tests"
sources = [ "integration-tests.cc" ]
deps = [
"//src/sys/fuzzing/common/testing",
"//src/sys/fuzzing/common/tests:integration-tests-lib",
"//src/sys/fuzzing/fidl:fuchsia.fuzzer_hlcpp",
]
}
fuchsia_test_component("engine") {
manifest = "meta/engine.cml"
deps = [
":integration-test-bin",
"//src/sys/fuzzing/realmfuzzer/engine:engine-bin",
]
}
fuchsia_test_component("fuzzer-integration-tests") {
manifest = "meta/integration-tests.cml"
deps = [ ":engine" ]
}
# See the notes on ":tests" above. The fake fuzz_coverage component is not compatible with coverage
# builds.
if (!is_coverage) {
fuchsia_test_package("fuzzer-integration-tests-pkg") {
package_name = "realmfuzzer-integration-tests"
test_components = [ ":fuzzer-integration-tests" ]
deps = [
":fuzzer",
"//src/sys/fuzzing/realmfuzzer/testing:coverage",
]
}
}
# This package contains integration tests that use a test "engine", which uses fixed inputs to drive
# a simple test fuzzer without instrumentation, to imitate the fuzzer tests that run in CQ.
executable("fuzzer-uninstrumented-bin") {
testonly = true
output_name = "realmfuzzer_test_fuzzer_uninstrumented"
deps = [
"../adapters:llvm",
"//src/sys/fuzzing/common/tests:fuzzer-lib",
]
exclude_toolchain_tags = [ "instrumented" ]
}
renamed_binary("fuzzer-uninstrumented-renamed") {
testonly = true
dest = "bin/realmfuzzer_test_fuzzer"
source = "$root_out_dir/realmfuzzer_test_fuzzer_uninstrumented"
source_deps = [ ":fuzzer-uninstrumented-bin" ]
}
fuchsia_test_component("fuzzer-uninstrumented") {
component_name = "fuzzer"
manifest = "meta/fuzzer-uninstrumented.cml"
deps = [
":fuzzer-uninstrumented-renamed",
"//src/sys/fuzzing/common/testing/data:corpus",
]
}
fuchsia_test_component("fuzzer-test-integration-test") {
manifest = "../testing/meta/engine.cml"
deps = [
":fuzzer-uninstrumented",
"//src/sys/fuzzing/realmfuzzer/testing:engine",
]
}
fuchsia_test_package("fuzzer-test-integration-tests-pkg") {
package_name = "realmfuzzer-test-integration-test"
test_components = [ ":fuzzer-test-integration-test" ]
}