Commit graph

252 commits

Author SHA1 Message Date
Dennis Kempin
7150e63ee3 health-check: Add version check for mdformat
On glinux people may have set up the google internal mdformat
tool, which is different from the open source mdformat tool.

BUG=b:236962138
TEST=./tools/health-check --all markdown_format
with PATH updated to use both versions

Change-Id: Ia6b783c52195f2edd33eb836333b28f257be8a32
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894236
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 20:04:56 +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
Dennis Kempin
78f62a44e7 Update copyright header check to cover all files
generated files and a list of excluded files are skipped.
Others are fixed to include the missing header.

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

Change-Id: I13e9bf79df18789f1ed4b83fc47c0c2e080d70a8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894240
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-13 18:41:29 +00:00
Stanko Novakovic
c59c68751c Fallback INET6 socket for machines without INET support
Change-Id: Ic826b0c35b85aa638398e34889e630fa087e0429
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3880838
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-08 23:21:45 +00:00
Dennis Kempin
2d1a214d38 tools/test_target: Fix mingw64 usage
You can now use:

./tools/test_target --build-target=mingw64 set host && source .envrc

to set up the local environment to build/test via wine64.

BUG=b:241495641
TEST=see above

Change-Id: I498d4fda4cb84c2b8326e91f10b42cf33d8c8c41
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3885375
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-09-08 20:38:19 +00:00
Dennis Kempin
a91002bb46 tools/cl: Identify cl's by Change-Id
Otherwise we won't be able to find the corresponding gerrit change
if the commit has been ammended.

BUG=b:239840337
TEST=./tools/cl status

Change-Id: I5a9673414145a0dcc0547c1de6422992478a3094
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3885076
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-08 20:22:26 +00:00
Dennis Kempin
f1e3c34521 common.py: Nit fixes to very-verbose output
Fix stderr output and force single threaded execution to preserve
proper output.

BUG=None
TEST=./tools/health-check -vv --all

Change-Id: I3095e1fcd4cb6abb1852d3fcc3170d5f60141dd5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3884296
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-09-08 17:34:26 +00:00
Dennis Kempin
f875e532a3 Properly handle colors in subprocesses
We have to manually specify color flags when calling processes. Added a
few utility functions to specify those.

BUG=b:243079837
TEST=./tools/health-check --color=always -v
./tools/health-check --color=never -v

Change-Id: I9095a888bbff264d15d3dbba41a2800155aa770f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3880829
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-08 17:08:59 +00:00
Dennis Kempin
e183aaf26a common.py: Command cleanup
In preparation for further changes this CL clarifies the
Command API a little:

- Clear distinction between foreground and hidden usage.
- Clarified --verbose and --very-verbose flags.
- Clarified builder API by adding with_ prefix.
- Clarified behavior of quiet
- More detailed --very-verbose prints

BUG=b:243079837
TEST=./tools/health-check --all

Change-Id: Ib3d1671a018010c50ee6fae9cd7e9cef0ac8b515
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3880964
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-08 17:08:55 +00:00
Dennis Kempin
c1b656f46c tools/presubmit: Align with tests in CI
presubmit has slightly diverged from what we are runnning in CI,
so things like running tests with user space emulation tend to break.

This should make sure that presubmit continues to work.

We can utilized user-space emulation as when we reorganize our tests
to have unit tests that do not have special system requirements. Then
CI will be running those tests with user-space emulation as well.

BUG=b:244185215
TEST=./tools/presubmit [--quick/--all]

Change-Id: I46f6498ad030ad50d42d3365c908a16e6573b5d7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867535
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-06 20:32:54 +00:00
Daniel Verkamp
4e36e8a601 rust-toolchain: update to Rust 1.62
This matches the recent ChromeOS SDK update.

BUG=b:243677117
TEST=tools/dev_container tools/clippy

Change-Id: I5de34abfe0985b5f41ac666ce3e93adbb628d790
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3854975
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-06 17:36:34 +00:00
Dennis Kempin
232e17c6dd Add tests for ./tools/cl
Makes a temporary copy of the git repo for each test so we can
modify the repo for testing purposes.
It's not the fastest test (~12s), but is only run when python files
have been modified. In contrast to other developer tooling, tools/cl
is not used by Luci, so it needs a dedicated test.

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

