| # Copyright 2021 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") |
| |
| declare_args() { |
| # Which binary to use for //src/proc/bin/android:syscalls_test |
| # |
| # For example, set to "//local/starnix/syscalls" to use a locally built binary. |
| starnix_syscalls_test_label = |
| "//prebuilt/starnix/tests/syscalls/linux-amd64/syscalls" |
| } |
| |
| group("android") { |
| deps = [ ":android_system_image" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| if (target_cpu == "x64") { |
| deps = [ ":test_android_distro" ] |
| } |
| } |
| |
| template("tar_resource") { |
| main_target = target_name |
| untar_target = "${target_name}__untar" |
| manifest_file = "$target_gen_dir/$target_name.manifest.json" |
| action(untar_target) { |
| script = "tar_to_fini.py" |
| inputs = [ invoker.tarfile ] |
| outputs = [ manifest_file ] |
| depfile = "$target_gen_dir/$target_name.d" |
| args = [ |
| "--tar-file", |
| rebase_path(inputs[0], root_build_dir), |
| "--unpack-dir", |
| rebase_path("$target_gen_dir/$target_name", root_build_dir), |
| "--manifest-file", |
| rebase_path(manifest_file, root_build_dir), |
| "--dep-file", |
| rebase_path(depfile, root_build_dir), |
| ] |
| if (defined(invoker.subdir)) { |
| args += [ |
| "--package-subdir", |
| invoker.subdir, |
| ] |
| } |
| } |
| distribution_entries_from_fini(main_target) { |
| file = manifest_file |
| deps = [ ":$untar_target" ] |
| } |
| } |
| |
| tar_resource("android_system_image") { |
| tarfile = "//prebuilt/starnix/android-root-amd64/system.img.tar" |
| subdir = "root" |
| } |
| |
| resource("android_system_image_ext") { |
| sources = [ "//prebuilt/starnix/android-image-amd64/system.img" ] |
| outputs = [ "data/system.img" ] |
| } |
| |
| fuchsia_component("init") { |
| manifest = "meta/init.cml" |
| } |
| |
| fuchsia_component("sh") { |
| manifest = "meta/sh.cml" |
| } |
| |
| fuchsia_component("sh_test") { |
| testonly = true |
| check_references = false |
| deps = [ ":android_system_image" ] |
| manifest = "meta/sh_test.cml" |
| } |
| |
| system_image_gen_dir = get_label_info(":android_system_image", "target_gen_dir") |
| system_image_base = "$system_image_gen_dir/android_system_image__untar" |
| |
| resource("system_bin") { |
| sources = [ "$system_image_base/system/bin/bootstrap/linker64" ] |
| outputs = [ "root/system/bin/{{source_file_part}}" ] |
| deps = [ ":android_system_image" ] |
| } |
| |
| resource("syscalls_test_bin") { |
| sources = [ starnix_syscalls_test_label ] |
| outputs = [ "root/system/bin/syscalls_test" ] |
| } |
| |
| resource("starnix_tmp_placeholder") { |
| sources = [ "placeholder" ] |
| outputs = [ "root/tmp/.placeholder" ] |
| } |
| |
| resource("starnix_data_placeholder") { |
| sources = [ "placeholder" ] |
| outputs = [ "root/data/.placeholder" ] |
| } |
| |
| resource("starnix_dev_placeholder") { |
| sources = [ "placeholder" ] |
| outputs = [ "root/dev/.placeholder" ] |
| } |
| |
| fuchsia_component("syscalls_test") { |
| testonly = true |
| check_references = false |
| manifest = "meta/syscalls_test.cml" |
| deps = [ |
| ":starnix_data_placeholder", |
| ":starnix_dev_placeholder", |
| ":starnix_tmp_placeholder", |
| ":syscalls_test_bin", |
| ":system_bin", |
| ] |
| } |
| |
| template("gvisor_test_component") { |
| test_name = target_name |
| |
| resource("${test_name}_bin") { |
| sources = |
| [ "//prebuilt/starnix/tests/syscalls/linux-amd64/linux/${test_name}" ] |
| outputs = [ "root/system/bin/${test_name}" ] |
| } |
| |
| fuchsia_component(test_name) { |
| forward_variables_from(invoker, "*") |
| |
| testonly = true |
| check_references = false |
| manifest = "meta/${test_name}.cml" |
| deps = [ |
| ":${test_name}_bin", |
| ":android_system_image", |
| ] |
| } |
| } |
| |
| gvisor_test_component("access_test") { |
| } |
| |
| gvisor_test_component("brk_test") { |
| } |
| |
| gvisor_test_component("clock_getres_test") { |
| } |
| |
| gvisor_test_component("clock_gettime_test") { |
| } |
| |
| gvisor_test_component("exit_test") { |
| } |
| |
| gvisor_test_component("fork_test") { |
| } |
| |
| gvisor_test_component("getrandom_test") { |
| } |
| |
| gvisor_test_component("kill_test") { |
| } |
| |
| gvisor_test_component("lseek_test") { |
| } |
| |
| gvisor_test_component("munmap_test") { |
| } |
| |
| gvisor_test_component("pipe_test") { |
| } |
| |
| gvisor_test_component("sigaction_test") { |
| } |
| |
| gvisor_test_component("sigprocmask_test") { |
| } |
| |
| gvisor_test_component("sigaltstack_test") { |
| } |
| |
| gvisor_test_component("symlink_test") { |
| } |
| |
| fuchsia_test_package("test_android_distro") { |
| deps = [ |
| ":android_system_image", |
| ":android_system_image_ext", |
| ":init", |
| ":sh", |
| ":syscalls_test", |
| ] |
| |
| test_components = [ |
| ":access_test", |
| ":brk_test", |
| ":clock_getres_test", |
| ":clock_gettime_test", |
| ":exit_test", |
| ":fork_test", |
| ":getrandom_test", |
| ":kill_test", |
| ":lseek_test", |
| ":munmap_test", |
| ":pipe_test", |
| ":sh_test", |
| ":sigaction_test", |
| ":sigprocmask_test", |
| ":sigaltstack_test", |
| ":symlink_test", |
| ] |
| |
| # This package intentionally contains many non-Fuchia ELF binaries that |
| # are not under /data/, and some of them are even unstripped, so disable |
| # theses checks to build successfully. |
| disable_elf_binaries_checks = true |
| } |