Commit graph

37 commits

Author SHA1 Message Date
Alexandre Courbot
ddf9b82855 integration_tests: use --block for disk options
As disk, rwdisk, root and rwroot are deprecated, switch to the unified
block command-line option.

BUG=None
TEST=cargo test -p integration_tests

Change-Id: I95109853f4b66bdd611c13c8eea92644f1892079
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3990101
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-11-01 05:06:16 +00:00
Dennis Kempin
f8eb24052e Reformat all files with nightly
Run tools/fmt --nightly

BUG=None
TEST=None

Change-Id: Iaccfc5fe141c512f4b508c699f89686a4552bf96
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3988327
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-10-31 21:33:33 +00:00
Keita Suzuki
5f4321b0a3 integration_tests: add tests for disk resize command
Add the test for disk resize command. This patch also updates the Vm
fixture to support additional argument to the command, and also updates
the Vhost-user backend fixture to use devices command.

BUG=b:243127910, b:191845881
TEST=./integration_tests/run

Change-Id: I8f1f4bd6a986ea77507a2ed6f1ae8582b10d3178
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3954786
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-10-17 23:59:37 +00:00
Daniel Verkamp
990a0ce365 integration_tests: search for mkfs.ext4 in sbin via PATH
Some distributions (such as Debian) put the mkfs.ext4 binary in /sbin or
/usr/sbin. However, in our case, we don't need to be root, since we are
only using it to create a filesystem inside a normal file, not on a
block device. Adding these directories to the path lets us find the mkfs
binary on these systems without requiring sudo privileges.

BUG=None
TEST=cargo test -p integration_tests -- --test-threads=1

Change-Id: I9b180f941ee81c5febf78004050d211fe1912621
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3940108
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
2022-10-12 20:28:04 +00:00
Frederick Mayle
77e9606589 integration_tests: print more info on startup failure
I got stuck on the "/var/empty doesn't exist" error when setting up on a
new machine. This makes it much easier to diagnose.

Change-Id: I08f7e025fc3ddec92f58a0ce10c6a8ca6bdc84d7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3939625
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2022-10-10 20:25:18 +00:00
Vikram Auradkar
1acc0a28d9 prebuilts: move prebuilts tests under tests
BUG=b:246987526
TEST=presubmit

Change-Id: I86eed7c84f7e21eb7155695489ee9446f999dc1d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3936733
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-10-07 15:54:37 +00:00
Daniel Verkamp
7c6d8bec3f health-check: enforce blank line after copyright
While we are tweaking all of the copyright headers, let's take the
opportunity to ensure there is always a blank line after the copyright
header for consistency. (Almost all files already follow this style.)

This includes a slightly ugly regex to allow the end of a C-style
comment block after the end of the copyright:

/*
 * Example comment block
 */   <-- this line

Change-Id: Idfd0855861e5ecb3d33afae942fdba908af0dcff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892521
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-09-13 22:24:35 +00:00
Dennis Kempin
1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00
Zihan Chen
b233d7d60a crosvm: Embed seccomp filters into binary
Seccomp policy files will now pre-compile to bpf bytecode for
target architecture and embedded in the crosvm binary when not
built for chrome os.
When minijail is not checked out in crosvm tree as a submodule,
MINIJAIL_DIR environment variable needs to be specified for the
policy compiler to run.
Integration tests are now sandbox enabled for better coverage.

TEST=all tests passed, vm runs fine with sandbox on and no separate
policy files present. cros deploy & crostini still works.
BUG=b:235858187
FIXED=b:226975168

Change-Id: Ieaba4b3d7160ccb342a297ebc374894d19a8dc4d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3824062
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2022-09-08 21:12:55 +00:00
Zihan Chen
483345c4c0 dev_container: Use host UID & GID for user in container
Container shell now defaults to user `crosvmdev` which will have
same UID & GID as outside user. VS Code Remote Containers extension
has the same behavior when loading config from devcontainer.json.

TEST=all tests pass in container, new files in container have same
permission as files created outside.
FIXED=b:239476013

Change-Id: Ib3c696509e9ea45edd5f02ff025d9477576ec765
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3814094
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-23 23:16:09 +00:00
Keiichi Watanabe
3aa64129d9 integration_tests: Add virtio-blk test
BUG=b:243127910
TEST=./integration_tests/run

Change-Id: I6497cf61238e698b77aa8cea94c1be65f707cc8e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3820965
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-08-19 13:40:35 +00:00
Keiichi Watanabe
b80068d3ab integration_tests: fixture: Set kernel path after extra arguments
BUG=none
TEST=./integration_tests/run

