| # 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. |
| |
| import("//build/dist/resource.gni") |
| import("//build/fuzzing/fuzzer.gni") |
| import("//build/test.gni") |
| import("//build/testing/bootfs_test.gni") |
| import("//build/zbi/zbi.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":zbi-bootfs-fuzzers" ] |
| } |
| |
| test("zbi-bootfs-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 = [ "zbi-bootfs-test.cc" ] |
| deps = [ |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/zbi-bootfs", |
| ] |
| data_deps = [ |
| ":generated-lz4f-zbi", |
| ":generated-zstd-zbi", |
| ] |
| } |
| |
| resource("generated-lz4f-zbi") { |
| sources = [ "$target_out_dir/generated-lz4f.zbi" ] |
| outputs = [ "testdata/zbi-bootfs/generated-lz4f.zbi" ] |
| deps = [ ":generated-lz4f" ] |
| |
| testonly = true |
| } |
| |
| resource("generated-zstd-zbi") { |
| sources = [ "$target_out_dir/generated-zstd.zbi" ] |
| outputs = [ "testdata/zbi-bootfs/generated-zstd.zbi" ] |
| deps = [ ":generated-zstd" ] |
| |
| testonly = true |
| } |
| |
| # Generate zbi images for tests. |
| zbi("generated-zstd") { |
| compress = "zstd" |
| |
| testonly = true |
| cpu = "" |
| deps = [ ":create-zbi-image" ] |
| } |
| |
| zbi("generated-lz4f") { |
| compress = "lz4f" |
| |
| testonly = true |
| cpu = "" |
| deps = [ ":create-zbi-image" ] |
| } |
| |
| zbi_input("create-zbi-image") { |
| testonly = true |
| sources = [ "//zircon/system/ulib/zbi-bootfs/test/payload/" ] |
| } |
| |
| bootfs_test("zbi-bootfs-test-bootfs-test") { |
| name = "zbi-bootfs-test" |
| deps = [ ":zbi-bootfs-test" ] |
| } |
| |
| fuzzer("zbi-bootfs-fuzzer") { |
| sources = [ "zbi-bootfs-fuzzer.cc" ] |
| deps = [ "//zircon/system/ulib/zbi-bootfs" ] |
| } |
| |
| fuzzers_package("zbi-bootfs-fuzzers") { |
| cpp_fuzzers = [ ":zbi-bootfs-fuzzer" ] |
| } |