mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
89ea04b4da
The updated presubmit script allows parallel execution of checks with --tmux. It will also try to detect if the host is set up for aarch64 builds and use the dev container if needed. BUG=None TEST=./tools/presubmit --tmux Change-Id: I0247c39d826ee38d5f7f689de5e63380fe789cf4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3292101 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
101 lines
2.2 KiB
Bash
Executable file
101 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright 2021 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
set -e
|
|
|
|
cd "$(dirname $0)/.."
|
|
|
|
HELP="This will run presubmit checks for crosvm.
|
|
|
|
To run all checks just run
|
|
|
|
$ ./tools/presubmit
|
|
|
|
The checks can be run in parallel for faster execution:
|
|
|
|
$ ./tools/presubmit --tmux
|
|
|
|
This will open a tmux session to run all presubmit builds in parallel. It will
|
|
create a nested tmux session if you are already using it.
|
|
|
|
All tests are executed in the local development environment. If your host is not
|
|
set up for aarch64 builds, it will use './tools/dev_container' to build run
|
|
those.
|
|
|
|
Aarch64 tests can be skipped with:
|
|
|
|
$ ./tools/presubmit --quick
|
|
"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
-q | --quick)
|
|
QUICK=true
|
|
shift
|
|
;;
|
|
--tmux)
|
|
RUN_IN_TMUX=true
|
|
shift
|
|
;;
|
|
-h | --help)
|
|
echo "$HELP"
|
|
exit 0
|
|
shift
|
|
;;
|
|
*)
|
|
echo "unknown argument $1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
run_commands_in_tmux() {
|
|
local tmux_commands=(
|
|
set-option -g default-shell /bin/bash \;
|
|
new-session "$1; read -p 'Press enter to close.'" \;
|
|
)
|
|
for cmd in "${@:2}"; do
|
|
tmux_commands+=(
|
|
split-window "$cmd; read -p 'Press enter to close.'" \;
|
|
)
|
|
done
|
|
tmux_commands+=(
|
|
select-layout even-horizontal \;
|
|
)
|
|
TMUX="" tmux "${tmux_commands[@]}"
|
|
}
|
|
|
|
run_commands() {
|
|
for cmd in "$@"; do
|
|
echo "$ ${cmd}"
|
|
bash -c "$cmd"
|
|
echo
|
|
done
|
|
}
|
|
|
|
aarch64_wrapper() {
|
|
if ! (rustup target list --installed | grep -q aarch64 &&
|
|
dpkg --print-foreign-architectures | grep -q arm64); then
|
|
echo "./tools/dev_container"
|
|
fi
|
|
}
|
|
|
|
commands=(
|
|
"./tools/fmt --check && ./tools/clippy"
|
|
"./tools/run_tests --target=host"
|
|
)
|
|
|
|
if [ "$QUICK" != true ]; then
|
|
commands+=(
|
|
"$(aarch64_wrapper) ./tools/run_tests --target=vm:aarch64"
|
|
)
|
|
fi
|
|
|
|
if [ "$RUN_IN_TMUX" = true ]; then
|
|
run_commands_in_tmux "${commands[@]}"
|
|
else
|
|
run_commands "${commands[@]}"
|
|
fi
|
|
|
|
# TODO(b/203152778): Add armhf builds to presubmit
|