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 | |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame] | 15 | kernel_version = "5.4" |
| 16 | |
| 17 | kernel_target_stem = ":kernel_prebuilts-" + kernel_version |
| 18 | vendor_ramdisk_target_stem = ":cf_prebuilts_initramfs-" + kernel_version |
| 19 | |
David Brazdil | 1267a28 | 2020-10-15 12:33:20 +0000 | [diff] [blame^] | 20 | // JAR containing all virtualization host-side tests. |
| 21 | java_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 | ], |
| 31 | } |
| 32 | |
| 33 | // Give kernel images unique file names. |
| 34 | genrule { |
| 35 | name: "virt_hostside_tests_kernel", |
| 36 | srcs: [ |
| 37 | kernel_target_stem + "-arm64", |
| 38 | kernel_target_stem + "-x86_64", |
| 39 | ], |
| 40 | out: [ |
| 41 | "virt_hostside_tests_kernel-arm64", |
| 42 | "virt_hostside_tests_kernel-x86_64", |
| 43 | ], |
| 44 | tool_files: ["scripts/place_files.sh"], |
| 45 | cmd: "$(location scripts/place_files.sh) $(in) -- $(out)", |
| 46 | } |
| 47 | |
David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 48 | // Ramdisk containing /init and test binaries/resources needed inside guest. |
| 49 | genrule { |
| 50 | name: "virt_hostside_tests_initramfs_base", |
| 51 | tools: [ |
| 52 | "mkbootfs", |
| 53 | "lz4", |
| 54 | ], |
| 55 | tool_files: ["scripts/place_files.sh"], |
| 56 | out: ["initramfs.lz4"], |
| 57 | srcs: [ |
| 58 | ":virt_hostside_tests_guest_init", |
| 59 | ], |
| 60 | cmd: "$(location scripts/place_files.sh) $(in) -- " + |
| 61 | "$(genDir)/root/init " + |
| 62 | "&& $(location mkbootfs) $(genDir)/root | $(location lz4) -fq - $(out)", |
| 63 | } |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame] | 64 | |
| 65 | // Default rule for producing a combined base + vendor ramdisk. |
| 66 | genrule_defaults { |
| 67 | name: "virt_hostside_tests_initramfs_concat", |
| 68 | srcs: [":virt_hostside_tests_initramfs_base"], |
| 69 | tools: ["lz4"], |
| 70 | cmd: "cat $(in) | $(location lz4) -dfq - $(out)", |
| 71 | } |
| 72 | |
| 73 | // Combined base + vendor ramdisk for arm64. |
| 74 | genrule { |
| 75 | name: "virt_hostside_tests_initramfs-arm64", |
| 76 | defaults: ["virt_hostside_tests_initramfs_concat"], |
| 77 | srcs: [vendor_ramdisk_target_stem + "-arm64"], |
| 78 | out: ["virt_hostside_tests_initramfs-arm64"], |
| 79 | } |
| 80 | |
| 81 | // Combined base + vendor ramdisk for x86_64. |
| 82 | genrule { |
| 83 | name: "virt_hostside_tests_initramfs-x86_64", |
| 84 | defaults: ["virt_hostside_tests_initramfs_concat"], |
| 85 | srcs: [vendor_ramdisk_target_stem + "-x86_64"], |
| 86 | out: ["virt_hostside_tests_initramfs-x86_64"], |
| 87 | } |