blob: 6dc28b62f01b409b081d35f34d45d93aa1658877 [file] [log] [blame]
# Copyright 2024 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/components.gni")
import("//build/rust/rustc_library.gni")
import("//build/testing/cc_test_executable.gni")
rustc_library("elf_parse") {
with_unit_tests = true
edition = "2024"
deps = [
"//sdk/rust/zx",
"//third_party/rust_crates:bitflags",
"//third_party/rust_crates:num-derive",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:static_assertions",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:zerocopy",
]
test_deps = [
"//src/lib/fdio/rust:fdio",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:assert_matches",
]
sources = [ "src/lib.rs" ]
inputs = [
"test-utils/elf_aarch64_file-header.bin",
"test-utils/elf_x86-64_file-header.bin",
"test-utils/elf_riscv64_file-header.bin",
]
}
cc_test_executable("static_pie_test_util") {
visibility = [
":*",
"//src/lib/process_builder:*",
]
testonly = true
output_name = "static_pie_test_util"
sources = [ "test-utils/static_pie_test_util.cc" ]
configs -= [ "//build/config/fuchsia:fdio_config" ]
configs += [ "//build/config:standalone" ]
ldflags = [ "-Wl,-z,stack-size=0x40000" ]
deps = [ "//sdk/lib/c:static" ]
# The static libc.a doesn't handle the setup needed for things like ASan.
exclude_toolchain_tags = [ "uses-shadow" ]
}
fuchsia_unittest_package("elf_parse_tests") {
deps = [ ":elf_parse_test" ]
data_deps = [ ":static_pie_test_util" ]
}
group("tests") {
testonly = true
deps = [ ":elf_parse_tests" ]
}