Run some win64 tests with wine as part of presubmit

docker container size increases to ~4.7-8 Gb

TEST=./dev_container --hermetic ./tools/presubmit
BUG=none

Change-Id: I49dc03182f6ac5c29e0174618cc3864e073a2eb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3499264
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
This commit is contained in:
Anton Romanov 2022-03-03 01:29:26 +00:00 committed by Chromeos LUCI
parent c30abefc07
commit 24a226169d
13 changed files with 146 additions and 120 deletions

View file

@ -42,3 +42,6 @@ rustflags = [
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
[target.x86_64-pc-windows-gnu]
runner = "wine64"

View file

@ -116,6 +116,7 @@ all-linux = [
"virgl_renderer",
"x",
]
win64 = []
audio = ["devices/audio"]
audio_cras = ["devices/audio_cras"]
chromeos = ["base/chromeos", "audio_cras", "devices/chromeos"]

View file

@ -48,7 +48,7 @@ py .\tools\clippy
if %ERRORLEVEL% neq 0 ( exit /b %ERRORLEVEL% )
echo [%TIME%] Calling crosvm\build_test.py
py ./tools\impl/test_runner.py --arch x86_64 -v
py ./tools\impl/test_runner.py --arch win64 -v
if %ERRORLEVEL% neq 0 ( exit /b %ERRORLEVEL% )
exit /b %ERRORLEVEL%

View file

@ -25,7 +25,7 @@ if os.name == "posix":
FEATURES: str = "--features=all-linux"
elif os.name == "nt":
EXCLUDED_CRATES: list[str] = list(get_workspace_excludes("x86_64"))
EXCLUDED_CRATES: list[str] = list(get_workspace_excludes("win64"))
EXCLUDED_CRATES_ARGS: list[str] = [f"--exclude={crate}" for crate in EXCLUDED_CRATES]
FEATURES: str = ""

View file

@ -25,8 +25,13 @@ RUN apt-get update \
# Delete build artifacts from 'cargo install' to save space in layer.
&& rm -rf /scratch/cargo_target/*
# Prepare wine64
RUN ln -sf /usr/bin/wine64-stable /usr/bin/wine64 \
&& wine64 wineboot
# Install cross-compilation dependencies.
COPY tools/install-aarch64-deps tools/install-armhf-deps /tools/
RUN apt-get update \
&& /tools/install-aarch64-deps \
&& /tools/install-armhf-deps \

View file

@ -1 +1 @@
r0007
r0008

View file

@ -12,6 +12,7 @@ class TestOption(enum.Enum):
DO_NOT_BUILD_AARCH64 = "do_not_build_aarch64"
DO_NOT_BUILD_ARMHF = "do_not_build_armhf"
DO_NOT_BUILD_X86_64 = "do_not_build_x86_64"
DO_NOT_BUILD_WIN64 = "do_not_build_win64"
# Build tests, but do not run for all, or just some platforms.
DO_NOT_RUN = "do_not_run"
@ -32,119 +33,119 @@ class TestOption(enum.Enum):
# This test needs longer than usual to run.
LARGE = "large"
# Configuration to restrict how and where tests of a certain crate can
# be build and run.
#
# Please add a bug number when restricting a tests.
if os.name == "posix":
CRATE_OPTIONS: dict[str, list[TestOption]] = {
"base": [TestOption.SINGLE_THREADED, TestOption.LARGE],
"cros_async": [TestOption.LARGE],
"crosvm_plugin": [TestOption.DO_NOT_BUILD_AARCH64, TestOption.DO_NOT_BUILD_ARMHF],
"crosvm": [TestOption.SINGLE_THREADED],
"devices": [
TestOption.SINGLE_THREADED,
TestOption.LARGE,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
],
"disk": [TestOption.DO_NOT_RUN_AARCH64, TestOption.DO_NOT_RUN_ARMHF], # b/202294155
"crosvm-fuzz": [TestOption.DO_NOT_BUILD], # b/194499769
"fuzz": [TestOption.DO_NOT_BUILD],
"hypervisor": [
TestOption.DO_NOT_RUN_AARCH64,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
], # b/181672912
"integration_tests": [ # b/180196508
TestOption.SINGLE_THREADED,
TestOption.LARGE,
TestOption.DO_NOT_RUN_AARCH64,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
],
"io_uring": [TestOption.DO_NOT_RUN], # b/202294403
"kvm_sys": [TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL],
"kvm": [
TestOption.DO_NOT_RUN_AARCH64,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
], # b/181674144
"libvda": [TestOption.DO_NOT_BUILD], # b/202293971
"sys_util": [TestOption.SINGLE_THREADED],
"sys_util_core": [TestOption.SINGLE_THREADED],
"rutabaga_gfx": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864
"vhost": [TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL],
"vm_control": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864
"libcrosvm_control": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864
}
BUILD_FEATURES: dict[str, str] = {
"x86_64": "linux-x86_64",
"aarch64": "linux-aarch64",
"armhf": "linux-armhf",
}
elif os.name == "nt":
CRATE_OPTIONS: dict[str, list[TestOption]] = {
"aarch64": [TestOption.DO_NOT_BUILD],
"acpi_tables": [TestOption.DO_NOT_BUILD],
"arch": [TestOption.DO_NOT_BUILD],
"audio_streams": [TestOption.DO_NOT_BUILD],
"balloon_control": [],
"base": [TestOption.SINGLE_THREADED, TestOption.LARGE],
"bit_field_derive": [TestOption.DO_NOT_BUILD],
"bit_field": [TestOption.DO_NOT_BUILD],
"cros_async": [TestOption.DO_NOT_BUILD],
"cros_asyncv2": [TestOption.DO_NOT_BUILD],
"cros-fuzz": [TestOption.DO_NOT_BUILD],
"crosvm_control": [TestOption.DO_NOT_BUILD],
"crosvm_plugin": [TestOption.DO_NOT_BUILD],
"crosvm-fuzz": [TestOption.DO_NOT_BUILD],
"crosvm": [TestOption.DO_NOT_BUILD],
"devices": [TestOption.DO_NOT_BUILD],
"disk": [TestOption.DO_NOT_BUILD],
"ffi": [TestOption.DO_NOT_BUILD],
"fuse": [TestOption.DO_NOT_BUILD],
"fuzz": [TestOption.DO_NOT_BUILD],
"gpu_display": [TestOption.DO_NOT_BUILD],
"hypervisor": [TestOption.DO_NOT_BUILD],
"integration_tests": [TestOption.DO_NOT_BUILD],
"io_uring": [TestOption.DO_NOT_BUILD],
"kernel_cmdline": [TestOption.DO_NOT_BUILD],
"kernel_loader": [TestOption.DO_NOT_BUILD],
"kvm_sys": [TestOption.DO_NOT_BUILD],
"kvm": [TestOption.DO_NOT_BUILD],
"libcras_stub": [TestOption.DO_NOT_BUILD],
"libvda": [TestOption.DO_NOT_BUILD],
"linux_input_sys": [TestOption.DO_NOT_BUILD],
"minijail-sys": [TestOption.DO_NOT_BUILD],
"minijail": [TestOption.DO_NOT_BUILD],
"net_sys": [TestOption.DO_NOT_BUILD],
"net_util": [TestOption.DO_NOT_BUILD],
"p9": [TestOption.DO_NOT_BUILD],
"poll_token_derive": [],
"power_monitor": [TestOption.DO_NOT_BUILD],
"protos": [TestOption.DO_NOT_BUILD],
"qcow_utils": [TestOption.DO_NOT_BUILD],
"resources": [TestOption.DO_NOT_BUILD],
"rutabaga_gfx": [TestOption.DO_NOT_BUILD],
"rutabaga_gralloc": [TestOption.DO_NOT_BUILD],
"sync": [TestOption.DO_NOT_BUILD],
"sys_util": [TestOption.DO_NOT_BUILD],
"sys_util_core": [],
"system_api_stub": [TestOption.DO_NOT_BUILD],
"tpm2-sys": [TestOption.DO_NOT_BUILD],
"tpm2": [TestOption.DO_NOT_BUILD],
"usb_sys": [TestOption.DO_NOT_BUILD],
"usb_util": [TestOption.DO_NOT_BUILD],
"vfio_sys": [TestOption.DO_NOT_BUILD],
"vhost": [TestOption.DO_NOT_BUILD],
"virtio_sys": [TestOption.DO_NOT_BUILD],
"vm_control": [TestOption.DO_NOT_BUILD],
"vm_memory": [TestOption.DO_NOT_BUILD],
"wire_format_derive": [TestOption.DO_NOT_BUILD],
"x86_64": [TestOption.DO_NOT_BUILD],
}
# This is just too big to keep in main list for now
WIN64_DISABLED_CRATES = [
"aarch64",
"acpi_tables",
"arch",
"assertions",
"audio_streams",
"bit_field_derive",
"bit_field",
"cros_async",
"cros_asyncv2",
"cros-fuzz",
"crosvm_control",
"crosvm_plugin",
"crosvm-fuzz",
"crosvm",
"data_model",
"devices",
"disk",
"ffi",
"fuse",
"fuzz",
"gpu_display",
"hypervisor",
"integration_tests",
"io_uring",
"kernel_cmdline",
"kernel_loader",
"kvm_sys",
"kvm",
"libcras_stub",
"libvda",
"linux_input_sys",
"minijail-sys",
"minijail",
"net_sys",
"net_util",
"p9",
"power_monitor",
"protos",
"qcow_utils",
"resources",
"rutabaga_gfx",
"rutabaga_gralloc",
"sync",
"sys_util",
"system_api_stub",
"tpm2-sys",
"tpm2",
"usb_sys",
"usb_util",
"vfio_sys",
"vhost",
"virtio_sys",
"vm_control",
"vm_memory",
"vmm_vhost",
"wire_format_derive",
"x86_64",
]
BUILD_FEATURES: dict[str, str] = {
"x86_64": "",
}
else:
raise Exception(f"Unsupported build target: {os.name}")
CRATE_OPTIONS: dict[str, list[TestOption]] = {
"base": [TestOption.SINGLE_THREADED, TestOption.LARGE],
"cros_async": [TestOption.LARGE],
"crosvm": [TestOption.SINGLE_THREADED],
"crosvm_plugin": [
TestOption.DO_NOT_BUILD_AARCH64,
TestOption.DO_NOT_BUILD_ARMHF,
],
"crosvm-fuzz": [TestOption.DO_NOT_BUILD], # b/194499769
"devices": [
TestOption.SINGLE_THREADED,
TestOption.LARGE,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
],
"disk": [TestOption.DO_NOT_RUN_AARCH64, TestOption.DO_NOT_RUN_ARMHF], # b/202294155
"fuzz": [TestOption.DO_NOT_BUILD],
"hypervisor": [
TestOption.DO_NOT_RUN_AARCH64,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
], # b/181672912
"integration_tests": [ # b/180196508
TestOption.SINGLE_THREADED,
TestOption.LARGE,
TestOption.DO_NOT_RUN_AARCH64,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
],
"io_uring": [TestOption.DO_NOT_RUN], # b/202294403
"kvm_sys": [TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL],
"kvm": [
TestOption.DO_NOT_RUN_AARCH64,
TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL,
], # b/181674144
"libcrosvm_control": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864
"libvda": [TestOption.DO_NOT_BUILD], # b/202293971
"rutabaga_gfx": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864
"sys_util": [TestOption.SINGLE_THREADED],
"sys_util_core": [TestOption.SINGLE_THREADED],
"vhost": [TestOption.DO_NOT_RUN_ON_FOREIGN_KERNEL],
"vm_control": [TestOption.DO_NOT_BUILD_ARMHF], # b/210015864
}
for name in WIN64_DISABLED_CRATES:
CRATE_OPTIONS[name] = CRATE_OPTIONS.get(name, []) + [TestOption.DO_NOT_BUILD_WIN64]
BUILD_FEATURES: dict[str, str] = {
"x86_64": "linux-x86_64",
"aarch64": "linux-aarch64",
"armhf": "linux-armhf",
"win64": "win64",
}

View file

@ -110,6 +110,8 @@ def get_workspace_excludes(target_arch: Arch):
yield crate
elif TestOption.DO_NOT_BUILD_ARMHF in options and target_arch == "armhf":
yield crate
elif TestOption.DO_NOT_BUILD_WIN64 in options and target_arch == "win64":
yield crate
def should_run_executable(executable: Executable, target_arch: Arch):
@ -282,6 +284,13 @@ def execute_test(target: TestTarget, executable: Executable):
if TestOption.SINGLE_THREADED in options:
args += ["--test-threads=1"]
binary_path = executable.binary_path
if executable.arch == "win64" and executable.kind != "proc-macro" and os.name != "nt":
args.insert(0, binary_path)
binary_path = "wine64"
# proc-macros and their tests are executed on the host.
if executable.kind == "proc-macro":
target = TestTarget("host")
@ -292,7 +301,7 @@ def execute_test(target: TestTarget, executable: Executable):
# Pipe stdout/err to be printed in the main process if needed.
test_process = test_target.exec_file_on_target(
target,
executable.binary_path,
binary_path,
args=args,
timeout=get_test_timeout(target, executable),
stdout=subprocess.PIPE,

View file

@ -44,7 +44,7 @@ TESTVM_DIR = SCRIPT_DIR.parent.joinpath("testvm")
TARGET_DIR = testvm.cargo_target_dir().joinpath("crosvm_tools")
ENVRC_PATH = SCRIPT_DIR.parent.parent.joinpath(".envrc")
Arch = Literal["x86_64", "aarch64", "armhf"]
Arch = Literal["x86_64", "aarch64", "armhf", "win64"]
# Enviroment variables needed for building with cargo
BUILD_ENV = {
@ -182,10 +182,15 @@ def get_cargo_build_target(arch: Arch):
if os.name == "posix":
if arch == "armhf":
return "armv7-unknown-linux-gnueabihf"
elif arch == "win64":
return "x86_64-pc-windows-gnu"
else:
return f"{arch}-unknown-linux-gnu"
elif os.name == "nt":
return f"{arch}-pc-windows-msvc"
if arch == "win64":
return f"x86_64-pc-windows-msvc"
else:
return f"{arch}-pc-windows-msvc"
else:
raise Exception(f"Unsupported build target: {os.name}")

View file

@ -5,7 +5,6 @@
set -ex
sudo apt-get install --yes --no-install-recommends \
g++-aarch64-linux-gnu \
gcc-aarch64-linux-gnu \
ipxe-qemu \
libc-dev:arm64 \

View file

@ -5,7 +5,6 @@
set -ex
sudo apt-get install --yes --no-install-recommends \
g++-arm-linux-gnueabihf \
gcc-arm-linux-gnueabihf \
libc-dev:armhf \
libcap-dev:armhf \

View file

@ -7,12 +7,10 @@ set -ex
sudo apt-get update
sudo apt-get install --yes --no-install-recommends \
ca-certificates \
clang \
cloud-image-utils \
curl \
dpkg-dev \
expect \
g++ \
gcc \
git \
jq \
@ -37,6 +35,8 @@ sudo apt-get install --yes --no-install-recommends \
qemu-system-x86 \
rsync \
screen \
wine64 \
gcc-mingw-w64-x86-64-win32 \
wayland-protocols
# Install meson for rutabaga_gfx
@ -51,6 +51,8 @@ pip3 install argh
rustup component add clippy
rustup component add rustfmt
rustup target add x86_64-pc-windows-gnu
# The bindgen tool is required to build a crosvm dependency.
cargo install bindgen

View file

@ -100,12 +100,14 @@ if [ "$ALL" == true ]; then
commands+=(
"$(aarch64_wrapper) ./tools/run_tests --target=vm:aarch64"
"$(aarch64_wrapper) ./tools/run_tests --target=vm:aarch64 --arch=armhf"
"./tools/run_tests --target=host --arch=win64 --build-only"
"cargo build --verbose --no-default-features"
)
elif [ "$QUICK" != true ]; then
commands+=(
# Test via user-space emulation for faster, but less complete results.
"$(aarch64_wrapper) ./tools/run_tests --target=host --arch=aarch64"
"./tools/run_tests --target=host --arch=win64 --build-only"
)
fi