blob: 8ef7381670dc8beb9e67561a4d90eeafe3d03c48 [file] [log] [blame]
Andrew Walbranbc342d42019-02-05 16:56:02 +00001# Copyright 2019 The Hafnium Authors.
2#
Andrew Walbrane959ec12020-06-17 15:01:09 +01003# Use of this source code is governed by a BSD-style
4# license that can be found in the LICENSE file or at
5# https://opensource.org/licenses/BSD-3-Clause.
Andrew Walbranbc342d42019-02-05 16:56:02 +00006
7import("//build/image/image.gni")
Fuad Tabbabfa42bc2019-08-06 13:45:50 +01008import("//build/toolchain/platform.gni")
David Brazdil89957552020-01-31 19:03:19 +00009import("//test/hftest/args.gni")
Andrew Walbranbc342d42019-02-05 16:56:02 +000010
11executable("test_binary") {
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010012 include_dirs = [
13 "//driver/linux/inc/uapi",
Fuad Tabbad9496592019-08-13 09:49:54 +010014 "//third_party/linux/include/uapi",
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010015 ]
16
Andrew Walbranbc342d42019-02-05 16:56:02 +000017 testonly = true
18 sources = [
19 "linux.c",
20 ]
21 deps = [
22 "//test/hftest:hftest_linux",
23 ]
24 output_name = "test_binary"
25}
26
Fuad Tabba7bd14132019-11-07 14:18:52 +000027vm_kernel("socket_vm1") {
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010028 testonly = true
29
30 deps = [
31 ":hftest_secondary_vm_socket",
32 ]
33}
34
Andrew Walbranbc342d42019-02-05 16:56:02 +000035linux_initrd("linux_test_initrd") {
36 testonly = true
David Brazdil3f509e02019-07-01 12:42:25 +010037
38 # Always use the aarch64_linux_clang toolchain to build test_binary
39 test_binary_target = ":test_binary(//build/toolchain:aarch64_linux_clang)"
Fuad Tabba0e0f29a2020-07-01 16:44:14 +010040
41 files = [
42 [
43 get_label_info(test_binary_target, "root_out_dir") + "/test_binary",
44 test_binary_target,
45 ],
46 [
47 get_label_info("//driver/linux", "target_out_dir") + "/hafnium.ko",
48 "//driver/linux",
49 ],
Andrew Walbranbc342d42019-02-05 16:56:02 +000050 ]
Fuad Tabba0e0f29a2020-07-01 16:44:14 +010051}
52
53manifest("linux_test_manifest") {
54 source = "manifest.dts"
55 overlay = hftest_manifest_overlay
Andrew Walbranbc342d42019-02-05 16:56:02 +000056}
57
58initrd("linux_test") {
59 testonly = true
60
Fuad Tabba0e0f29a2020-07-01 16:44:14 +010061 files = [
62 [
63 "manifest.dtb",
64 ":linux_test_manifest",
65 "manifest.dtb",
66 ],
67 [
68 "vmlinuz",
69 "//third_party/linux:linux__prebuilt",
70 "linux__prebuilt.bin",
71 ],
72 [
73 "initrd.img",
74 ":linux_test_initrd",
75 "linux_test_initrd/initrd.img",
76 ],
77 [
78 "socket0",
79 ":socket_vm1",
80 "socket_vm1.bin",
81 ],
82 ]
Andrew Walbranbc342d42019-02-05 16:56:02 +000083}
84
85group("linux") {
86 testonly = true
87
88 deps = [
89 ":linux_test",
90 ]
91}
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010092
93# Testing framework for a secondary VM with socket.
94source_set("hftest_secondary_vm_socket") {
95 testonly = true
96
97 configs += [ "//test/hftest:hftest_config" ]
98
99 sources = [
100 "hftest_socket.c",
101 ]
102
103 deps = [
104 "//src:dlog",
105 "//src:panic",
106 "//src:std",
107 "//src/arch/${plat_arch}:entry",
108 "//src/arch/${plat_arch}/hftest:entry",
109 "//src/arch/${plat_arch}/hftest:power_mgmt",
110 ]
111}