crosvm/ci
Dennis Kempin 2118d6faa3 Test Runner for crosvm
The ./run_tests script will select which tests to run on the host.
Unfortunately a lot of our tests require dependencies or access
to certain kernel devices. We cannot run all tests on all hosts.

The test runner works with the CI builders:

To run all x86 tests:
./ci/builder ./run_tests --all

To run tests on aarch64:
./ci/aarch64_builder ./run_tests --all

Or to just run tests that can be run on a standard debian buster
system without obscure chromeos dependencies:

./run_tests

Eventually, the test runner should run tests via the VM of the
aarch64_builder, currently only those tests that can be run with
user-space emulation are executed.

Currently some tests remain disabled in the runner, as they do not
pass in the CI builders yet. These will be enabled as the builders
are set up to allow for them to be run.

BUG=b:173833661
TEST=Ran the above commands.

Change-Id: Id69027793348f4d3f20adf5333d8bdfff1aa9c8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2633889
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-01-22 11:05:57 +00:00
..
build_environment native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
crosvm_aarch64_builder Test Runner for crosvm 2021-01-22 11:05:57 +00:00
crosvm_base native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
crosvm_builder native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
aarch64_builder native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
builder native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
Makefile native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
README.md native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00
run_container.sh native and aarch64 cross-compile containers 2021-01-20 17:41:27 +00:00

CrosVM Continuous Integration Builders

This directory contains the toolchain to build docker containers for building and testing crosvm. They are used by Kokoro during presubmit and on continuous integration runs, but can also be used locally to run tests in a predictable environment.

Overview

  • ci/build_environment: Contains tooling for building the dependencies of crosvm.
  • ci/crosvm_base: Docker image shared by crosvm_builder and crosvm_aarch64_builder
  • ci/crosvm_builder: A native docker image for building and testing crosvm
  • ci/crosvm_aarch64_builder: An x86 docker image to cross-compile for aarch64 and test with user-space emulation.
  • ci/builder: Script to start the crosvm_builder container
  • ci/aarch64_builder: Script to start the crosvm_aarch64_builder container

Running the builder locally

You need to check out crosvm via repo, to pull all the required chromiumos dependencies:

$ repo init -u https://chromium.googlesource.com/chromiumos/manifest.git --repo-url https://chromium.googlesource.com/external/repo.git -g crosvm
$ repo sync -j4
$ cd src/platform/crosvm

A standard chromiumos checkout following the ChromiumOS Developer Guide will work too.

To run the smoke tests suite for both x86 and aarch64 on an x86 machine, just run:

$ cd platform/src/crosvm
$ ./ci/builder bin/smoke_test
$ ./ci/aarch64_builder bin/smoke_test

or start an interactive shell for either of them:

$ ./ci/builder
$ ./ci/aarch64_builder

Note: Tests on aarch64 are a work in progress and may not pass.

When the builder is started, it will prepare the environment for building and running tests, this includes building dependencies for crosvm that are provided by the ChromiumOS checkout.

The environment in both is setup so that cargo test or existing scripts like bin/smoke_tests compile for the right target and execute tests correctly (using qemu-user for aarch64).

The builders allow for incremental builds by storing build artifacts in $CARGO_TARGET/ci/crosvm_builder.

Using podman

Podman is a daemon-less docker replacement that runs containers without root privileges. If podman is installed, it will be automatically used.

For Googlers, see go/dont-install-docker for more details.

Note: Since podman runs with your users permissions, you need to setup access to devices required by tests. Most notably /dev/kvm and /dev/net/tun.

Building and uploading a new version of builders

The docker images for all builders can be built with make and uploaded with make upload. Of course you need to have docker push permissions for registry.gitlab.com/crosvm-ci/crosvm-ci for the upload to work.