| # 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. |
| |
| ########################################## |
| # Though under //zircon, this build file # |
| # is meant to be used in the Fuchsia GN # |
| # build. # |
| # See fxbug.dev/36139. # |
| ########################################## |
| |
| assert(!defined(zx) || zx != "/", |
| "This file can only be used in the Fuchsia GN build.") |
| |
| import("//build/test.gni") |
| import("//build/testing/bootfs_test.gni") |
| import("//src/sys/build/fuchsia_unittest_package.gni") |
| |
| 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}") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ "default-stack-size-test.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zxtest", |
| ] |
| if (defined(case.size)) { |
| defines = [ "STACK_TEST_EXPECTED_SIZE=${case.size}" ] |
| ldflags = [ "-Wl,-z,stack-size=${case.size}" ] |
| } |
| } |
| |
| fuchsia_unittest_package("default-stack-size-${case.name}-pkg") { |
| executable_path = "test/default-stack-size-${case.name}" |
| deps = [ ":default-stack-size-${case.name}" ] |
| } |
| } |
| |
| executable("debugdata-test-helper") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| |
| testonly = true |
| sources = [ "debugdata-test-helper.cc" ] |
| deps = [ "//zircon/public/lib/zx" ] |
| } |
| |
| test("cdebugdata-test") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ "debugdata.cc" ] |
| data_deps = [ ":debugdata-test-helper" ] |
| deps = [ |
| "//sdk/fidl/fuchsia.debugdata:fuchsia.debugdata_llcpp", |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/async", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/fidl", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fidl-async", |
| "//zircon/system/ulib/fidl-async:fidl-async-cpp", |
| "//zircon/system/ulib/fs", |
| ] |
| output_dir = "$root_out_dir/zircon-migrated" |
| } |
| |
| test("posix-clocks-test") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ "posix-clocks.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| test("pthread-detach-idempotent-test") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ "pthread_detach_idempotent.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| test("atexit-test") { |
| if (is_fuchsia) { |
| configs += [ |
| "//build/unification/config:zircon-migrated", |
| "//build/config:all_source", |
| ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ "atexit.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| group("test") { |
| testonly = true |
| deps = [ |
| ":atexit-test-pkg", |
| ":posix-clocks-test-pkg", |
| ":pthread-detach-idempotent-test-pkg", |
| "noop:tests", |
| ] |
| foreach(case, default_stack_size_cases) { |
| deps += [ ":default-stack-size-${case.name}-pkg" ] |
| } |
| } |
| |
| fuchsia_unittest_package("atexit-test-pkg") { |
| executable_path = "test/atexit-test" |
| deps = [ ":atexit-test" ] |
| } |
| |
| # TODO(gboone): Convert to fuchsia_unittest_package() and move to core. |
| bootfs_test("cdebugdata-test-bootfs-test") { |
| name = "cdebugdata-test" |
| deps = [ ":cdebugdata-test" ] |
| } |
| |
| fuchsia_unittest_package("posix-clocks-test-pkg") { |
| executable_path = "test/posix-clocks-test" |
| deps = [ ":posix-clocks-test" ] |
| } |
| |
| fuchsia_unittest_package("pthread-detach-idempotent-test-pkg") { |
| executable_path = "test/pthread-detach-idempotent-test" |
| deps = [ ":pthread-detach-idempotent-test" ] |
| } |