blob: 0807b2fb4253b32a6f23ca0f1fbafcdf52d2eb6d [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")
David Brazdil89957552020-01-31 19:03:19 +000017import("//test/hftest/args.gni")
Andrew Walbranbc342d42019-02-05 16:56:02 +000018
19executable("test_binary") {
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010020 include_dirs = [
21 "//driver/linux/inc/uapi",
Fuad Tabbad9496592019-08-13 09:49:54 +010022 "//third_party/linux/include/uapi",
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010023 ]
24
Andrew Walbranbc342d42019-02-05 16:56:02 +000025 testonly = true
26 sources = [
27 "linux.c",
28 ]
29 deps = [
30 "//test/hftest:hftest_linux",
31 ]
32 output_name = "test_binary"
33}
34
Fuad Tabba7bd14132019-11-07 14:18:52 +000035vm_kernel("socket_vm1") {
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010036 testonly = true
37
38 deps = [
39 ":hftest_secondary_vm_socket",
40 ]
41}
42
Andrew Walbranbc342d42019-02-05 16:56:02 +000043linux_initrd("linux_test_initrd") {
44 testonly = true
David Brazdil3f509e02019-07-01 12:42:25 +010045
46 # Always use the aarch64_linux_clang toolchain to build test_binary
47 test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)"
Andrew Walbranbc342d42019-02-05 16:56:02 +000048 sources = [
David Brazdil3f509e02019-07-01 12:42:25 +010049 get_label_info(test_binary_target, "root_out_dir") + "/test_binary",
David Brazdilcb92ba12019-12-23 14:15:08 +000050 get_label_info("//driver/linux", "target_out_dir") + "/hafnium.ko",
Andrew Walbranbc342d42019-02-05 16:56:02 +000051 ]
52 deps = [
David Brazdilcb92ba12019-12-23 14:15:08 +000053 "//driver/linux",
David Brazdil3f509e02019-07-01 12:42:25 +010054 test_binary_target,
Andrew Walbranbc342d42019-02-05 16:56:02 +000055 ]
56}
57
58initrd("linux_test") {
59 testonly = true
60
David Brazdil7a462ec2019-08-15 12:27:47 +010061 manifest = "manifest.dts"
David Brazdil89957552020-01-31 19:03:19 +000062 manifest_overlay = hftest_manifest_overlay
Andrew Scull72b43c02019-09-18 13:53:45 +010063 primary_name = "vmlinuz"
David Brazdil33cc5c02019-12-10 10:44:14 +000064 primary_vm = "//third_party/linux:linux__prebuilt"
Andrew Walbranbc342d42019-02-05 16:56:02 +000065 primary_initrd = ":linux_test_initrd"
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010066 secondary_vms = [ [
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010067 "socket0",
Fuad Tabba7bd14132019-11-07 14:18:52 +000068 ":socket_vm1",
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010069 ] ]
Andrew Walbranbc342d42019-02-05 16:56:02 +000070}
71
72group("linux") {
73 testonly = true
74
75 deps = [
76 ":linux_test",
77 ]
78}
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010079
80# Testing framework for a secondary VM with socket.
81source_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}