Change-Id: I06c90a580aa8ed0fa267a41ca40895710121767f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3866692
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-06 17:14:34 +00:00
Judy Hsiao
dbd67e522a audio_streams_conformance_test: support playback test for cras_stream
Support playback test for cras_stream.
It does not support `cargo build --features=chromeos` to enable
the libcras support due to the sys_util dependency of libcras.

The output result is like:

==
audio_streams_conformance_test -P cras --iterations 100

Playback Source: CRAS
Channels: 2
Format: S16LE
Sample rate: 48000 frames/s
Buffer size: 240 frames
Iterations: 100

Cold start latency: 239.692005ms
Records count: 100
[Step] min: 4.68 ms, max: 65.29 ms, average: 5.61 ms, standard
deviation: 6.03 ms.
[Linear Regression] rate: 47576.23 frames/s, standard error: 284.42

BUG=b:238038707
TEST=emerge-${BOARD} audio_streams_conformance_test
TEST=audio_streams_conformance_test -P cras

Change-Id: I2547df7b15cd36adb5452ab09d2a38e417b04dbf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864013
Tested-by: Judy Hsiao <judyhsiao@google.com>
Commit-Queue: Judy Hsiao <judyhsiao@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Auto-Submit: Judy Hsiao <judyhsiao@google.com>
2022-09-02 01:24:20 +00:00
Keiichi Watanabe
53e745078a vmm_vhost: Enable health-check for third_party/vmm_vhost
Make tools/health-check cover third_party/vmm_vhost, as we are
maintaining vmm_vhost by ourselves and we don't pull the upstream
changes so frequently unlike other third_party components.

This CL includes:
* updates in scripts under /tools, and
* the auto-gerated changes by `./tools/fmt --nightly`

BUG=b:239937122
TEST=cargo check

Change-Id: I12956a60bb24764ffb541261c7fb3f09eb974dd8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3863043
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
2022-09-01 15:05:31 +00:00
Zihan Chen
9c3270b08c dev_container: Fix /scratch permission
Correct permission of /scratch to allow crosvmdev to modify its
content after UID & GID changed to match host after container first
start.

TEST=tools/dev_container --stop ; tools/dev_container tools/run_tests
--target=vm:aarch64 --build-only

Change-Id: I8872c433ae903536750a4623f0d149b2875deba2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3855471
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Zihan Chen <zihanchen@google.com>
2022-08-25 18:34:56 +00:00
Daniel Verkamp
bf449563d8 tree-wide: reformat with nightly rustfmt
BUG=None
TEST=tools/fmt --nightly

Change-Id: I9e1985546b364835e252df04dab2c9ecb192047c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3852316
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-08-23 23:33:58 +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
Victor Ding
cb243d3ef0 tools/cl: add 'fetch origin' before 'checkout -B'
'checkout -B' would fail if 'origin' isn't fetched or is too outdated.

BUG=None
TEST=tools/cl # on a repo where 'origin' isn't fetched

Change-Id: I13a5d8a3796c4c9002243902a5f8d145dc9393ef
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3844820
Tested-by: Victor Ding <victording@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Victor Ding <victording@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
2022-08-23 04:40:38 +00:00
Alexandre Courbot
d19ae375b5 crosvm: disable ffmpeg decoder from default builds
We are about to require ffmpeg >= 5.0 in the ffmpeg decoder backend, but
the version on Debian Bullseye (used in our container and VM images) is
still 4.3. Temporarily disable building the ffmpeg crate and video
decoder by default until we use a system image that includes ffmpeg >=
5.0.

BUG=None
TEST=./tools/dev_container ./tools/run_tests
TEST=./tools/dev_container ./tools/run_tests --target=vm:aarch64
TEST=./tools/dev_container ./tools/run_tests --target=vm:aarch64 --build-target armhf

Change-Id: Idf96862d3ea9bea597701fdee8145e12a0753a3e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3835500
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2022-08-23 01:47:48 +00:00
Alexandre Courbot
d874d323c9 tools/clippy: exclude crates on all platforms
Make sure that excluded crates are actually not considered on all
platforms, not just Windows.

BUG=None
TEST=./tools/clippy succeeds and does not attempt to build ffmpeg.

Change-Id: If7167bb6b598692847bbab9f069f875a3fb0b581
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3844812
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
2022-08-23 01:47:39 +00:00
Judy Hsiao
df71d99018 audio_streams_conformance_test: add playback test for NoopStream
The first version of audio_streams_conformance_test.
It is used to test if the implementation of
audio_streams::AsyncPlaybackBufferStream is correct.

