blob: e0c5c85de1219180576bdf5c5ee09a4a538e9512 [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"
Fuad Tabba50469e02020-06-30 15:14:28 +010055 output = "manifest.dtb"
Fuad Tabba0e0f29a2020-07-01 16:44:14 +010056 overlay = hftest_manifest_overlay
Andrew Walbranbc342d42019-02-05 16:56:02 +000057}
58
59initrd("linux_test") {
60 testonly = true
61
Fuad Tabba0e0f29a2020-07-01 16:44:14 +010062 files = [
63 [
64 "manifest.dtb",
65 ":linux_test_manifest",
66 "manifest.dtb",
67 ],
68 [
69 "vmlinuz",
70 "//third_party/linux:linux__prebuilt",
71 "linux__prebuilt.bin",
72 ],
73 [
74 "initrd.img",
75 ":linux_test_initrd",
76 "linux_test_initrd/initrd.img",
77 ],
78 [
79 "socket0",
80 ":socket_vm1",
81 "socket_vm1.bin",
82 ],
83 ]
Andrew Walbranbc342d42019-02-05 16:56:02 +000084}
85
86group("linux") {
87 testonly = true
88
89 deps = [
90 ":linux_test",
91 ]
92}
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010093
94# Testing framework for a secondary VM with socket.
95source_set("hftest_secondary_vm_socket") {
96 testonly = true
97
98 configs += [ "//test/hftest:hftest_config" ]
99
100 sources = [
101 "hftest_socket.c",
102 ]
103
104 deps = [
105 "//src:dlog",
106 "//src:panic",
107 "//src:std",
108 "//src/arch/${plat_arch}:entry",
109 "//src/arch/${plat_arch}/hftest:entry",
110 "//src/arch/${plat_arch}/hftest:power_mgmt",
111 ]
112}