blob: 8ec6af250014669ed61740c604c1ef516b585d4b [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",
21 "//third_party/linux/include/uapi/",
22 ]
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 Brazdil4b0e1112019-07-30 18:28:01 +010060 primary_vm = "//third_party:linux__prebuilt"
Andrew Walbranbc342d42019-02-05 16:56:02 +000061 primary_initrd = ":linux_test_initrd"
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010062 secondary_vms = [ [
63 "1048576",
64 "1",
65 "socket0",
66 ":socket_vm0",
67 ] ]
Andrew Walbranbc342d42019-02-05 16:56:02 +000068}
69
70group("linux") {
71 testonly = true
72
73 deps = [
74 ":linux_test",
75 ]
76}
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010077
78# Testing framework for a secondary VM with socket.
79source_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}