This version only supports the playback test of NoopStream.
It prints the following information for NoopStream.
==

Playback Source: NoopStream
Channels: 2
Format: S16LE
Sample rate: 48000 frames/s
Buffer size: 240 frames
Iterations: 10

Cold start latency: 3.89µs
Records count: 10
[Step] min: 4.94 ms, max: 5.15 ms, average: 5.01 ms,
standard deviation: 0.06 ms.
[Linear Regression] rate: 47916.19 frames/s, standard error: 2.0

BUG=b:238038707
TEST=cargo run

Change-Id: Ifca7dfd35473ffd75856a27e2c6aa1555eba7576
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3805090
Tested-by: Judy Hsiao <judyhsiao@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Auto-Submit: Judy Hsiao <judyhsiao@google.com>
2022-08-22 08:17:59 +00:00
Dennis Kempin
1e16dc6a8f tools/run_tests: Add --cov option
The option will generate an lcov file in the standard name lcov.info
and print a coverage report after running tests.

The lcov.info file is understood by many IDE plugins, e.g. "Coverage
Gutters" for vscode.

BUG=b:239255082
TEST=./tools/run_tests --cov

Change-Id: I475c62ada73f100a984ad863e511083c69807aff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840956
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-08-19 18:05:35 +00:00
Dennis Kempin
3b60f0ca33 reland: test_runner: Support multiple profiles per test
Tests may spawn multiple processes (e.g. for running crosvm in
integration_tests). We want those to generate a separate profile
file to collect them as well.

This should add coverage from integration tests into the coverage
data.

Fixed coverage collection with repeated test runs

BUG=b:239255082
TEST=./tools/run_tests --generate-lcov coverage.lcov --repeat 2

Change-Id: I63e812620b79182a5be7e981b8f524b36b596ce2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840484
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-19 17:51:37 +00:00
Junichi Uekawa
5c6c6a14f8 tools: Remove rebase_for_review script.
./tools/cl supports rebasing now.

BUG=None
TEST=None

Change-Id: I94f46da2a37d2061714420ad040fe15074b55cd3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3833797
Tested-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-08-19 08:22:45 +00:00
Dennis Kempin
39b125eb72 Revert "test_runner: Support multiple profiles per test"
This reverts commit 9ec4afc0ae.

Reason for revert: Breaks post-submit

https://ci.chromium.org/ui/p/crosvm/builders/ci/linux_x86_64/b8805461167965542065/overview

Original change's description:
> test_runner: Support multiple profiles per test
>
> Tests may spawn multiple processes (e.g. for running crosvm in
> integration_tests). We want those to generate a separate profile
> file to collect them as well.
>
> This should add coverage from integration tests into the coverage
> data.
>
> BUG=b:239255082
> TEST=./tools/run_tests --generate-lcov coverage.lcov
>
> Change-Id: Ic6c6b0801b676c96c4692069c1cd6111edea6fc4
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840311
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Commit-Queue: Dennis Kempin <denniskempin@google.com>
> Tested-by: Dennis Kempin <denniskempin@google.com>

Bug: b:239255082
Change-Id: I958792f86a5d5bc24910c057c61242fe405db20d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840169
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
2022-08-18 21:21:55 +00:00
Dennis Kempin
9ec4afc0ae test_runner: Support multiple profiles per test
Tests may spawn multiple processes (e.g. for running crosvm in
integration_tests). We want those to generate a separate profile
file to collect them as well.

This should add coverage from integration tests into the coverage
data.

BUG=b:239255082
TEST=./tools/run_tests --generate-lcov coverage.lcov

Change-Id: Ic6c6b0801b676c96c4692069c1cd6111edea6fc4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3840311
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-08-18 18:42:17 +00:00
Dennis Kempin
43056010ab tools/cl: Always upload to origin/main
Even though the remote tracking branch may be different. We want to
upload to origin/main.

BUG=b:242822949
TEST=from a cros/chromeos tracking branch: ./tools/cl upload

Change-Id: Iff35092f019c1f34773f72b20cc955990ec13a2a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3833641
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-18 16:53:24 +00:00
Dennis Kempin
67961f3d33 tools/impl/common.py: Remove __future__ import
The __future__ import has to be the first line, but will fail
if we are not using at least Python 3.7.
All it changes is the evaluation time of type annotations, so we
have to wrap some names into strings.

BUG=None
TEST=./tools/cl

