David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 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 | |
Bob Badour | 2efc476 | 2021-02-03 18:36:27 -0800 | [diff] [blame] | 15 | package { |
| 16 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 17 | } |
| 18 | |
David Brazdil | acb178d | 2021-01-18 19:37:50 +0000 | [diff] [blame] | 19 | kernel_version = "5.10" |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame] | 20 | |
| 21 | kernel_target_stem = ":kernel_prebuilts-" + kernel_version |
Roman Kiryanov | 6d4305a | 2021-02-02 16:30:59 -0800 | [diff] [blame] | 22 | vendor_ramdisk_target_stem = ":virt_device_prebuilts_initramfs-" + kernel_version |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame] | 23 | |
David Brazdil | 1267a28 | 2020-10-15 12:33:20 +0000 | [diff] [blame] | 24 | // JAR containing all virtualization host-side tests. |
| 25 | java_test_host { |
| 26 | name: "VirtualizationHostTestCases", |
| 27 | srcs: ["java/**/*.java"], |
| 28 | test_suites: ["device-tests"], |
| 29 | libs: ["tradefed"], |
| 30 | data: [ |
| 31 | ":virt_hostside_tests_kernel", |
| 32 | ":virt_hostside_tests_initramfs-arm64", |
| 33 | ":virt_hostside_tests_initramfs-x86_64", |
Andrew Walbran | 3049fdf | 2020-12-23 12:46:30 +0000 | [diff] [blame^] | 34 | ":vm_config.arm64.json", |
| 35 | ":vm_config.x86_64.json", |
David Brazdil | 1267a28 | 2020-10-15 12:33:20 +0000 | [diff] [blame] | 36 | ], |
David Brazdil | 735b2cd | 2020-10-15 12:19:25 +0000 | [diff] [blame] | 37 | required: [ |
| 38 | "virt_hostside_tests_vsock_server", |
| 39 | ], |
David Brazdil | 1267a28 | 2020-10-15 12:33:20 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | // Give kernel images unique file names. |
| 43 | genrule { |
| 44 | name: "virt_hostside_tests_kernel", |
| 45 | srcs: [ |
| 46 | kernel_target_stem + "-arm64", |
| 47 | kernel_target_stem + "-x86_64", |
| 48 | ], |
| 49 | out: [ |
| 50 | "virt_hostside_tests_kernel-arm64", |
| 51 | "virt_hostside_tests_kernel-x86_64", |
| 52 | ], |
| 53 | tool_files: ["scripts/place_files.sh"], |
| 54 | cmd: "$(location scripts/place_files.sh) $(in) -- $(out)", |
| 55 | } |
| 56 | |
Andrew Walbran | 3049fdf | 2020-12-23 12:46:30 +0000 | [diff] [blame^] | 57 | // Copy config files to output directory so that AndroidTest.xml can copy them to the device. |
| 58 | filegroup { |
| 59 | name: "vm_config.arm64.json", |
| 60 | srcs: ["vm_config.arm64.json"], |
| 61 | } |
| 62 | |
| 63 | filegroup { |
| 64 | name: "vm_config.x86_64.json", |
| 65 | srcs: ["vm_config.x86_64.json"], |
| 66 | } |
| 67 | |
David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 68 | // Ramdisk containing /init and test binaries/resources needed inside guest. |
| 69 | genrule { |
| 70 | name: "virt_hostside_tests_initramfs_base", |
| 71 | tools: [ |
| 72 | "mkbootfs", |
| 73 | "lz4", |
| 74 | ], |
| 75 | tool_files: ["scripts/place_files.sh"], |
| 76 | out: ["initramfs.lz4"], |
| 77 | srcs: [ |
| 78 | ":virt_hostside_tests_guest_init", |
David Brazdil | 735b2cd | 2020-10-15 12:19:25 +0000 | [diff] [blame] | 79 | ":virt_hostside_tests_vsock_client", |
David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 80 | ], |
| 81 | cmd: "$(location scripts/place_files.sh) $(in) -- " + |
| 82 | "$(genDir)/root/init " + |
David Brazdil | 735b2cd | 2020-10-15 12:19:25 +0000 | [diff] [blame] | 83 | "$(genDir)/root/bin/vsock_client " + |
David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 84 | "&& $(location mkbootfs) $(genDir)/root | $(location lz4) -fq - $(out)", |
| 85 | } |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame] | 86 | |
| 87 | // Default rule for producing a combined base + vendor ramdisk. |
| 88 | genrule_defaults { |
| 89 | name: "virt_hostside_tests_initramfs_concat", |
| 90 | srcs: [":virt_hostside_tests_initramfs_base"], |
| 91 | tools: ["lz4"], |
| 92 | cmd: "cat $(in) | $(location lz4) -dfq - $(out)", |
| 93 | } |
| 94 | |
| 95 | // Combined base + vendor ramdisk for arm64. |
| 96 | genrule { |
| 97 | name: "virt_hostside_tests_initramfs-arm64", |
| 98 | defaults: ["virt_hostside_tests_initramfs_concat"], |
| 99 | srcs: [vendor_ramdisk_target_stem + "-arm64"], |
| 100 | out: ["virt_hostside_tests_initramfs-arm64"], |
| 101 | } |
| 102 | |
| 103 | // Combined base + vendor ramdisk for x86_64. |
| 104 | genrule { |
| 105 | name: "virt_hostside_tests_initramfs-x86_64", |
| 106 | defaults: ["virt_hostside_tests_initramfs_concat"], |
| 107 | srcs: [vendor_ramdisk_target_stem + "-x86_64"], |
| 108 | out: ["virt_hostside_tests_initramfs-x86_64"], |
| 109 | } |