run_guest.sh lacks the shebang, and has a small bug of missing quotes.
This commit fixes them.
BUG=None
TEST=Confirmed that "$@" works as expected by checking the passed
arguments.
Change-Id: Ic0d5e8676b206be15b1b2f09b3b9c6de2b9d2fb3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4537378
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Takaya Saeki <takayas@chromium.org>
There is a probably a more elegant solution where `EventAsync` provides
a `futures::stream::Stream` interface, then, instead of using
`FuturesUnordered`, we call `StreamExt::for_each_concurrent` to perform
the `process_one_chain` work.
BUG=b:282108854
Change-Id: Ic5af78e28e7ada5072790dab6af87dea796442d4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4534425
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This test will spin up block and net vhost user device processes. This
test will be used as a smoke test and won't run during presubmits
Also refactor functions that can be shared into the fixture crate.
BUG=b:281115884
TEST=ran test. Also verified messages get sent to vhost user devices
Change-Id: Ic7e78a8ed71290fd3c42f9e15bf59a238623c49e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4519650
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
Remove the extra [[bin]] from Cargo.toml, as it is no longer used by the
chromeos-base/crosvm ebuild.
The "direct" feature is kept for now, since some of the functionality
behind that flag may still be useful (and should be moved to separate
features rather than "direct" eventually).
BUG=b:276993009
TEST=cargo build
TEST=tools/dev_container tools/presubmit
Change-Id: I78269d94913a216ebfb7f22ddc58d9cfdb6a6791
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4436629
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
currently running e2e_tests/run will run tests from root, and not
e2e_tests. This change specifies the package e2e_tests.
BUG=N/A
TEST=./tools/dev_container e2e_tests/run
Change-Id: I7a11d43045ab5809c9034b948c6a00db4b81ac84
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4416066
Auto-Submit: Elie Kheirallah <khei@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Change buffer size from 2048 to 48000 bytes, and period size from
1024 to 12000 bytes. 12000 is taken from 1/4 * 48000. By default,
aplay use period size equals to 1/4 of buffer size.
There are failures that result from underruns. As the objective of this
test is to ensure correctness, using a larger buffer size to avoid
underruns is acceptable.
BUG=b:233542268
TEST=./tools/run_tests2 --dut=host
Change-Id: I5e921f7c7528d11aabd3c998575ade4c3a9a7fb9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4411220
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Norman Bintang <normanbt@chromium.org>
New options uid and gid are added to the virtiofs/virito9p device to
allow specifying the uid/gid of the virtiofs/virito9p process in its
own user namespace created by minijail.
With these options:
* An identity mapping of the current host UID/GID can be set up
between the host and the VM.
* The crosvm process does not need CAP_SETUID/CAP_SETGID.
Background: go/crosvm-virtiofs-transparent.
If the crosvm process has no CAP_SETGID/CAP_SETUID, the
uid_map/gid_map for the virtiofs process is limited by the kernel
function new_idmap_permitted() in linux/kernel/user_namespace.c.
Say the crosvm process UID is 5000, the uid_map has to be of the form
`<uid inside> 5000 1`. Currently crosvm requires `<uid inside>` to be
0.
These two options are useful when
* crosvm cannot get capabilities,
* there is only one user in the VM accessing the shared files so
changing uid/gid would not happen,
* Only files owned by the current host user (say 5000) are shared to
the VM, and these files need to be owned by the same uid (5000)
in the VM.
If a user use "uid=5000" and "uidmap=5000 5000 1", the device
process changes its uid to 5000 before starting serving requests.
Now we have an identity mapping of user 5000 inside and outside the
device's minijail sandbox, and also inside and outside the VM.
If multiple users want to access the shared
file, gid/uid options are useless. It's be better to create a new
user namespace and give CAP_SETUID/CAP_SETGID to the crosvm.
TEST=cargo test; cargo test -p devices
TEST=cargo test --package e2e_tests --test fs
BUG=b:273346109
Change-Id: I1c59530e1e8bc968a54f40633c444eb64c700e55
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4299943
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Changyuan Lyu <changyuanl@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Since we are going to refactor the vhost-user vsock device, add some
integration tests to make sure we don't break anything.
BUG=b:217480043
TEST=cargo test -p e2e_tests --test vsock
Change-Id: I2a8eaa6c74f8d86aa164ebd92543fe280bc7906c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4337340
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
We switch from the chromeos-5.10 kernel with crostini configs
to a stripped down config building the mainline 6.1 branch.
This allows us more control over the guest kernel for testing
and significantly speeds up e2e tests (~4s -> 1.2s for all
tests run with nextest).
The rootfs is switched to Debian as that's what we use elsewhere
which makes this easier to maintain.
BUG=b:256652981
TEST=presubmit
Change-Id: Ib3897b8dbf3391eefdb1eedb69ec7555f4c77344
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326888
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Running all tests on a local workstation would take ~4-5s currently,
switching to virtio-console will significantly speed up the VM boot
and reduces the runtime to ~2-3s.
BUG=b:256652981
TEST=presubmit
Change-Id: I4ee87c9be4955d9dd89f30a72c91a1af96edf862
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4312801
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Adds a few utilities to that allow us to retry closures and
wait for child processes with timeouts.
These are used to repeatedly try reading from vsocks instead of
sleeping to wait for them to be available.
This is faster and more reliable.
BUG=b:256652981
TEST=presubmit
Change-Id: I2a4c74e8c1f9b8413f7afa22cce8248e74d07092
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4316911
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This allowes fixture to read these settings from env and thus allow
scripts to pass in desired testing configs without requiring a
custom-built rust test harness.
Test command below run in dev container with strace package installed
can produce debug level logs and separate per-process strace results
in designated files.
TEST=CROSVM_CARGO_TEST_E2E_WRAPPER_CMD="strace -ff --output=/workspace/stracetest" CROSVM_CARGO_TEST_LOG_LEVEL_DEBUG=1 CROSVM_CARGO_TEST_LOG_FILE=/workspace/logtest.log ./tools/bench boot
BUG=b:258316090
Change-Id: I5b0eb373802722075242e33027585d702da77e59
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4297485
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This prevents us from using an older version of the image if a newer
version is specified.
BUG=b:269137600
TEST=run_tests
Change-Id: I9962feebb13c69b9fb9c5fb0fba64f265d46d08e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4277626
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
If crosvm launches quickly after starting the backend, it may
find that the device socket does not exist yet. This causes
occasional test failures.
Adding a sleep stabilizes the test a little, but should be replaced
with a proper wait loop while checking for the device socket to
become available.
BUG=b:269174700
TEST=./tools/run_tests --dut=host -E"package(e2e_tests)" \
--no-unit-tests --repetitions 10
Change-Id: Ifaba81a5fb3628d07793b1310229de4a43d2a7b6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4258306
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This was useful since the libtest harness could not capture stdout
for subprocesses and we would get very noisy test results.
However, with nextest, each test is run in a separate process and
will be hidden unless the test fails.
The test log will then contain an host and guest messages interleaved,
which greatly helps debugging.
Also switches the main serial output from syslog (which prints to
stderr) to stdout.
BUG=None
TEST=None
Change-Id: Ie3b377aeaef3ef575f9232430ac7392c83060d98
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4256511
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This is a refactoring that adds the following functionality to
exec_in_guest:
- Receive exit codes from executed commands and by default check
if they are zero.
- Add timeouts to all communication with the guest
- Allow commands to be executed asynchronously, to allow the test
code to perform actions while the guest command is running.
- Add anyhow error handling with contexts for more helpful error
messages
BUG=b:269137600
BUG=b:268539201
Change-Id: Ic069c3ccae363790a124db10a0db76e4ad4384c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4251717
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Zihan Chen <zihanchen@google.com>
They are flaky and that is expected since the feature is incomplete.
BUG=b:269174979
Change-Id: I929e822b7f81742a5dba0fef637d6143f18302b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4256510
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
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>
- 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>
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>
`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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>