blob: 282d6c020c7507dbf77be18b17f18fcdb32c3ba0 [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)"
Andrew Walbranbc342d42019-02-05 16:56:02 +000040 sources = [
David Brazdil3f509e02019-07-01 12:42:25 +010041 get_label_info(test_binary_target, "root_out_dir") + "/test_binary",
David Brazdilcb92ba12019-12-23 14:15:08 +000042 get_label_info("//driver/linux", "target_out_dir") + "/hafnium.ko",
Andrew Walbranbc342d42019-02-05 16:56:02 +000043 ]
44 deps = [
David Brazdilcb92ba12019-12-23 14:15:08 +000045 "//driver/linux",
David Brazdil3f509e02019-07-01 12:42:25 +010046 test_binary_target,
Andrew Walbranbc342d42019-02-05 16:56:02 +000047 ]
48}
49
50initrd("linux_test") {
51 testonly = true
52
David Brazdil7a462ec2019-08-15 12:27:47 +010053 manifest = "manifest.dts"
David Brazdil89957552020-01-31 19:03:19 +000054 manifest_overlay = hftest_manifest_overlay
Andrew Scull72b43c02019-09-18 13:53:45 +010055 primary_name = "vmlinuz"
David Brazdil33cc5c02019-12-10 10:44:14 +000056 primary_vm = "//third_party/linux:linux__prebuilt"
Andrew Walbranbc342d42019-02-05 16:56:02 +000057 primary_initrd = ":linux_test_initrd"
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010058 secondary_vms = [ [
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010059 "socket0",
Fuad Tabba7bd14132019-11-07 14:18:52 +000060 ":socket_vm1",
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010061 ] ]
Andrew Walbranbc342d42019-02-05 16:56:02 +000062}
63
64group("linux") {
65 testonly = true
66
67 deps = [
68 ":linux_test",
69 ]
70}
Fuad Tabbabfa42bc2019-08-06 13:45:50 +010071
72# Testing framework for a secondary VM with socket.
73source_set("hftest_secondary_vm_socket") {
74 testonly = true
75
76 configs += [ "//test/hftest:hftest_config" ]
77
78 sources = [
79 "hftest_socket.c",
80 ]
81
82 deps = [
83 "//src:dlog",
84 "//src:panic",
85 "//src:std",
86 "//src/arch/${plat_arch}:entry",
87 "//src/arch/${plat_arch}/hftest:entry",
88 "//src/arch/${plat_arch}/hftest:power_mgmt",
89 ]
90}