Commit graph

25 commits

Author SHA1 Message Date
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
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
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
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
767e094fb8 tools/run_tests: Use triples for arch
Updates run_tests to use cargo style target triples for specifying
build targets. A simple 'aarch64' or 'armhf' was nice while we just
had linux builds. We now are looking at windows and possibly
different toolchain options (e.g. msvc vs gnu), so our old system
was getting confusing and inconsistent.

We used to have some special handling for adding wrappers to test
runs for emulation (e.g. wine, qemu). That logic has been moved
into TestTarget which now contains not just where to run the test
but also how.

Supported are armhf/aarch64 qemu as well as wine64.

The CLI has been updated to match and now uses the build-target
argument instead of arch.

The following combinations have been tested (though not all
combinations actually pass all tests, which is a separate issue).

./tools/run_tests
./tools/run_tests --target=host --build-target=x86_64-unknown-linux-gnu
./tools/run_tests --target=host --build-target=armhf
./tools/run_tests --target=host --build-target=aarch64
./tools/run_tests --target=host --build-target=mingw64
./tools/run_tests --target=vm:aarch64
./tools/run_tests --target=vm:aarch64 --build-target=armhf

BUG=b:233914170
TEST=See above

Change-Id: Ic6dbb5b39788e2573714606d3bb0e7c712032d91
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3739240
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-01 19:16:59 +00:00
Vaibhav Nagarnaik
235d76e9d2 tools/clippy: Allow json formatted output
This helps with integration of `tools/clippy` in `rust-analyzer` and
potentially other IDEs which can parse the json output better than the
text output.

TEST=Ran it with `rust-analyzer` in VSCode.

Change-Id: Iceb2748994cbbacf48dc473a9ad06eec567beb0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630700
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-05 22:22:53 +00:00
Noah Gold
35290a48c0 cros_async: enable tests on Windows.
BUG=b:213147081
TEST=bots

Change-Id: I88ac2eb0c4c9b4f3f77e2b3c0cc994979a14d14c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3585009
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-20 18:56:54 +00:00
Dennis Kempin
ba4adc0efb Add python presubmit checks
This change adds python type and formatting checks and
consolidates code health checks in ./tools/health-check.

Dealing with relative imports in python is tricky, so
we are making ./tools/impl a proper package with no
directly executable files.

Some of the bash shorthands in ./tools had to be converted
to python for this.

To make the new checks pass, we run the formatter and fix
some mypy type checks.

TEST=./tools/health-check
BUG=b:218559722,b:219965702

Change-Id: Ie18d3d6dd2f5a033141e167a6e1aa762791941d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3558592
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-15 19:22:53 +00:00
Anton Romanov
24a226169d Run some win64 tests with wine as part of presubmit
docker container size increases to ~4.7-8 Gb

TEST=./dev_container --hermetic ./tools/presubmit
BUG=none

Change-Id: I49dc03182f6ac5c29e0174618cc3864e073a2eb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3499264
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
2022-04-06 19:45:49 +00:00
Vikram Auradkar
de1f006a08 Enable clippy on windows
Also fixes few warning introduced during upstream which linux clippy
run does not catch.

test: py tools\clippy
bug: 226966790
Change-Id: I6979f87be5d6d34727afabafcaccb57631975567
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553401
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-03-31 16:09:00 +00:00
Dennis Kempin
27ecaad405 Pythonify clippy/fmt scripts and add common.py
We are replacing most of our bash tools with python versions so we
can support cross-platform development.

To facilitate writing shell-like scripts in Python, this CL adds
a common.py file to share common utilities. It curretly contains
tools to simplify shell-like command execution and argument parsing.

BUG=b:218559770
TEST=./tools/clippy && ./tools/fmt && ./tools/impl/common.py

Change-Id: I7f8b3523394973ed5c741b926fdc41e52133189f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3461240
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-15 22:01:58 +00:00
Dennis Kempin
5eb7743abd clippy: Fix cros_async
This is the last one. Just a few nits and we can now run clippy on all
crates.

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

