| # Copyright 2019 The Hafnium Authors. |
| # |
| # Use of this source code is governed by a BSD-style |
| # license that can be found in the LICENSE file or at |
| # https://opensource.org/licenses/BSD-3-Clause. |
| |
| import("//build/image/image.gni") |
| import("//build/toolchain/platform.gni") |
| import("//test/hftest/args.gni") |
| |
| executable("test_binary") { |
| include_dirs = [ |
| "//driver/linux/inc/uapi", |
| "//third_party/linux/include/uapi", |
| ] |
| |
| testonly = true |
| sources = [ |
| "linux.c", |
| ] |
| deps = [ |
| "//test/hftest:hftest_linux", |
| ] |
| output_name = "test_binary" |
| } |
| |
| vm_kernel("socket_vm1") { |
| testonly = true |
| |
| deps = [ |
| ":hftest_secondary_vm_socket", |
| ] |
| } |
| |
| linux_initrd("linux_test_initrd") { |
| testonly = true |
| |
| # Always use the aarch64_linux_clang toolchain to build test_binary |
| test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)" |
| |
| files = [ |
| [ |
| get_label_info(test_binary_target, "root_out_dir") + "/test_binary", |
| test_binary_target, |
| ], |
| [ |
| get_label_info("//driver/linux", "target_out_dir") + "/hafnium.ko", |
| "//driver/linux", |
| ], |
| ] |
| } |
| |
| manifest("linux_test_manifest") { |
| source = "manifest.dts" |
| output = "manifest.dtb" |
| overlay = hftest_manifest_overlay |
| } |
| |
| initrd("linux_test") { |
| testonly = true |
| |
| files = [ |
| [ |
| "manifest.dtb", |
| ":linux_test_manifest", |
| "manifest.dtb", |
| ], |
| [ |
| "vmlinuz", |
| "//third_party/linux:linux__prebuilt", |
| "linux__prebuilt.bin", |
| ], |
| [ |
| "initrd.img", |
| ":linux_test_initrd", |
| "linux_test_initrd/initrd.img", |
| ], |
| [ |
| "socket0", |
| ":socket_vm1", |
| "socket_vm1.bin", |
| ], |
| ] |
| } |
| |
| group("linux") { |
| testonly = true |
| |
| deps = [ |
| ":linux_test", |
| ] |
| } |
| |
| # Testing framework for a secondary VM with socket. |
| source_set("hftest_secondary_vm_socket") { |
| testonly = true |
| |
| configs += [ "//test/hftest:hftest_config" ] |
| |
| sources = [ |
| "hftest_socket.c", |
| ] |
| |
| deps = [ |
| "//src:dlog", |
| "//src:panic", |
| "//src:std", |
| "//src/arch/${plat_arch}:entry", |
| "//src/arch/${plat_arch}/hftest:entry", |
| "//src/arch/${plat_arch}/hftest:power_mgmt", |
| ] |
| } |