Change-Id: I1036161ce6b3e3348c7a672b6a58cfacbf1b4ddd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3820964
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-08-10 02:37:07 +00:00
Keiichi Watanabe
0f6d0258c0 integration_tests: Check VM's exit code
BUG=none
TEST=./integration_tests/run

Change-Id: Ia763c5330eafd28f347becb858a7a42330c232c8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3820963
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-08-10 02:37:07 +00:00
Frederick Mayle
bc927456ad integration_tests: Simple backwards compatibility test
The goal is to detect (possibly backwards imcompatible) changes to the
virtual hardware exposed to guests. To start with, it only checks the
PCI devices.

Example failure output when the iommu is removed:

    thread 'backcompat_test_simple_lspci' panicked at 'assertion failed: `(left == right)`
      left: `"00:00.0 0600: 8086:1237\n00:01.0 00ff: 1af4:1057 (rev 01)\n00:02.0 00ff: 1af4:1042 (rev 01)\n00:03.0 00ff: 1af4:1044 (rev 01)\n00:04.0 00ff: 1af4:1045 (rev 01)\n00:05.0 0c03: 1b73
    :1000\n00:06.0 ffff: 1b36:0011 (rev 01)\n00:07.0 0604: 8086:3420"`,
     right: `"00:00.0 0600: 8086:1237\n00:01.0 00ff: 1af4:1042 (rev 01)\n00:02.0 00ff: 1af4:1044 (rev 01)\n00:03.0 00ff: 1af4:1045 (rev 01)\n00:04.0 0c03: 1b73:1000\n00:05.0 ffff: 1b36:0011 (re
    v 01)\n00:06.0 0604: 8086:3420"`: PCI Devices changed:
    <<< Expected <<<
    00:00.0 0600: 8086:1237
    00:01.0 00ff: 1af4:1057 (rev 01)
    00:02.0 00ff: 1af4:1042 (rev 01)
    00:03.0 00ff: 1af4:1044 (rev 01)
    00:04.0 00ff: 1af4:1045 (rev 01)
    00:05.0 0c03: 1b73:1000
    00:06.0 ffff: 1b36:0011 (rev 01)
    00:07.0 0604: 8086:3420
    <<<<<<<<<<<<<<<<
    >>> Got      >>>
    00:00.0 0600: 8086:1237
    00:01.0 00ff: 1af4:1042 (rev 01)
    00:02.0 00ff: 1af4:1044 (rev 01)
    00:03.0 00ff: 1af4:1045 (rev 01)
    00:04.0 0c03: 1b73:1000
    00:05.0 ffff: 1b36:0011 (rev 01)
    00:06.0 0604: 8086:3420
    >>>>>>>>>>>>>>>>
    ', integration_tests/tests/backcompat.rs:21:5

    ... vm serial output ...

`pub mod` is used to avoid deadcode warnings. Changed boot.rs to do the
same for consistency and future proofing.

BUG=b:231365736
TEST=./integration_tests/run

Change-Id: Ia33d6631e3385ce3633cadff552a6253bb486f93
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3795888
Auto-Submit: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Frederick Mayle <fmayle@google.com>
2022-08-02 17:32:50 +00:00
Daniel Verkamp
600ad38ff8 Remove redundant {self} imports
- Remove trailing ::{self} on all use statements
- Remove any resulting single-level use statements (e.g. use libc;)
- Reformat with `tools/fmt --nightly`

BUG=b:239937122
TEST=tools/dev_container tools/presubmit --all

Change-Id: I8afd1b0458ca6d08d9b41a24583f7d4148597ccb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3798973
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-01 21:27:54 +00:00
Frederick Mayle
528777ab32 integration_tests: Don't run fixture.rs as a test
Each file in the "tests" dir is interpreted as a test, so cargo was
running fixture.rs as a test with 0 test cases. Moved it into a
submodule as recommened in
https://doc.rust-lang.org/book/ch11-03-test-organization.html#submodules-in-integration-tests

TEST=./integration_tests/run

Change-Id: I7cbb9a2e5e1283829e20d531a90f9d0c1fffd232
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3795890
Auto-Submit: Frederick Mayle <fmayle@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-08-01 17:29:54 +00:00
Dennis Kempin
1f0b985a4d Update cloud storage locations to use crosvm-infra project
See go/crosvm/infra for instructions on how to get access to uploading
them.

Added a helper script to install dependencies needed to build the
guest_under_test.

BUG=b:235269312
TEST=Kokoro

Change-Id: I78387a33ddbf3ab199b36e76ba617acb1250c7e5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783011
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-07-29 02:17:15 +00:00
Dennis Kempin
4fea399df9 Reformat imports
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.

Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.