Change-Id: Ib880fb29fc7a426622d03a996354b13639656c71
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3833640
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Paramjit Oberoi <psoberoi@google.com>
2022-08-18 00:18:27 +00:00
Dennis Kempin
7a4d4d6b2a health-check: Add check for newline at ends of files
Fixes a couple of files that were missing them.

BUG=b:242605601
TEST=./tools/health-check --fix

Change-Id: I620d6a939cb824e014002152584aacfc5dfdf7e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3835648
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-18 00:17:04 +00:00
Dennis Kempin
38b9268cb8 health-check: Add infra checks
Adds presubmit checks for both lucicfg files and python recipes.

Both can "fix" issues by re-generating configs / test expectations.

This adds depot_tools as a submodule to crosvm, which contains the
required tools for luci.

Does not validate the infra config. Unfortunately this is only
possible with luci authentication which we do not have inside
Docker.

BUG=b:242605601
TEST=./tools/health-check with changes to config and recipes.

Change-Id: I1bf18ebac698e44df7d6a0d6c8e9c26bcfde364b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3832783
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-08-18 00:17:04 +00:00
Dennis Kempin
34a4ee662f health-check: Add copyright header check
New files will require a copyright header, which is checked by CI
and locally.

BUG=b:242605601
TEST=touch foo.rs && ./tools/health-check; ./tools/health-check --fix

Change-Id: I31bf299bd636a5da4f806c32ca8bdf9cfd4c01f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3832787
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-16 22:15:14 +00:00
Dennis Kempin
abcfc67d8b Add python configs for consistency between IDE and CI
Also adds settings to .vscode/settings.json to use the correct
formatter and type checking settings out of the box.

VSCode uses pyright and health-check uses mypy. They do not always
agree unfortunately, mypy  is a little more lenient.
Unfortunately pyright is hard to get working with our scripts that
have no file extension.

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

Change-Id: Iaef4ac6f61613e7dda409d5e717102ea9adefe82
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3833699
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-08-16 18:33:23 +00:00
Dennis Kempin
84f0f4f068 tools/health-check: Remove legacy checks used by Luci
Since luci recipes are updated asynchronously, we had to keep
the old check names around. Now that all builders are updated,
we can remove it.

BUG=b:239255137
TEST=CQ

Change-Id: I0550912d466045e12da1717cdb96346de9474ab7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3831283
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-15 19:48:02 +00:00
Dennis Kempin
29dce9b14c Add Cargo.lock check to tools/health-check
The check will verify that the Cargo.lock file is current. This
catches issues where conflicting changes would leave ToT with
an outdated lockfile.

BUG=b:240435583
TEST=./tools/health-check lockfiles

Change-Id: Idd92fe58d3b76f62582848673cbfdd18698ac3e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3811202
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-08-15 19:38:44 +00:00
Dennis Kempin
92f804e3f8 tools/health-check: Revamp script to run on git delta only
The updated health-check will by default only run on modified
files. If you do not make changes to python code, python checks
won't run, etc.

The script also simplifies the writing of those checks so we can
start adding more of them.

Luci will be updated to make use of the --list-checks function to
run each check in a separate luci step. In the meantime, we
keep a compatibility layer to translate the old arguments
to the new style.

BUG=b:239255137
TEST=./tools/health-check in all it's variations

Change-Id: I21b986b46c7cfccf3d13f4c76bbd3d0ec7240c26
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3827174
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-15 18:52:02 +00:00
Dennis Kempin
0a826cc508 run_tests: Enable profile collection from remote tests
Write profiles to a temp file and download them afterwards.

BUG=b:239255082
TEST=./tools/run_tests --target=vm:aarch64 --generate-lcov=aarch64.lcov

Change-Id: I1c81dd72aadca4cad3310347d94596d45a0e0ede
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3821463
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-08-12 22:58:56 +00:00
Dennis Kempin
f311edea46 tools/run_tests: Enable/disable cargo color output based on tty
This will keep colorized output for interactive usage, but disables
it for Luci logs.

BUG=b:239990667
TEST=tools/run_tests vs tools/run_tests > foo

Change-Id: Ie8667c1c2c1421ab45d0b98f42ce4df3d971d531
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3818250
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-08-09 17:14:52 +00:00
Daniel Verkamp
ff37ba14d1 test_target: update usage docs to use 'set'
'set_test_target' is now spelled 'test_target set'.

BUG=None
TEST=tools/test_target --help

