| # 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.cc", |
| ] |
| } |
| } |
| |
| 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.cc", |
| ] |
| 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}" ] |
| } |
| } |
| } |
| |
| executable("debugdata-test-helper") { |
| testonly = true |
| sources = [ |
| "debugdata-test-helper.cc", |
| ] |
| deps = [ |
| "$zx/system/ulib/zx", |
| ] |
| } |
| |
| test("debugdata") { |
| test_group = "c" |
| sources = [ |
| "debugdata.cc", |
| ] |
| data_deps = [ |
| ":debugdata-test-helper", |
| ] |
| deps = [ |
| "$zx/system/fidl/fuchsia-debugdata:llcpp", |
| "$zx/system/ulib/async", |
| "$zx/system/ulib/async:async-cpp", |
| "$zx/system/ulib/async-loop", |
| "$zx/system/ulib/async-loop:async-loop-cpp", |
| "$zx/system/ulib/fdio", |
| "$zx/system/ulib/fidl", |
| "$zx/system/ulib/fidl-async", |
| "$zx/system/ulib/fidl-async:fidl-async-cpp", |
| "$zx/system/ulib/fs", |
| "$zx/system/ulib/zircon-internal", |
| "$zx/system/ulib/zx", |
| "$zx/system/ulib/zxtest", |
| ] |
| } |
| |
| group("test") { |
| testonly = true |
| deps = [ |
| ":debugdata", |
| ":noop-tests.instrumented", |
| ] |
| foreach(case, default_stack_size_cases) { |
| deps += [ ":default-stack-size-${case.name}" ] |
| } |
| } |