Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 1 | # Copyright 2019 The Hafnium Authors. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | import("//build/image/image.gni") |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 16 | import("//build/toolchain/platform.gni") |
David Brazdil | 8995755 | 2020-01-31 19:03:19 +0000 | [diff] [blame^] | 17 | import("//test/hftest/args.gni") |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 18 | |
| 19 | executable("test_binary") { |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 20 | include_dirs = [ |
| 21 | "//driver/linux/inc/uapi", |
Fuad Tabba | d949659 | 2019-08-13 09:49:54 +0100 | [diff] [blame] | 22 | "//third_party/linux/include/uapi", |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 23 | ] |
| 24 | |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 25 | testonly = true |
| 26 | sources = [ |
| 27 | "linux.c", |
| 28 | ] |
| 29 | deps = [ |
| 30 | "//test/hftest:hftest_linux", |
| 31 | ] |
| 32 | output_name = "test_binary" |
| 33 | } |
| 34 | |
Fuad Tabba | 7bd1413 | 2019-11-07 14:18:52 +0000 | [diff] [blame] | 35 | vm_kernel("socket_vm1") { |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 36 | testonly = true |
| 37 | |
| 38 | deps = [ |
| 39 | ":hftest_secondary_vm_socket", |
| 40 | ] |
| 41 | } |
| 42 | |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 43 | linux_initrd("linux_test_initrd") { |
| 44 | testonly = true |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 45 | |
| 46 | # Always use the aarch64_linux_clang toolchain to build test_binary |
| 47 | test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 48 | sources = [ |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 49 | get_label_info(test_binary_target, "root_out_dir") + "/test_binary", |
David Brazdil | cb92ba1 | 2019-12-23 14:15:08 +0000 | [diff] [blame] | 50 | get_label_info("//driver/linux", "target_out_dir") + "/hafnium.ko", |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 51 | ] |
| 52 | deps = [ |
David Brazdil | cb92ba1 | 2019-12-23 14:15:08 +0000 | [diff] [blame] | 53 | "//driver/linux", |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 54 | test_binary_target, |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 55 | ] |
| 56 | } |
| 57 | |
| 58 | initrd("linux_test") { |
| 59 | testonly = true |
| 60 | |
David Brazdil | 7a462ec | 2019-08-15 12:27:47 +0100 | [diff] [blame] | 61 | manifest = "manifest.dts" |
David Brazdil | 8995755 | 2020-01-31 19:03:19 +0000 | [diff] [blame^] | 62 | manifest_overlay = hftest_manifest_overlay |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame] | 63 | primary_name = "vmlinuz" |
David Brazdil | 33cc5c0 | 2019-12-10 10:44:14 +0000 | [diff] [blame] | 64 | primary_vm = "//third_party/linux:linux__prebuilt" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 65 | primary_initrd = ":linux_test_initrd" |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 66 | secondary_vms = [ [ |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 67 | "socket0", |
Fuad Tabba | 7bd1413 | 2019-11-07 14:18:52 +0000 | [diff] [blame] | 68 | ":socket_vm1", |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 69 | ] ] |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | group("linux") { |
| 73 | testonly = true |
| 74 | |
| 75 | deps = [ |
| 76 | ":linux_test", |
| 77 | ] |
| 78 | } |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 79 | |
| 80 | # Testing framework for a secondary VM with socket. |
| 81 | source_set("hftest_secondary_vm_socket") { |
| 82 | testonly = true |
| 83 | |
| 84 | configs += [ "//test/hftest:hftest_config" ] |
| 85 | |
| 86 | sources = [ |
| 87 | "hftest_socket.c", |
| 88 | ] |
| 89 | |
| 90 | deps = [ |
| 91 | "//src:dlog", |
| 92 | "//src:panic", |
| 93 | "//src:std", |
| 94 | "//src/arch/${plat_arch}:entry", |
| 95 | "//src/arch/${plat_arch}/hftest:entry", |
| 96 | "//src/arch/${plat_arch}/hftest:power_mgmt", |
| 97 | ] |
| 98 | } |