Change-Id: I515e87db0f9e7407506de5fede930866df77d764
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3811682
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-08-08 21:25:20 +00:00
Vikram Auradkar
4f8a3ac153 crosvm: build crosvm on windows
- Compiles out pvclock, sandbox and slirp (thereby net device)
- Disables default features on windows (audio and gpu are not ready yet)
- Enables unit tests for crosvm

BUG=b:213146388
TEST=presubmit

Change-Id: I5f4b3d8bf44d9c571c3a191a632e09550a4f1869
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3807045
Tested-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
2022-08-04 03:19:02 +00:00
Dennis Kempin
dc94a3b001 tools/run_tests: Add lcov generation
Use the recently stabilized coverage instrumentation feature of
rust to generate coverage profiles of our test runs.

These can then be used by a recipe to upload coverage to covecov
or use tools locally to generate coverage reports.

BUG=b:239255082
TEST=./tools/run_tests --generate-lcov coverage.lcov

Change-Id: Ifc64d11f3ae19a2eb7fdce36172d67bf3f7e6d17
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3805831
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-02 23:35:20 +00:00
Elie Kheirallah
3d73239a7c tools: Add libguestfs-tools to deps
libguestfs-tools added, required for using virt-builder.

Bug=None
Test=./tools/install-deps && ./tools/examples/example_simple

Change-Id: If8db63debfb8e70cbf663b0c0e1d5acb0de43aa3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3790022
Tested-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
2022-08-01 23:06:24 +00:00
Keiichi Watanabe
950b4839a8 tools: Use --no-default-features in crosvm-direct builder
Since ChromeOS's crosvm ebuild uses `--no-default-features` for
crosvm-direct, our LUCI builder should do so, too.

BUG=b:220292205
TEST=./tools/run_tests --target=host --crosvm-direct

Change-Id: I2550bf5931e90ebf434fda0990ac5d707ba5ac12
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3802108
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-01 17:20:43 +00:00
Daniel Verkamp
8930ba079f crosvm: update book and doc links to crosvm.dev
Replaced using this script:

git grep -l 'https://google.github.io/crosvm' \
 | xargs -n1 sed -i \
 -e 's^https://google.github.io/crosvm/doc/^https://crosvm.dev/doc/^g' \
 -e 's^https://google.github.io/crosvm/^https://crosvm.dev/book/^g'

BUG=None
TEST=mdbook build doc/book

Change-Id: I8df4e0bcc1ca1e9044df29998572393c934e29cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3795005
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-29 22:54:01 +00:00
Daniel Verkamp
a77c40ec06 tools: enable search feature for mdbook
This will generate the search index and in-browser search for the book.

BUG=None
TEST=mdbook build docs/book

Change-Id: Ibaf67002c5b5d5cf1aafd19ab66a05b9116b14a0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3792098
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-29 21:16:21 +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
f2b8cb84bd Add --nightly option to rustfmt
This allows you to use the nightly version of rustfmt
to reformat imports as well.

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

Change-Id: I07c2fd1ad59ddfed3d97b636f991ae50076fd5d3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3792430
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
2022-07-28 23:06:51 +00:00
Zihan Chen
216a22426c dev_container: Uprev to include clang
Need clang to compile minijail policies

TEST=new container can build crosvm with minijail policies included
BUG=b:235858187

Change-Id: Id26898025ef1ff3148da2edc5af3d923a00401c2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3792428
Commit-Queue: Zihan Chen <zihanchen@google.com>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Zihan Chen <zihanchen@google.com>
2022-07-28 21:56:31 +00:00
Zihan Chen
b6b5a58d75 tools: Spawn dev container in per-checkout names
CRC32 of checkout's path is now part of dev-container's instance
name.

TEST=`docker ps` shows crc of script's absolute path in checkout
FIXED=b:237592974

Change-Id: I7179c40e5c8436a5866d5d75b01696dc788725c9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3790038
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Zihan Chen <zihanchen@google.com>
Auto-Submit: Zihan Chen <zihanchen@google.com>
2022-07-28 19:42:41 +00:00
Daniel Verkamp
d1a6e9cf94 rust-toolchain: update to 1.60.0
The ChromeOS toolchain is updated to this point, so bring our crosvm
testing in line.

BUG=b:239075544
TEST=tools/presubmit --all

Change-Id: I6bfa7bfd802f1cd75204ba59b560de176a56326f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764424
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-07-28 17:46:00 +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