Commit Graph

18 Commits

Author SHA1 Message Date
Andrew Walbran 6cda625e84 Merge "Allow client to pass a file descriptor for VM logs." 2021-03-19 11:02:01 +00:00
Andrew Walbran a89fc13131 Allow client to pass a file descriptor for VM logs.
Bug: 180893082
Test: Ran vm tool on VIM3L
Test: atest VirtualizationTestCases
Change-Id: I6c7729eb01d953559e1ddb0b5eb84655a84159a8
2021-03-18 12:00:44 +00:00
Jiyong Park 82848c5f2b Merge "Build microdroid-vbmeta and -vbmeta_system" 2021-03-18 00:02:41 +00:00
Ram Muthiah 543c58b347 Update microdroid test to include protected_vm flag
assemble_cvd was updated to include a flag which would disable insecure
launcher options.

Bug: 182005319
Test: local boot on cuttlefish
Change-Id: I3aabd594bf742a7639d4f57a1276a2733545c03e
2021-03-15 20:53:17 -07:00
Jiyong Park 80d8da832e Build microdroid-vbmeta and -vbmeta_system
Bug: 180676957
Test: m microdroid-vbmeta microdroid-vbmeta_system
avbtool info_image --image <built_image>

Test: atest MicrodroidHostTestCases

Change-Id: Ifa3dae5080e68faca921b7817db98548727eefc4
2021-03-16 11:34:44 +09:00
Jiyong Park dfa3aece82 Add MicrodroidHostTestCases
The test is to enture that the boot flow explained in
microdroid/README.md is not broken.

Bug: 181860941
Test: atest MicrodroidHostTestCases

Change-Id: Ic084ed2fe82f971092f28de776182e77ee360350
2021-03-12 13:36:15 +09:00
David Brazdil 49f8a4db09 Convert Vsock test to device test
Vsock test depends on two process groups running simultanously:
VirtManager+CrosVM and vsock_server. This was orchestrated by a Java
test runner running on the PC. With all the recent changes to the test,
it is now possible to run the former from AndroidTest.xml (and
eventually that will be completely removed) and convert vsock_server to
a GTest binary installed and invoked directly by TradeFed.

A common GTest class VirtualizationTest is added for hosting individual
test cases and sharing common code. Vsock test is converted to a single
TEST_F instance.

The test target is now called VirtualizationTestCases (dropped Host).

Bug: 181615964
Test: atest VirtualizationTestCases
Change-Id: I5a64d25ecc8f278250cfc3b196b8910ca8b8af52
2021-03-04 15:05:46 +00:00
Jiyong Park 8d1eb7ef09 Add virtmanager to the virt APEX
We want to have virtmanager (and its dependencies) inside the APEX so
that they can be updated.

Bug: 180297657
Test: com.android.virt
Change-Id: I79935c99f8884a3260fc19f797466b47b3dc6583
2021-02-18 21:56:34 +09:00
Jiyong Park 978b1e3699 Refactor VirtualizationHostTestCases
The init ramfs used by the test is now built using the soong module type
`android_filesystem`. This not only simplifies the build script, but
also verifies that the new build system construct correctly creates the
ramdisk image.

In addition, only the test data (kernel, initramfs, and the server) that
match with the target architecture are copied.

