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") |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 17 | |
| 18 | executable("test_binary") { |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 19 | include_dirs = [ |
| 20 | "//driver/linux/inc/uapi", |
Fuad Tabba | d949659 | 2019-08-13 09:49:54 +0100 | [diff] [blame] | 21 | "//third_party/linux/include/uapi", |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 22 | ] |
| 23 | |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 24 | testonly = true |
| 25 | sources = [ |
| 26 | "linux.c", |
| 27 | ] |
| 28 | deps = [ |
| 29 | "//test/hftest:hftest_linux", |
| 30 | ] |
| 31 | output_name = "test_binary" |
| 32 | } |
| 33 | |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 34 | vm_kernel("socket_vm0") { |
| 35 | testonly = true |
| 36 | |
| 37 | deps = [ |
| 38 | ":hftest_secondary_vm_socket", |
| 39 | ] |
| 40 | } |
| 41 | |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 42 | linux_initrd("linux_test_initrd") { |
| 43 | testonly = true |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 44 | |
| 45 | # Always use the aarch64_linux_clang toolchain to build test_binary |
| 46 | test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 47 | sources = [ |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 48 | get_label_info(test_binary_target, "root_out_dir") + "/test_binary", |
| 49 | get_label_info("//driver:linux", "target_out_dir") + "/hafnium.ko", |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 50 | ] |
| 51 | deps = [ |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 52 | "//driver:linux", |
David Brazdil | 3f509e0 | 2019-07-01 12:42:25 +0100 | [diff] [blame] | 53 | test_binary_target, |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 54 | ] |
| 55 | } |
| 56 | |
| 57 | initrd("linux_test") { |
| 58 | testonly = true |
| 59 | |
David Brazdil | 7a462ec | 2019-08-15 12:27:47 +0100 | [diff] [blame^] | 60 | manifest = "manifest.dts" |
David Brazdil | 4b0e111 | 2019-07-30 18:28:01 +0100 | [diff] [blame] | 61 | primary_vm = "//third_party:linux__prebuilt" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 62 | primary_initrd = ":linux_test_initrd" |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 63 | secondary_vms = [ [ |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 64 | "socket0", |
| 65 | ":socket_vm0", |
| 66 | ] ] |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | group("linux") { |
| 70 | testonly = true |
| 71 | |
| 72 | deps = [ |
| 73 | ":linux_test", |
| 74 | ] |
| 75 | } |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 76 | |
| 77 | # Testing framework for a secondary VM with socket. |
| 78 | source_set("hftest_secondary_vm_socket") { |
| 79 | testonly = true |
| 80 | |
| 81 | configs += [ "//test/hftest:hftest_config" ] |
| 82 | |
| 83 | sources = [ |
| 84 | "hftest_socket.c", |
| 85 | ] |
| 86 | |
| 87 | deps = [ |
| 88 | "//src:dlog", |
| 89 | "//src:panic", |
| 90 | "//src:std", |
| 91 | "//src/arch/${plat_arch}:entry", |
| 92 | "//src/arch/${plat_arch}/hftest:entry", |
| 93 | "//src/arch/${plat_arch}/hftest:power_mgmt", |
| 94 | ] |
| 95 | } |