Commit graph

30 commits

Author SHA1 Message Date
Keiichi Watanabe
60f7474799 e2e_tests: Add virtiofs test
BUG=b:269068100
TEST=./run in e2e_tests

Change-Id: I637a6362ebc846e773fbbc0fe8223044f9e0839d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4040654
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2023-02-14 02:09:35 +00:00
Daniel Verkamp
c5bcdf29af cmdline: move restore command under snapshot
The previous command line interface had two top-level commands related
to snapshots, each with only one subcommand:

- crosvm snapshot take <snapshot-path> <control-socket>
- crosvm restore apply <snapshot-path> <control-socket>

This patch moves the `restore apply` command under `snapshot` to make it
easier to find and less redundant to have two levels of commands:

- crosvm snapshot take <snapshot-path> <control-socket>
- crosvm snapshot restore <snapshot-path> <control-socket>

The restore command is also more discoverable since it is listed in the
help for the snapshot command.

BUG=b:232437513
TEST=crosvm snapshot take /tmp/snapshot /tmp/crosvm
TEST=crosvm snapshot restore /tmp/snapshot /tmp/crosvm
TEST=cargo test -p e2e_tests suspend_resume -- --test-threads=1

Change-Id: I9c3c8662fba7631327829a118f6b53b297b2d806
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4227254
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-02-09 01:52:36 +00:00
Zihan Chen
28ce4e5423 crosvm: Uprev rust toolchain and dev container
- Rust toolchain is updated to 1.65.0
- Catapult dashboard upload tool is added to dev_container
- Bindgen is updated to latest version to support custom derive
- Derive Eq when PartialEq is derived as required by new Clippy

TEST=CQ, bindgen-all-the-things

FIXED=b:260784028
BUG=b:257303497

Change-Id: I2034cd09e0aed84d4e9b30f2e85d84d94a442ea4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4228427
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2023-02-08 20:26:30 +00:00
Dennis Kempin
c2ec26d7e8 e2e_tests: Clarify prebuilt download logs
This helps identify a potential deadlock by the NamedLock.

BUG=None
TEST=CQ

Change-Id: I0ef9606b6b5e36a1564ff3fee7720ae013365cc7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4228215
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2023-02-07 20:17:23 +00:00
Frederick Mayle
19f4b1243c devices: snapshot and restore for guest memory
`crosvm snapshot take ...` will write the contents of guest memory to a
file and `crosvm restore apply ...` will read that file to overwrite
guest memory.

To start with, the file is chosen by adding a ".mem" extension to the
snapshot file path. We should consider a better approach in the future,
maybe put them both in a tar file or have the user supply a directory
instead of a file path.

BUG=b:266514791

Change-Id: Ic05f94223fb74674bd57dcd2f848055b31eb5fdc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4215313
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-02-06 22:44:17 +00:00
Frederick Mayle
1afdc4d908 e2e_tests: suspend_resume: consume exec_command_async response
Without this, subsequent commands would fail.

BUG=b:232437513

Change-Id: Ibbe105e0e80b317cc3cd32ddd184892e1a9ab613
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4214944
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-02-02 20:38:30 +00:00
Elie Kheirallah
c3a170e926 e2e_tests: Add Suspend/Resume related tests.
Add snapshot/restore tests for the VM.
This test currently suspends the VM, then sends a command to it.
This command is stored in the buffer of the serial device.
A snapshot is taken with the command stored.
The device is resumed, which then runs the command.
A restore is triggered using the image taken earlier, which then runs
the image again.

This test will be developed to include more VM changes as more devices
get snapshot.

Bug=b:232437513
Test=./tools/dev_container e2e_tests/run

Change-Id: If6b39bd9b0f1d2962748cf089959f57f65407ced
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3949685
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2023-01-20 23:31:00 +00:00
Elie Kheirallah
b335b9565d e2e_tests: add disable-sandbox to e2e_tests
Add disable_sandbox function to add `disable-sandbox` argument to the
config.
Add disable-sandbox test to all existing e2e_tests.

BUG=None
TEST=./tools/presubmit --all

Change-Id: I4ee00402c7220dffbce57a68670b6ae3c2b95d5f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4165873
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
2023-01-19 21:41:26 +00:00
Vikram Auradkar
69429106d0 tools: add script to setup rust toolchain and other dependencies
BUG=b:264555939
TEST= ran the script on a non-crop windows machine

