blob: fcc59075f13abaef2eef5e326d5e95b1d8cce6df [file] [log] [blame]
Andrew Walbranbc342d42019-02-05 16:56:02 +00001# 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
15import("//build/image/image.gni")
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010016import("//build/toolchain/platform.gni")
Andrew Walbranbc342d42019-02-05 16:56:02 +000017
18executable("test_binary") {
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010019 include_dirs = [
20 "//driver/linux/inc/uapi",
Fuad Tabbad9496592019-08-13 09:49:54 +010021 "//third_party/linux/include/uapi",
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010022 ]
23
Andrew Walbranbc342d42019-02-05 16:56:02 +000024 testonly = true
25 sources = [
26 "linux.c",
27 ]
28 deps = [
29 "//test/hftest:hftest_linux",
30 ]
31 output_name = "test_binary"
32}
33
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010034vm_kernel("socket_vm0") {
35 testonly = true
36
37 deps = [
38 ":hftest_secondary_vm_socket",
39 ]
40}
41
Andrew Walbranbc342d42019-02-05 16:56:02 +000042linux_initrd("linux_test_initrd") {
43 testonly = true
David Brazdil3f509e02019-07-01 12:42:25 +010044
45 # Always use the aarch64_linux_clang toolchain to build test_binary
46 test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)"
Andrew Walbranbc342d42019-02-05 16:56:02 +000047 sources = [
David Brazdil3f509e02019-07-01 12:42:25 +010048 get_label_info(test_binary_target, "root_out_dir") + "/test_binary",
49 get_label_info("//driver:linux", "target_out_dir") + "/hafnium.ko",
Andrew Walbranbc342d42019-02-05 16:56:02 +000050 ]
51 deps = [
Andrew Walbranbc342d42019-02-05 16:56:02 +000052 "//driver:linux",
David Brazdil3f509e02019-07-01 12:42:25 +010053 test_binary_target,
Andrew Walbranbc342d42019-02-05 16:56:02 +000054 ]
55}
56
57initrd("linux_test") {
58 testonly = true
59
David Brazdil7a462ec2019-08-15 12:27:47 +010060 manifest = "manifest.dts"
David Brazdil4b0e1112019-07-30 18:28:01 +010061 primary_vm = "//third_party:linux__prebuilt"
Andrew Walbranbc342d42019-02-05 16:56:02 +000062 primary_initrd = ":linux_test_initrd"
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010063 secondary_vms = [ [
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010064 "socket0",
65 ":socket_vm0",
66 ] ]
Andrew Walbranbc342d42019-02-05 16:56:02 +000067}
68
69group("linux") {
70 testonly = true
71
72 deps = [
73 ":linux_test",
74 ]
75}
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010076
77# Testing framework for a secondary VM with socket.
78source_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}