blob: afb20bdf8d5d311ec0465f7f90cf99ae1cfd0ca1 [file] [log] [blame]
# Copyright 2022 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
import("//build/dist/resource.gni")
import("//build/testing/boot_tests/zbi_test.gni")
import("//zircon/kernel/kernel_package.gni")
import("//zircon/kernel/phys/kernel_elf_interp.gni")
import("//zircon/kernel/phys/test/physload_binary_test.gni")
import("//zircon/kernel/phys/zbi_executable.gni")
source_set("get-int.source") {
sources = [ "get-int.cc" ]
}
template("get_int") {
loadable_module(target_name) {
visibility = [ ":*" ]
testonly = true
ldflags = [ "-Wl,-e,GetInt" ]
deps = [ ":get-int.source" ]
if (defined(invoker.deps)) {
deps += invoker.deps
}
metadata = {
# This is the same metadata as a resource() target would have.
distribution_entries = [
{
source = rebase_path("$root_out_dir/$target_name.so", root_build_dir)
destination = target_name
label = get_label_info(":$target_name", "label_with_toolchain")
},
]
}
}
}
zbi_executable("basic-elf-loading-test") {
visibility = [ ":*" ]
testonly = true
sources = [ "basic-test.cc" ]
deps = [
"..:zbi-test-main",
"//src/lib/elfldltl",
"//src/lib/zbitl",
"//zircon/kernel/lib/ktl",
"//zircon/kernel/lib/libc",
"//zircon/kernel/phys:address-space",
"//zircon/kernel/phys:elf-image",
"//zircon/kernel/phys:kernel-package",
"//zircon/kernel/phys:zbi-memory",
"//zircon/kernel/phys:zbitl-allocation",
]
}
kernel_elf_interp("basic-elf-loading-test.interp") {
visibility = [ ":*" ]
testonly = true
deps = [ ":basic-elf-loading-test" ]
}
kernel_package("basic-elf-loading-test-data") {
visibility = [ ":*" ]
testonly = true
deps = [ ":get-int.basic-elf-loading-test($phys_toolchain)" ]
}
get_int("get-int.basic-elf-loading-test") {
deps = [ ":basic-elf-loading-test.interp" ]
}
zbi_test("zbi-basic-elf-loading-test") {
deps = [
":basic-elf-loading-test",
":basic-elf-loading-test-data",
]
}
physload_binary_test("virtual-address-loading-test") {
visibility = [ ":*" ]
has_patches = false
sources = [ "virtual-address-test.cc" ]
deps = [
"//src/lib/elfldltl",
"//src/lib/zbitl",
"//zircon/kernel/lib/arch",
"//zircon/kernel/lib/ktl",
"//zircon/kernel/lib/libc",
"//zircon/kernel/phys:address-space",
"//zircon/kernel/phys:elf-image",
"//zircon/kernel/phys:kernel-package",
"//zircon/kernel/phys:symbolize",
]
data_deps = [ ":get-int.virtual-address-loading-test($phys_toolchain)" ]
}
kernel_elf_interp("virtual-address-loading-test.interp") {
visibility = [ ":*" ]
testonly = true
deps = [ ":virtual-address-loading-test.binary" ]
}
get_int("get-int.virtual-address-loading-test") {
deps = [ ":virtual-address-loading-test.interp" ]
}
group("elf-loading") {
testonly = true
deps = [
":virtual-address-loading-test",
":zbi-basic-elf-loading-test",
]
}