crosvm/run_tests
Dennis Kempin 3f63661afc Run integration_tests by calling crosvm binary
Instead of instanciating crosvm directly, we can start the binary as
a sub-process.
This includes parsing of crosvm options in the tests, and makes the
test cases closer to real-world usage.

To make make this possible, we need to make sure that the crosvm binary
is uploaded to the VM before running the test, which is done by the
sync_so script, which is baked into the builder container.
We prevent future container re-builds for just maintaining the script,
I have removed them from the container, and call the scripts from the
local source directly.

The test runner is also updated to ensure all package binaries are
built (currently only tests are built).

BUG=b:182841358
TEST=./test_all passes

Change-Id: I7dfd21abcb2b90fe125eb43f85572fbf645b888a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2744280
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-03-19 20:35:53 +00:00

95 lines
3 KiB
Python
Executable file

#!/usr/bin/env python3
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Runs tests for crosvm.
#
# See `ci/README.md` or `./run_tests -h` for more details.
from typing import List, Dict
from ci.test_runner import Requirements, main
# A list of all crates and their requirements
# See ci/test_runner.py for documentation on the requirements
CRATE_REQUIREMENTS: Dict[str, List[Requirements]] = {
"aarch64": [Requirements.AARCH64],
"acpi_tables": [],
"arch": [],
"assertions": [],
"base": [],
"bit_field": [],
"bit_field_derive": [],
"cros_async": [Requirements.DISABLED],
"crosvm": [Requirements.DO_NOT_RUN],
"crosvm_plugin": [Requirements.X86_64],
"data_model": [],
"devices": [
Requirements.SINGLE_THREADED,
Requirements.PRIVILEGED,
Requirements.X86_64,
],
"disk": [Requirements.PRIVILEGED],
"enumn": [],
"fuse": [],
"fuzz": [Requirements.DISABLED],
"gpu_display": [],
"hypervisor": [Requirements.PRIVILEGED, Requirements.X86_64],
"integration_tests": [Requirements.PRIVILEGED, Requirements.X86_64],
"io_uring": [
Requirements.SEPARATE_WORKSPACE,
Requirements.PRIVILEGED,
Requirements.SINGLE_THREADED,
],
"kernel_cmdline": [],
"kernel_loader": [Requirements.PRIVILEGED],
"kvm_sys": [Requirements.PRIVILEGED],
"kvm": [Requirements.PRIVILEGED, Requirements.X86_64],
"linux_input_sys": [],
"msg_socket": [Requirements.PRIVILEGED],
"msg_on_socket_derive": [],
"net_sys": [],
"net_util": [Requirements.PRIVILEGED],
"power_monitor": [],
"protos": [],
"qcow_utils": [],
"rand_ish": [],
"resources": [],
"rutabaga_gfx": [Requirements.CROS_BUILD, Requirements.PRIVILEGED],
"sync": [],
"sys_util": [Requirements.SINGLE_THREADED, Requirements.PRIVILEGED],
"poll_token_derive": [],
"syscall_defines": [],
"tempfile": [],
"tpm2-sys": [],
"tpm2": [],
"usb_sys": [],
"usb_util": [],
"vfio_sys": [],
"vhost": [Requirements.PRIVILEGED],
"virtio_sys": [],
"vm_control": [],
"vm_memory": [Requirements.PRIVILEGED],
"x86_64": [Requirements.X86_64, Requirements.PRIVILEGED],
}
# Just like for crates, lists requirements for each cargo feature flag.
FEATURE_REQUIREMENTS: Dict[str, List[Requirements]] = {
"chromeos": [],
"audio": [],
"gpu": [Requirements.CROS_BUILD],
"plugin": [Requirements.PRIVILEGED, Requirements.X86_64],
"power-monitor-powerd": [],
"tpm": [Requirements.CROS_BUILD],
"video-decoder": [Requirements.DISABLED],
"video-encoder": [Requirements.DISABLED],
"wl-dmabuf": [Requirements.DISABLED],
"x": [],
"virgl_renderer_next": [Requirements.CROS_BUILD],
"composite-disk": [],
"virgl_renderer": [Requirements.CROS_BUILD],
"gfxstream": [Requirements.DISABLED],
"gdb": [],
}
main(CRATE_REQUIREMENTS, FEATURE_REQUIREMENTS)