Change-Id: I93ad9ce3b1cf0718bda8588279d7e1a891a0a6f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439052
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:44 +00:00
Dennis Kempin
04ccba5143 clippy: Fix net_sys / virtio_sys / x86_64
The bindings need to be regenerated. Just disable warnings for now.

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

Change-Id: Ia34638cbc20c4705631ea3693d4476137ebf8d55
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439051
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:43 +00:00
Dennis Kempin
f23f62c521 clippy: Fix libvda
Mostly issuses in bindings, which have just been suppressed.
The bindings will need to be regenerated in a separate CL.

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

Change-Id: I653e4903778087943456fb82fc2643fed0f86314
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439050
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:42 +00:00
Dennis Kempin
53fccea4e7 clippy: Fix kvm(_sys)
This adds a blanket allow to the top of the bindings file. The bindings
will need to be regenerated in a separate CL.

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

Change-Id: I6554d17fffde2089e29bf2e7c184b8cac937db6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439049
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:41 +00:00
Dennis Kempin
f881af3c1f clippy: fix devices crate
Fixes clippy failures and enables clippy checks on the crate.

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

Change-Id: I9022d40e997f94c03d3f936734116e3ea0505022
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3441348
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:39 +00:00
Dennis Kempin
7a543caa2e clippy: fix disk crate
Just a few nit fixes and we can now enable clippy for this crate.

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

Change-Id: Ia6ab90fa33e979066d9eeae2372630d93cf4026a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3441343
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-07 22:22:38 +00:00
Dennis Kempin
d9af9d6a58 clippy: Fix aarch64 and crosvm-fuzz
Add proper conditional compilation flags. This will largely still skip
most of those crates, but at least the syntax will be checked.

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

Change-Id: I66d29ccdfec01f3a83b682a9cc135188fdc830cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3438705
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-02-04 19:16:05 +00:00
Keiichi Watanabe
af095c0fe4 tools: clippy: Enable --all-features
BUG=none
TEST=./tools/clippy

Change-Id: Ibf673de1a76e529fc350999531d7a198a318be2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3295302
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2021-11-25 03:15:49 +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
Dennis Kempin
dc629f5f05 Clippy fixes in common/* crates
Some automatic fixes by clippy, some manual nit fixes.

This enables clippy on all but the cros_async crate, which
is to be replaced with cros_async2 soon.

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

Change-Id: I2b3a09b67ead64f2adb71dd4f94465b0d65a7c65
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3282678
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:08:55 +00:00
Dennis Kempin
3a6b7f11ce tools/clippy: Move allow-list to .cargo/config.toml
This applies the same clippy config to rust_analyzer
as well.

BUG=b:193893457
TEST=./tools/clippy and VSCode show the same linter results

Change-Id: I5deec4a24d71fec4692ed708664130f46c1311b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278773
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-11-12 20:55:25 +00:00
Dennis Kempin
10e79005c3 tools: Update clippy and fmt to make use of workspace
We have not been running clippy on many crates before. This CL
does not contain any clippy fixes, but documents how many issues
each disabled clippy check and crate currently has.

Many of them should be easy to fix.

BUG=b:192425184
TEST=./tools/presubmit --quick

Change-Id: I9ea25bc9a24d405700027ca4e72fb2a50e376c9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276668
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-11-11 23:52:43 +00:00
Dennis Kempin
65740a6842 Uprev to rust 1.55.0
Includes some fixes for new clippy checks. A rebuilt
dev_container that ships the new toolchain.

This allows us to get rid of the annoying cargo clean
before running clippy.

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

Change-Id: I9d486fbcf7b2d468f6a1375ac7df95091a2c1465
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3232277
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-10-19 19:12:52 +00:00
Dennis Kempin
ee56b2ddec Add presubmit script
Consolidates the utility scripts from bin/ into tools/.
Adds a 'presubmit' utility script to run a set of checks and
tests.

This won't be a git hook, but can be manually used to verify
changes before uploading.

BUG=b:199951064
TEST=./tools/presubmit --quick
./tools/dev_container ./tools/presubmit

Change-Id: Iac7c11fca0beaa6d4f214319149ef385fa5ced70
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3225139
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-10-18 20:10:41 +00:00