blob: 77d2c0f9da3675b89c58419f7568c0f1a3a5a636 [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.
# This is just a basic test that program loading and libc startup works.
# It's "hello world" without the ostentation.
if (toolchain.tool_dir == "") {
# Don't test random host compilers that might not actually work just
# because variants like gcc exist. If it's configured as the primary
# host compiler via $variants, then you'll know if it works or not.
# We can't just avoid the dependency below easily, because tool_dir
# is only decided inside the c_toolchain() instantiation itself.
group("noop.${toolchain.variant}") {
}
} else {
test("noop") {
sources = [
"noop-test.cpp",
]
}
}
group("noop-tests.instrumented") {
testonly = true
deps = [
":noop",
]
# Generate a variant-suffixed noop test for each instrumented variant.
# Those all have their own libprefix so they can coexist in the
# filesystem with other variants. Other variants would need to be
# tested in separate filesystem namespaces.
# TODO(BLD-448): Test all variants when we have sandboxed packages
# and can put each variant in its own package.
foreach(selector, toolchain.variant_selectors) {
if (selector.tags + [ "instrumented" ] - [ "instrumented" ] !=
selector.tags) {
deps += [ ":noop.${selector.variant}" ]
}
}
}
group("noop-tests") {
testonly = true
deps = [
":noop",
]
foreach(selector, toolchain.variant_selectors) {
deps += [ ":noop.${selector.variant}" ]
}
}
default_stack_size_cases = [
{
# This uses the compiled-in default.
name = "default"
},
{
# This uses an arbitrary, non-default size. It needs to be an even
# multiple of page size, since specified sizes are always rounded up.
name = "phdr"
size = 1114112 # 0x110000
},
]
foreach(case, default_stack_size_cases) {
test("default-stack-size-${case.name}") {
sources = [
"default-stack-size-test.cpp",
]
deps = [
"$zx/system/ulib/fdio",
"$zx/system/ulib/zircon-internal",
"$zx/system/ulib/zxtest",
]
if (defined(case.size)) {
defines = [ "STACK_TEST_EXPECTED_SIZE=${case.size}" ]
ldflags = [ "-Wl,-z,stack-size=${case.size}" ]
}
}
}
group("test") {
testonly = true
deps = [
":noop-tests.instrumented",
]
foreach(case, default_stack_size_cases) {
deps += [ ":default-stack-size-${case.name}" ]
}
}