1// 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
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19kernel_version = "5.10"
20
21kernel_stem = "kernel_prebuilts-" + kernel_version
22kernel_modules_stem = "virt_device_prebuilts_kernel_modules-" + kernel_version
23
24cc_test {
25    name: "VirtualizationTestCases",
26    test_suites: ["device-tests"],
27    srcs: [
28        "common.cc",
29        "vsock_test.cc",
30    ],
31    local_include_dirs: ["include"],
32    data: [
33        ":virt_test_kernel",
34        ":virt_test_initramfs",
35        "vsock_config.json",
36    ],
37    static_libs: [
38        // The existence of the library in the system partition is not guaranteed.
39        // Let's have our own copy of it.
40        "android.system.virtmanager-cpp",
41    ],
42    shared_libs: [
43        "libbase",
44        "libbinder",
45        "liblog",
46        "libutils",
47    ],
48}
49
50cc_defaults {
51    name: "virt_test_guest_binary",
52    static_libs: [
53        "libbase",
54        "liblog",
55    ],
56    static_executable: true,
57    installable: false,
58}
59
60cc_binary {
61    name: "virt_test_vsock_guest",
62    srcs: ["vsock_guest.cc"],
63    stem: "vsock_client",
64    defaults: ["virt_test_guest_binary"],
65}
66
67prebuilt_etc {
68    name: "virt_test_kernel",
69    src: "nofile",
70    arch: {
71        arm64: {
72            src: ":" + kernel_stem + "-arm64",
73        },
74        x86_64: {
75            src: ":" + kernel_stem + "-x86_64",
76        },
77    },
78}
79
80android_filesystem {
81    name: "virt_test_initramfs",
82    arch: {
83        arm64: {
84            deps: [kernel_modules_stem + "-arm64"],
85        },
86        x86_64: {
87            deps: [kernel_modules_stem + "-x86_64"],
88        },
89    },
90    deps: [
91        "virt_test_guest_init",
92        "virt_test_vsock_guest",
93    ],
94    type: "cpio",
95}
96