Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 1 | # Copyright 2019 The Hafnium Authors. |
| 2 | # |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame^] | 3 | # Use of this source code is governed by a BSD-style |
| 4 | # license that can be found in the LICENSE file or at |
| 5 | # https://opensource.org/licenses/BSD-3-Clause. |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 6 | |
| 7 | import("//build/image/image.gni") |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 8 | import("//build/toolchain/platform.gni") |
David Brazdil | 8995755 | 2020-01-31 19:03:19 +0000 | [diff] [blame] | 9 | import("//test/hftest/args.gni") |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 10 | |
| 11 | executable("test_binary") { |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 12 | include_dirs = [ |
| 13 | "//driver/linux/inc/uapi", |
Fuad Tabba | d949659 | 2019-08-13 09:49:54 +0100 | [diff] [blame] | 14 | "//third_party/linux/include/uapi", |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 15 | ] |
| 16 | |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 17 | testonly = true |
| 18 | sources = [ |
| 19 | "linux.c", |
| 20 | ] |
| 21 | deps = [ |
| 22 | "//test/hftest:hftest_linux", |
| 23 | ] |
| 24 | output_name = "test_binary" |
| 25 | } |
| 26 | |
Fuad Tabba | 7bd1413 | 2019-11-07 14:18:52 +0000 | [diff] [blame] | 27 | vm_kernel("socket_vm1") { |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 28 | testonly = true |
| 29 | |
| 30 | deps = [ |
| 31 | ":hftest_secondary_vm_socket", |
| 32 | ] |
| 33 | } |
| 34 | |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 35 | linux_initrd("linux_test_initrd") { |
| 36 | testonly = true |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 37 | |
| 38 | # Always use the aarch64_linux_clang toolchain to build test_binary |
| 39 | test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 40 | sources = [ |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 41 | get_label_info(test_binary_target, "root_out_dir") + "/test_binary", |
David Brazdil | cb92ba1 | 2019-12-23 14:15:08 +0000 | [diff] [blame] | 42 | get_label_info("//driver/linux", "target_out_dir") + "/hafnium.ko", |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 43 | ] |
| 44 | deps = [ |
David Brazdil | cb92ba1 | 2019-12-23 14:15:08 +0000 | [diff] [blame] | 45 | "//driver/linux", |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 46 | test_binary_target, |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 47 | ] |
| 48 | } |
| 49 | |
| 50 | initrd("linux_test") { |
| 51 | testonly = true |
| 52 | |
David Brazdil | 7a462ec | 2019-08-15 12:27:47 +0100 | [diff] [blame] | 53 | manifest = "manifest.dts" |
David Brazdil | 8995755 | 2020-01-31 19:03:19 +0000 | [diff] [blame] | 54 | manifest_overlay = hftest_manifest_overlay |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 55 | primary_name = "vmlinuz" |
David Brazdil | 33cc5c0 | 2019-12-10 10:44:14 +0000 | [diff] [blame] | 56 | primary_vm = "//third_party/linux:linux__prebuilt" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 57 | primary_initrd = ":linux_test_initrd" |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 58 | secondary_vms = [ [ |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 59 | "socket0", |
Fuad Tabba | 7bd1413 | 2019-11-07 14:18:52 +0000 | [diff] [blame] | 60 | ":socket_vm1", |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 61 | ] ] |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | group("linux") { |
| 65 | testonly = true |
| 66 | |
| 67 | deps = [ |
| 68 | ":linux_test", |
| 69 | ] |
| 70 | } |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 71 | |
| 72 | # Testing framework for a secondary VM with socket. |
| 73 | source_set("hftest_secondary_vm_socket") { |
| 74 | testonly = true |
| 75 | |
| 76 | configs += [ "//test/hftest:hftest_config" ] |
| 77 | |
| 78 | sources = [ |
| 79 | "hftest_socket.c", |
| 80 | ] |
| 81 | |
| 82 | deps = [ |
| 83 | "//src:dlog", |
| 84 | "//src:panic", |
| 85 | "//src:std", |
| 86 | "//src/arch/${plat_arch}:entry", |
| 87 | "//src/arch/${plat_arch}/hftest:entry", |
| 88 | "//src/arch/${plat_arch}/hftest:power_mgmt", |
| 89 | ] |
| 90 | } |