Bug: 178978059
Test: atest VirtualizationHostTestCases
Change-Id: Ibacc66fc5842f950c9ea16001e62bd44ed9b867c
2021-02-16 23:23:22 +09:00
Andrew Walbran 3049fdf04c Use Virt Manager for test
Bug: 171278952
Test: atest VirtualizationHostTestCases
Change-Id: Ib603194acb90d4e0952cf276c136efd246d0ce31
2021-02-11 13:42:26 +00:00
Bob Badour 2efc476199 [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Virtualization
Added SPDX-license-identifier-Apache-2.0 to:
  apex/Android.bp
  authfs/Android.bp
  microdroid/Android.bp
  tests/hostside/Android.bp
  tests/hostside/native/init/Android.bp
  tests/hostside/native/vsock/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Ibcf7d8fbfaee8efb100d765f8c7dbde819ffb621
2021-02-05 01:25:31 -08:00
Roman Kiryanov 6d4305a10a Rename the ramdisk target
kernel modules moved to a different location

Bug: 170677468
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I361ad86fae3199d5394dde7b5f57399394385d3f
2021-02-02 18:40:03 -08:00
David Brazdil acb178d4d3 Use kernel 5.10 for hostside tests
Upgrade from 5.4

Test: atest VirtualizationHostTestCases
Change-Id: I66425ca14cf5249f5253046a9a2c466dcd228ad9
2021-01-18 19:38:34 +00:00
David Brazdil 735b2cd7f6 Vsock end-to-end integration test
Add VsockTest host-side test that runs a vsock server in Android and
spawns a VM with a client that connects to it. The client sends a
message to the server. The host-side driver validates that the message
received by the server matches the message given to the client via
kernel command-line arguments.

Bug: 168589743
Test: atest VirtualizationHostTestCases
Change-Id: Id6d1f1c5ff10066a73606ee5b14387ba4474a3f8
2020-12-07 14:37:04 +00:00
David Brazdil 1267a284bf Java framework for host-side virtualization tests
Add base class VirtTestCase for host-side Java virtualization tests.
It provides common methods for pushing necessary files to the device and
spawning a VM using CrosVM.

Test: VirtualizationHostTestCases
Change-Id: Ieeb129b7af772f8ab70205819766c946ae70ed11
2020-12-07 14:36:54 +00:00
David Brazdil d8d6e1d3b1 Add rules for building guest VM combined ramdisk
The guest VM ramdisk is a combination of "base ramdisk" (containing
the init process and test binaries/resources) and a "vendor ramdisk"
(containing kernel modules).

This CL adds build rules that concatenate the base and vendor ramdisks.
This can be done as a simple `cat x1 x2` because both LZ4 and CPIO
formats are concatenable.

One ramdisk per target architecture is generated because genrules cannot
be specialized using the 'arch' field.

Test: m virt_hostside_tests_initramfs-{arm64,x86_64}
Change-Id: I7f52226ea68b8bfb497e481538eb35267578c38f
2020-12-07 14:36:45 +00:00
David Brazdil c53ea953d4 Add rules for building guest VM base ramdisk
The guest VM ramdisk is a combination of "base ramdisk" (containing the
init process and test binaries/resources) and a "vendor ramdisk"
(containing kernel modules).

This CL adds build rules that build the base ramdisk, an LZ4-compressed
CPIO archive built using a genrule. Sources are specified as target
modules and paths within the CPIO archive are provided in the same order.
A Bash script parses the information and places all files into a common
directory before calling `mkbootfs` on that directory and compressing
the result.

Test: m virt_hostside_tests_initramfs_base
Change-Id: Id9b4f0c87c97c7167572d4196497676c6d9469ad
2020-12-07 14:36:35 +00:00
David Brazdil b63560008b Add init process for test guest VMs
Guest VMs need an init process to be invoked by the GKI kernel. This
process needs to do two things:

1) load vendor kernel modules
For example, GKI does not come with vsock-virtio built in. The ramdisk
will contain vsock-virtio as a kernel module and it is the init's job to
load it.

2) execute a test binary
The init process is given parameters from the kernel command line
(/proc/cmdline). We will use these parameters to invoke a test binary
packaged in the ramdisk, eg. /bin/vsock_server. When init is done with
everything else, it calls execve() to run the specified binary and
passes remaining arguments to it.

This CL adds an init process as a static C++ binary. C++ was chosen
because of dependency on libmodprobe for loading kernel modules.

Test: m virt_hostside_tests_guest_init
      (may not work until later in the series due to path depth limits)
Change-Id: I7b461504850174c435b0e4d666117b97836dff4f
2020-12-07 14:36:24 +00:00