BUG=b:239937122
TEST=CQ

Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-28 00:15:50 +00:00
Keiichi Watanabe
eb8cfb4b18 tools: Add crosvm-direct support for run_tests
BUG=b:220292205
TEST=./tools/run_tests --target=host --crosvm-direct

Change-Id: Ife25129d405cd1e514bf812cc31621313f2007b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708759
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
2022-06-22 21:51:53 +00:00
Keiichi Watanabe
0974be8042 integration_tests: Define Config struct
Define `struct Config` to specify crosvm arguments so it'll make it
easier to add more complicated arguments in future CLs.

BUG=b:220292205
TEST=./integration_tests/run

Change-Id: I89921e171a81071dbfc58d22b233e9c71abcdf54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686717
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-22 01:46:18 +00:00
Keiichi Watanabe
19d2fd9c47 integration_tests: Remove debug field
Remove `TestVm`'s `debug` field and print guest outputs unconditionally.
This won't make the test log messy because the output is hidden unless
the test case fails.

BUG=none
TEST=./integration_tests/run

Change-Id: Ica77492229b547f2e244f2751992869b00b78f7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686716
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-08 07:19:40 +00:00
Keiichi Watanabe
52d56f1d37 integration_tests: Print guest logs only when a test failed
Forward crosvm command processes' stdout/stderr to the test process's
stdout so that the messages will be hidden by `cargo test` unless the
test case fails.

BUG=none
TEST=./integration_tests/run with/without additional panic!() in a test

Change-Id: Ife290fb5333fd792cabdad35acea54732f864610
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686715
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-08 07:19:38 +00:00
Anton Romanov
8bf7292d1a Make crosvm.rs a mod instead of a separate lib crate
Change-Id: Iedb8c632853bb5b0484ab6e6522d41580a413dae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3668921
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-06-02 18:56:24 +00:00
Anton Romanov
bed40ad547 crosvm: migrate to Rust 2021 edition
BUG=none
TEST=cq

Change-Id: I0059c970879b78bfd40b6ce58b10debcf154b50f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508322
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-03-09 01:16:03 +00:00
Vikram Auradkar
ae5118f5c7 Enable windows tests for a few crates
Run tests for sys_util_core, poll_token_derive and balloon_control on
windows.

Using dotfiles to disable/serialize test runs of a subset of crates does
not work well with third party crates as it forces us to commit the dot
file to the crate.

The patch modifies and uses the script that runs linux tests.
This patch also allows us to
- build/test child crate even if parent crate has disabled build/test.
- avoid building crosvm if it is not explicitly specified.

RIP short lived .windows_build_test_skip. You allowed us to run noop
kokoro tests.

Test: py .\tools\impl\test_runner.py --arch x86_64
Bug: b:215610772
Change-Id: Icc6d04ffd7c0c33d4f60aeac16fc7d23881c387d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3459809
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-18 03:18:58 +00:00
Vikram Auradkar
0108238474 Upstream windows build/test script
The patch also adds files to skip building and testing crates on
windows. When we run
```
tools/windows/build_test.py --skip_file_name .windows_build_test_skip
```

the build/test succeeds without actually doing anything as build/test
for all crates is skipped by creating '.windows_build_test_skip'.

Bug: 213170957
Test: Ran script on downstream repo
Change-Id: Iebd2cea463ee722be4feaed88229e1fb5e9fd6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3417918
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-01-28 00:55:08 +00:00
Dennis Kempin
6b06f405ff docs: Use mdformat to format markdown files
The tool is added to ./tools/fmt which will be called during
./tools/presubmit as well as by Kokoro during testing.

This requires a new dev container version to bundle the mdformat
tool in the container.

Note: mdformat does not have any IDE integrations, but the prettier
plugin with prose-wrap enabled and a line length of 100 provides
almost identical results.

BUG=None
TEST=./tools/fmt --check

Change-Id: I0ae5659eff8555df7c85c70e62095a1e116b98da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3416098
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-01-27 21:29:11 +00:00
Dennis Kempin
a1e42f07ea Enable clippy on more workspace crates
As before, some are automatically fixed by clippy, some manually
fixed.

BUG=b:192373803
TEST=./tools/presubmit

Change-Id: Ifcab4cf60775ee6bb7d4530af6406a74958432ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3283683
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-11-15 23:55:42 +00:00
Daniel Verkamp
7fd815ed22 crosvm: switch to upstream tempfile crate
Use the crates.io implementation of tempfile instead of our own version.

Our reimplementation is kept in the tree for now in case of dependencies
outside of the crosvm tree; it can be removed later once those are fully
switched over to the crates.io implementation.

BUG=b:199204746
TEST=emerge-hatch crosvm

