blob: fb6ea51fede396a60599dc9c1611a90febbbc6dd [file] [log] [blame]
David Brazdilc53ea952020-10-15 12:41:26 +00001// Copyright (C) 2020 The Android Open Source Project
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// http://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
David Brazdilacb178d2021-01-18 19:37:50 +000015kernel_version = "5.10"
David Brazdild8d6e1d2020-10-15 14:02:03 +000016
17kernel_target_stem = ":kernel_prebuilts-" + kernel_version
Roman Kiryanov6d4305a2021-02-02 16:30:59 -080018vendor_ramdisk_target_stem = ":virt_device_prebuilts_initramfs-" + kernel_version
David Brazdild8d6e1d2020-10-15 14:02:03 +000019
David Brazdil1267a282020-10-15 12:33:20 +000020// JAR containing all virtualization host-side tests.
21java_test_host {
22 name: "VirtualizationHostTestCases",
23 srcs: ["java/**/*.java"],
24 test_suites: ["device-tests"],
25 libs: ["tradefed"],
26 data: [
27 ":virt_hostside_tests_kernel",
28 ":virt_hostside_tests_initramfs-arm64",
29 ":virt_hostside_tests_initramfs-x86_64",
30 ],
David Brazdil735b2cd2020-10-15 12:19:25 +000031 required: [
32 "virt_hostside_tests_vsock_server",
33 ],
David Brazdil1267a282020-10-15 12:33:20 +000034}
35
36// Give kernel images unique file names.
37genrule {
38 name: "virt_hostside_tests_kernel",
39 srcs: [
40 kernel_target_stem + "-arm64",
41 kernel_target_stem + "-x86_64",
42 ],
43 out: [
44 "virt_hostside_tests_kernel-arm64",
45 "virt_hostside_tests_kernel-x86_64",
46 ],
47 tool_files: ["scripts/place_files.sh"],
48 cmd: "$(location scripts/place_files.sh) $(in) -- $(out)",
49}
50
David Brazdilc53ea952020-10-15 12:41:26 +000051// Ramdisk containing /init and test binaries/resources needed inside guest.
52genrule {
53 name: "virt_hostside_tests_initramfs_base",
54 tools: [
55 "mkbootfs",
56 "lz4",
57 ],
58 tool_files: ["scripts/place_files.sh"],
59 out: ["initramfs.lz4"],
60 srcs: [
61 ":virt_hostside_tests_guest_init",
David Brazdil735b2cd2020-10-15 12:19:25 +000062 ":virt_hostside_tests_vsock_client",
David Brazdilc53ea952020-10-15 12:41:26 +000063 ],
64 cmd: "$(location scripts/place_files.sh) $(in) -- " +
65 "$(genDir)/root/init " +
David Brazdil735b2cd2020-10-15 12:19:25 +000066 "$(genDir)/root/bin/vsock_client " +
David Brazdilc53ea952020-10-15 12:41:26 +000067 "&& $(location mkbootfs) $(genDir)/root | $(location lz4) -fq - $(out)",
68}
David Brazdild8d6e1d2020-10-15 14:02:03 +000069
70// Default rule for producing a combined base + vendor ramdisk.
71genrule_defaults {
72 name: "virt_hostside_tests_initramfs_concat",
73 srcs: [":virt_hostside_tests_initramfs_base"],
74 tools: ["lz4"],
75 cmd: "cat $(in) | $(location lz4) -dfq - $(out)",
76}
77
78// Combined base + vendor ramdisk for arm64.
79genrule {
80 name: "virt_hostside_tests_initramfs-arm64",
81 defaults: ["virt_hostside_tests_initramfs_concat"],
82 srcs: [vendor_ramdisk_target_stem + "-arm64"],
83 out: ["virt_hostside_tests_initramfs-arm64"],
84}
85
86// Combined base + vendor ramdisk for x86_64.
87genrule {
88 name: "virt_hostside_tests_initramfs-x86_64",
89 defaults: ["virt_hostside_tests_initramfs_concat"],
90 srcs: [vendor_ramdisk_target_stem + "-x86_64"],
91 out: ["virt_hostside_tests_initramfs-x86_64"],
92}