Change-Id: Ib615b45137f5da73be511d29f6655946d78455fe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4149727
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2023-01-12 23:25:39 +00:00
Daniel Verkamp
ac0fc378a3 Fix remaining Chrome/Chromium OS instances
These should be written as ChromeOS and ChromiumOS (without the space)
to match the updated branding. The copyright headers were already
migrated to the new style (https://crrev.com/c/3894243), but there were
some more instances left over.

BUG=None
TEST=tools/cargo-doc

Change-Id: I8c76aea2eb33b2e370ab71ee9b5cc0a4cfd00585
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4129934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-01-03 22:14:30 +00:00
Daniel Verkamp
000e65339e e2e_tests: fix direct feature check
Two small tweaks:
- The original check had a typo ('features' vs. 'feature').
- Use the cfg! macro to simplify the code (cfg_if! is not needed here).

BUG=None
TEST=tools/presubmit --all
TEST=crosvm CQ

Change-Id: Icf84c24cb7f34bf4629e99ee1d7d33676e7ae8c1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4126555
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-12-28 01:47:49 +00:00
Vikram Auradkar
13f8029329 e2e_tests: Add windows tests
The windows code is build only for now because
- crosvm upstream windows code needs some changes to be runnable
- LUCI windows infra is not ready for nested vm

BUG=b:253498690
TEST=ran `cargo t --features all-msvc64 -p e2e_tests` downstream

Change-Id: I318f6f17fc91bc76cfd28741a526193362ab4e50
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4096606
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-14 14:21:51 +00:00
Vikram Auradkar
5aa1ada5f8 e2e_test: Move unix specific code into their module
BUG=b:253498690
TEST=NONE

Change-Id: I3cc1d3c79261a21f9f67c35d05a26b52d3310f59
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4090590
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-09 19:00:43 +00:00
Vikram Auradkar
ccd5d89462 e2e_test: Refactor to separate platform dependent code
BUG=b:253498690
TEST=NONE

Change-Id: Ib5c7c07820deaa9f3b3cd49e5a6715fb03696e23
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4090589
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-12-09 00:15:34 +00:00
Vikram Auradkar
b086012a07 e2e_tests: Use platform independent function to download prebuilts
BUG=b:253498690
TEST=NONE

Change-Id: I8a12cd226e5442a0f280e59b6041cde326063794
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4090588
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-12-09 00:08:39 +00:00
Daniel Verkamp
a506de7ee6 Reformat with nightly rustfmt
BUG=None
TEST=tools/fmt --nightly

Change-Id: I7c74b9190bf28e3d7e3ac4401a2b79800a9e4b76
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4087003
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-12-07 19:33:09 +00:00
Vikram Auradkar
6e46da68ba e2e_tests: stay in the current directory
BUG=NONE
TEST=`source e2e_tests/guest_under_test/use_local_build.sh`

Change-Id: Ife81553ba2bdc2b37e079191c3d13d86d08c5136
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4072946
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-12-02 00:16:50 +00:00
Daniel Verkamp
dfe9869d6c Rust 1.65: Fix clippy borrow_deref_ref, needless_borrow, and explicit_auto_deref lints
BUG=b:260784028
TEST=tools/clippy

Change-Id: I85cd5e096bc7b977fe1d9b231c08338b65e71780
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4064714
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-30 19:33:31 +00:00
Keiichi Watanabe
e060d6c639 e2e_tests: Add vhost-user block with devices command
BUG=b:243127910
TEST=./e2e_tests/run

Change-Id: I22dfc4e1d75ff0b310a5f624568b390d2dba6c1e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4054811
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 09:16:00 +00:00
Keiichi Watanabe
d9d74da342 e2e_tests: Add vhost-user block test
BUG=b:243127910
TEST=./e2e_tests/run

Change-Id: Iae16498f79f1395a6aa7ab834addc3e30d767164
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3820966
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 08:49:34 +00:00
Keiichi Watanabe
6ec82a2305 e2e_tests: fixture: Move VM-specific logic to a separate module
To prepare adding more fixtures such as logic for vhost-user device,
move the existing code to create a VM to a separate module.
Specifically, move the all code in e2e_tests/tests/fixture/mod.rs into
e2e_tests/tests/fixture/vm.rs.

BUG=b:243127910
TEST=./e2e_tests/run

Change-Id: I23e6e5db35ce09b5003f37a9a44f9fda8f502809
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4028760
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-24 08:14:05 +00:00
Alexandre Courbot
e8cbbb457c crosvm: rename executable_path positional argument to kernel
This is a shorter and more explicit name, and is also what qemu uses for
the same parameter.

Since this is a positional argument, it doesn't affect command-line
argument handling, only the (currently unused) configuration files.

BUG=b:255223604
TEST=None

Change-Id: Ice01335a690550e5afd05b93c6c968b0d0859f32
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4044726
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-23 01:58:23 +00:00
Alexandre Courbot
07fc7dbecd crosvm: use kebab-case for disk options
The rule for crosvm options is that they should be specified in
kebab-case. Switch the disk options to that format, while also keeping
camel_case aliases for compatibility.

BUG=b:255223604
TEST=--block option works with both block-size and block_size
parameters.
TEST=cargo test -p devices block::tests::params_from_key_values
TEST=cargo test -p e2e_tests boot_test_vm

Change-Id: Ie095565ca4b27d59ed86ddc0613419e45749b3fa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4040818
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-23 01:57:04 +00:00
Alexandre Courbot
884ea737c3 e2e_tests: add test for booting a VM from a configuration file
Add `boot_test_vm_config_file`, which boots a VM similar to
`boot_test_vm`, but using a configuration file instead of command-line
options wherever possible.

BUG=b:218223240
TEST=cargo test -p e2e_tests boot_test_vm

Change-Id: I45f82bfa8201776081e18c50011d928d8c7be0f0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4022749
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-11-21 12:00:39 +00:00
Zihan Chen
23e3de8afb e2e_tests: Uprev kernel to 5.10
Block resize failed in my cloudtop after uprev, it works fine
when tested manually (with same kernel and rootfs). Adding a delay
fixed it.

TEST=./e2e_tests/run
FIXED=b:259160336

Change-Id: I2cfb4fbc491b39b721b0358181cad2ee75398adc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4026591
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2022-11-15 21:06:40 +00:00
Ryuichiro Chiba
4db19f1baa e2e_tests: vsock: use a random cid for a guest
Using a fixed CID may cause conflict with another guest easily.
Change to use a random CID for a test VM.

BUG=b:258072662
TEST=`./tools/presubmit`

Change-Id: I1f3bab8bd64664b1b2feb480a6d0e285ea4099bb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4012278
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-08 04:26:47 +00:00
Ryuichiro Chiba
9406b788c3 e2e_tests: Add vsock tests
Add vsock tests to confirm the vsock device works at crosvm upstream

BUG=b:254375643
TEST=`./tools/presubmit`

Change-Id: I24137e00dc449c97be8ee7e9101906541ea843d1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3998914
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-07 05:54:34 +00:00
Ryuichiro Chiba
df7a2e51bf e2e_tests: Add a tool to dev_container and guest rootfs
Add a tool used in vsock tests to dev_container and guest rootfs

BUG=b:254375643
TEST=`./tools/presubmit` with the new guest rootfs on the new
dev_container

Change-Id: I135e6d2d413bedffef0fd69edd4ab14080429e3a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3974349
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-11-07 04:00:40 +00:00
Dennis Kempin
004417152f e2e_tests: Update prebuild URL to crosvm-infra
We no longer need to use the ChromeOS infra for storing the prebuilts
and have updated all other references already. This one was missed.

BUG=None
TEST=run_tests

Change-Id: Ie8ee25d731591c78e3b49ad0dadbed87aaafdf49
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4005658
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-04 19:06:20 +00:00
Dennis Kempin
009cb53c76 Rename integration_tests to e2e_tests
Cargo already uses the term 'integration test' for tests living
in the tests/ directory of a crate.

To prevent confusion, rename our 'integration_tests' crate to
'e2e_tests'.

BUG=None
TEST=presubmit

Change-Id: Icfa819eaed08be54ab0f36092f1ba367f3f1ce88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4004977
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2022-11-03 22:49:39 +00:00