Change-Id: I07d3404239302ab9a17f4ddc82a9479b256e4eb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3209839
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-10-11 18:35:55 +00:00
Junichi Uekawa
25724e2ccc integration_test: Check file system before running test.
We need a file system that supports O_DIRECT. We know ext4 to work and
tmpfs not to work. Try out O_DIRECT before running the individual tests.

Follow up to changing the configuration so that the next time I can notice the
failure reason faster.

BUG=b:190435784
TEST=integration_tests/run

Change-Id: I7f8a97005dd959a5d0af4d1a91459b7bffc0fa9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3096427
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-24 21:56:52 +00:00
Junichi Uekawa
3001c2fc73 integration_test: Do not throw away stdout/stderr.
When nothing fails, output is ignored, but when something fails, you'd
want to look at the error messages.

BUG=None
TEST=time ./builder --vm ./run_tests

Change-Id: If6e73588b33714dea1e7f097a91c80f7c249be48
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3083207
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-08-12 23:58:33 +00:00
Junichi Uekawa
7cbd02f109 crosvm: Add integration test case for O_DIRECT.
Make sure we keep booting.

BUG=b:190435784
BUG=b:184204645
TEST=boot tests (boot_test_suspend_resume, boot_test_vm) pass.

Change-Id: I586e555ae83759c88759e1aeb96a728785d0cf5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3055557
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-08-11 02:22:41 +00:00
Junichi Uekawa
fc325cdd23 integration_tests: Show error message passed down instead.
Might help a bit more when things stop working.

BUG=None
TEST=./integration_tests/run  # and observe the error message.

thread 'boot_test_suspend_resume' panicked at 'called `Result::unwrap()`
on an `Err` value: InvalidFd', integration_tests/tests/fixture.rs:176:24

becomes

thread 'boot_test_suspend_resume' panicked at 'failed to initiailize
syslog: guess of fd for syslog connection was invalid',
integration_tests/tests/fixture.rs:177:13

Change-Id: Ife82b9e430d416a40cefced258e7f9bdc589bf73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3055551
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-07-28 07:23:57 +00:00
Dennis Kempin
3f63661afc Run integration_tests by calling crosvm binary
Instead of instanciating crosvm directly, we can start the binary as
a sub-process.
This includes parsing of crosvm options in the tests, and makes the
test cases closer to real-world usage.

To make make this possible, we need to make sure that the crosvm binary
is uploaded to the VM before running the test, which is done by the
sync_so script, which is baked into the builder container.
We prevent future container re-builds for just maintaining the script,
I have removed them from the container, and call the scripts from the
local source directly.

The test runner is also updated to ensure all package binaries are
built (currently only tests are built).

BUG=b:182841358
TEST=./test_all passes

Change-Id: I7dfd21abcb2b90fe125eb43f85572fbf645b888a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2744280
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-03-19 20:35:53 +00:00
Dennis Kempin
ebc0520d0b Enable integration_tests on Kokoro for X86
Increases the communication timeout to 10 secs since we are running
twice nested KVMs, and things get a bit slower.

BUG=b:181675114
TEST=./test_all

Change-Id: Ifa3ea05952cd8a4f7fbe4fefb12143098243c21a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2752341
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-03-17 00:04:27 +00:00
Dennis Kempin
f217c0fb46 integration_tests: Add prebuilts for aarch64
Updates the guest_under_test Makefile / upload script to build
for aarch64 as well.

BUG=b:176748319
TEST=Unfortunately KVM is not fully functional in our arch64 VM, so I have
not been able to test the prebuilt yet.

Change-Id: I554da6a620b26ffa1db34baa13d529f0b1de1616
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2676994
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-03-12 22:50:30 +00:00
Dennis Kempin
0797a55462 Framework for extended integration tests
This CL expands the existing boot.rs test to not just boot a kernel
but also provide a debian-based rootfs and a special init binary
that is used to communicate between test code and the guest VM.

The delegate binary listens for commands on /dev/ttyS1 and returns
the stdout of the executed command.
This allows the test code to setup pipes for the serial device to
issue commands in the client and receive the command output, which
provides a good foundation for tests of basic functionality without
the need to pass test binary code into the guest.

The integration tests will pull a prebuilt kernel and rootfs image
from cloud storage unless local files are specified via ENV variables.

The integration_tests/guest_under_test directory contains the files
needed to build and upload those prebuilts.

BUG=b:172926609
TEST=This is a test.

Cq-Depend: chromium:2551073
Change-Id: Iffb88a146a13d1b6ed7250df1b487bd87a5599d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2536831
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
2021-01-20 17:48:10 +00:00