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 | 4b0e111 | 2019-07-30 18:28:01 +0100 | [diff] [blame] | 60 | primary_vm = "//third_party:linux__prebuilt" |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 61 | primary_initrd = ":linux_test_initrd" |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 62 | secondary_vms = [ [ |
| 63 | "1048576", |
| 64 | "1", |
| 65 | "socket0", |
| 66 | ":socket_vm0", |
| 67 | ] ] |
Andrew Walbran | bc342d4 | 2019-02-05 16:56:02 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | group("linux") { |
| 71 | testonly = true |
| 72 | |
| 73 | deps = [ |
| 74 | ":linux_test", |
| 75 | ] |
| 76 | } |
Fuad Tabba | bfa42bc | 2019-08-06 13:45:50 +0100 | [diff] [blame] | 77 | |
| 78 | # Testing framework for a secondary VM with socket. |
| 79 | source_set("hftest_secondary_vm_socket") { |
| 80 | testonly = true |
| 81 | |
| 82 | configs += [ "//test/hftest:hftest_config" ] |
| 83 | |
| 84 | sources = [ |
| 85 | "hftest_socket.c", |
| 86 | ] |
| 87 | |
| 88 | deps = [ |
| 89 | "//src:dlog", |
| 90 | "//src:panic", |
| 91 | "//src:std", |
| 92 | "//src/arch/${plat_arch}:entry", |
| 93 | "//src/arch/${plat_arch}/hftest:entry", |
| 94 | "//src/arch/${plat_arch}/hftest:power_mgmt", |
| 95 | ] |
| 96 | } |