blob: 6112459011cfc0ebb4a83982dd6d8fdc28b04f44 [file] [log] [blame] [edit]
# Copyright 2016 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/fidl/fidl.gni")
import("//build/test/test_package.gni")
executable("bin") {
output_name = "fuchsia_microbenchmarks"
testonly = true
sources = [
"async_loop.cc",
"atomics.cc",
"channels.cc",
"clock.cc",
"context_switch_overhead.cc",
"events.cc",
"example.cc",
"fdio_spawn.cc",
"fifos.cc",
"filesystem.cc",
"get_info.cc",
"handle.cc",
"handle_creation.cc",
"inspect.cc",
"lazy_dir.cc",
"malloc.cc",
"mem_alloc.cc",
"memcpy.cc",
"mmu.cc",
"mutex.cc",
"null.cc",
"object_wait.cc",
"ports.cc",
"prng.cc",
"pseudo_dir.cc",
"pthreads.cc",
"random_memcpy.cc",
"round_trips.cc",
"sleep.cc",
"sockets.cc",
"streams.cc",
"syscalls.cc",
"test_runner.cc",
"threads.cc",
"timer.cc",
"util.cc",
"vmo.cc",
]
deps = [
":fidl_interface",
"//sdk/lib/fdio",
"//src/lib/fsl",
"//src/lib/fxl",
"//src/zircon/lib/zircon",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fs",
"//zircon/system/ulib/inspect",
]
public_deps = [ "//zircon/system/ulib/perftest" ]
}
# "Helper" executable used to implement the fdio_spawn benchmark.
executable("fdio_spawn_helper") {
output_name = "fdio_spawn_helper"
testonly = true
sources = [ "fdio_spawn_helper.cc" ]
deps = []
public_deps = []
}
# "Helper" executable used to implement the context_switch_overhead benchmark.
executable("context_switch_overhead_helper") {
output_name = "context_switch_overhead_helper"
testonly = true
sources = [ "context_switch_overhead_helper.cc" ]
deps = [
"//sdk/fidl/fuchsia.scheduler",
"//sdk/lib/fdio",
"//sdk/lib/sys/cpp",
"//sdk/lib/syslog/cpp",
"//zircon/public/lib/zx",
]
}
# "Helper" executable used to implement the get_info benchmark.
executable("get_info_helper") {
output_name = "get_info_helper"
testonly = true
sources = [ "get_info_helper.cc" ]
deps = [
"//sdk/lib/fdio",
"//zircon/public/lib/zx",
]
}
fidl("fidl_interface") {
# TODO(fxbug.dev/35879): Remove lint exclusions by fixing known FIDL lint violations in this target
excluded_checks = [ "protocol-name-includes-service" ]
testonly = true
name = "fuchsia.zircon.benchmarks"
sources = [
"async_loop.fidl",
"round_trip_service.fidl",
]
}
# Installing this package causes fuchsia_microbenchmarks to be run in unit
# test mode (fast mode) via runtests.
#
# This package requires fuchsia_microbenchmarks_perftestmode to also be
# installed.
#
# This package's copy of fuchsia_microbenchmarks invokes both itself
# (fuchsia_microbenchmarks) and fdio_spawn_helper as subprocesses, but it
# does so via the redirector executables in /bin (via the shell-commands
# package). Those point to the copies of those executables in
# fuchsia_microbenchmarks_perftestmode, which is why that package is
# required.
#
# Since Fuchsia packages cannot declare dependencies on other packages, GN
# targets that require fuchsia_microbenchmarks_unittestmode should depend
# on the fuchsia_microbenchmarks group() instead.
#
# The reason for splitting fuchsia_microbenchmarks into two packages like
# this is that we don't want to run fuchsia_microbenchmarks in unit test
# mode on the terminal-x64-release builder that runs SL4F tests, for two
# reasons:
#
# 1) The unit tests run on other builders, so it's unnecessary to run them
# a second time.
# 2) Running unit tests on the terminal-x64-release builder currently does
# not work: It results in the creation of a shard to run tests under
# QEMU, but running Fuchsia on QEMU on that builder does not work
# (perhaps because of missing dependencies).
test_package("fuchsia_microbenchmarks_unittestmode") {
package_name = "fuchsia_microbenchmarks"
deps = [ ":bin" ]
binaries = [
{
name = "fuchsia_microbenchmarks"
},
]
tests = [
{
name = "fuchsia_microbenchmarks"
},
]
}
# This package contains the fuchsia_microbenchmarks executable and installs
# a redirector executable for it in /bin (via the shell-commands package).
# Installing this package allows fuchsia_microbenchmarks to be run by SL4F
# tests as a performance test (i.e. outputting performance results data).
# This package can be installed without installing the
# fuchsia_microbenchmarks_unittestmode package.
package("fuchsia_microbenchmarks_perftestmode") {
testonly = true
deps = [
":bin",
":context_switch_overhead_helper",
":fdio_spawn_helper",
":get_info_helper",
]
binaries = [
{
name = "fdio_spawn_helper"
shell = true
},
{
name = "context_switch_overhead_helper"
shell = true
},
{
name = "get_info_helper"
shell = true
},
{
name = "fuchsia_microbenchmarks"
shell = true
},
]
}
# This contains all the dependencies necessary for running
# fuchsia_microbenchmarks in unit test mode.
group("tests") {
testonly = true
deps = [
":fuchsia_microbenchmarks_perftestmode",
":fuchsia_microbenchmarks_unittestmode",
]
}
# Convenience target so that one can pass "--with //src/tests/microbenchmarks"
# to "fx set".
group("microbenchmarks") {
testonly = true
deps = [ ":tests" ]
}