I can't reproduce the test flake, but I suspect the issue is that, in
the test infa machines, the restore is slow enough that it causes the 5
second timeout for sending a command to the guest to fail.
Instead of immediately proceeding with the test, wait for the restore
work to finish first. This allows us to use a longer timeout and also
should make it more obvious which step of the test is slow and/or flaky.
BUG=b:333090069
TEST=./tools/run_tests --dut=host --filter-expr="test(snapshot_restore) | test(suspend_resume)" --run-root-tests --no-unit-tests --repetitions 100
Change-Id: I75ad900dcd080d4fa76ceca14974ac044b41e7d5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5446126
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Make it easy to tell which prebuilt revision is used for the run.
BUG=b:295256641
TEST=CQ
Change-Id: Ib62d0539a248abe83291c4cec8085f929f159b2b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5343248
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Auto-Submit: Hikaru Nishida <hikalium@chromium.org>
This is only used by the e2e_tests, so it should not affect most
downstream projects.
BUG=b:321994092
Change-Id: I42bc550c273d68960174bcf577ea0555cb22ef12
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5232209
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Nigthly is enabled as part of https://crrev.com/c/4950268
This change contains the formatting changes resulting from the switch.
BUG=b:302055317
TEST=dev_container presubmit format --no-delta
Change-Id: Idaf2b8bae2e09c624b19d9cd3dd5fc8e4d099b3c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5067088
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This fixes "unused return value of `std::result::Result::<T, E>::map_or`
that must be used" warnings with Rust 1.73 and also makes the code
easier to understand.
Change-Id: Id028a0859db6a7b6670e1ed6f9c9cc443a2e7c61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5007729
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Updates are made to source and documentation.
This more accurately represents the currently supported platforms of
Android/Linux and Windows, without unexpectedly including other
unix-like operating systems.
Command to reproduce:
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -i 's/cfg(unix)/cfg(any(target_os = "android", target_os = "linux"))/g' {}
$ cargo fmt
md files manually updated to fix line lengths.
Renaming `unix` modules to `linux` will be done in a later CL.
Test: ./tools/dev_container ./tools/presubmit
Bug: b/298269162
Change-Id: I42c1bf0abf80b9a0df25551613910293217c7295
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909059
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Add a preliminary version of pgbench running in e2e_tests
facilities. It currently does nothing with the benchmark result.
TEST=Can pass and produce results with `./tools/bench postgres`
BUG=b:257303497
Change-Id: If2f06cb0a9c91f5d7240094bacf86fc681062127
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4763144
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Delegate has been restructured to support this change, and sadly
Win64 compile exclusion has to be reintroduced to avoid compiling
this binary on Windows.
Now e2e_tests can explicitly obtain result (including stdout/stderr/
exit code/signal) from command ran in test guests.
BUG=b:257303497
Change-Id: Ibcd773b69cca9708a8dacb34cc870ca527fa32c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4787727
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
As usual, some unsorted and grouped imports have appeared.
Change-Id: I79b51e4c52cee38f5b8c238e46dfe3193c753554
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4847980
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Test fixtures can now automatically create required temporary or
uncompressed raw disk images from provided url to be used as rootfs
image. This allow tests with rw rootfs requirement to be executed
repeatedly.
TEST=run postgres test with new options
BUG=b:257303497
Change-Id: If0537945beb427d15be0bec2f7a7d18daf595070
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4776167
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
If crosvm fails at the early stage of setup, opening to_guest fifo
blocks forever and it takes 20 seconds to timeout.
Opening to_guest fifo should be wrapped by timeout as well as
from_guest.
Check the crosvm process status periodically to abort testing earlier.
With this change, the total e2etest execution for failure case is
reduced to 0.2s from 20s.
There is better way without panicking on timeout; interrupt the blocked
open(2) for fifo by pthread_kill(). However it is too much since this is
just a test. panicking is welcome.
BUG=b:293383846
TEST=./tools/run_tests2 --dut=vm -E 'rdeps(e2e_tests)'
Change-Id: I8735a77201f930162113efa98d655f77be8d259d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4721027
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
This CL implements PCI hotplug feature for virtio-net device. The
feature is controlled by pci-hotplug feature flag and pci-hotplug-slots
runtime flag. No behavior change to crosvm unless pci-hotplug-slots flag
is set to a nonzero value.
BUG=b:243767476
TEST=tools/presubmit
TEST=e2e_test::tap_hotplug for TAP device hotplug and removal
TEST=manual test for TAP device hotplug and removal with swap
Change-Id: I5a60314293ef8a27981d7b550a61822491c254bb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4473610
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Shin Kawamura <kawasin@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Jason Iman <jasongustaman@chromium.org>
A hand-made initramfs and an updated kernel that supports initramfs
are uploaded alongside this CL. This test is added for the sole
purpose of letting the CQ to continously verify specifying custom
artifacts in e2e_tests is not broken. At its current speed, it's
not the slowest e2e tests we have.
TEST=CQ
BUG=b:257303497
Change-Id: I19baf495ce8af4805f76f16a5f831f86959d41a8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697698
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Currently commands Suspend and Resume to the VM will only sleep the
Vcpus but not devices. This results in a partial suspend/resume since
devices can still be running and potentially modifying the env (filling
up buffers, modifying variables). The aim of this CL is to put the
devices to sleep when the VM is put in suspended mode, and to wake the
devices when the VM goes back to resumed mode.
Added new flag to `suspend` and `resume` commands: `--full`
which does a full VM suspend.
Added new VmRequest: SuspendVm, ResumeVm.
Added suspend/resume test that also suspends/resumes devices, thus
doing a Full VM suspend/resume.
Also now tracking the state of devices before sleep, just like Vcpus
BUG=N/A
TEST=presubmit, e2e_tests
TEST=boot a VM, suspend, resume
Change-Id: Ia13fbdf7bb6765dd20bd3c67af5212e9c842b824
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4616827
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Currently, cmds cannot be sent to the guest on cold restore
boot, so some
investigation is needed. However, this still provides a useful coverage
test for cold restoring.
This CL also updates VirtioPciDevice so that cold restore won't break
for vhost user devices by returning early for sleep
and wake if the device has not been activated.
BUG=b:280607404
TEST=snapshot_vhost_user_root test passes
Change-Id: I28a12dbb6f0f009b8253c5f679dd9963b3fd12b4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4609418
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
TestVM can now be configured to run on specific local or remote
kernel, initrd and rootfs images. This allow us to broaden e2e test
coverages to more diverse use cases.
TESTED=Relevant test case passed CQ and locally
BUG=b:257303497
BUG=b:181105093
Change-Id: I1270a189105af89259371f54b7df227b3efae380
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4451468
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
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>
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>