Commit graph

18 commits

Author SHA1 Message Date
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