crosvm/ci/kokoro/simulate
Dennis Kempin 0dbb9808a6 Add Kokoro for ci/builders
Adds the crosvm-side infrastructure to build and test
in kokoro.
There is a build script for testing on x86, aarch64
and a separte script for analysis (clippy, fmt).
These will run in parallel on Kokoro. To test the
scripts locally, a simulate script is provided.

Runtime on my workstation:
- aarch64: 10m
- x86: 2:30m
- analysis: 1:40m

BUG=b:177951955
TEST=./ci/kokoro/simulate_all

Change-Id: I2f666ec768e6c3391a258dc7f0cbd999ad9b2fb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2654413
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2021-02-05 03:01:55 +00:00

33 lines
912 B
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.
#
# Simulates a Kokoro run executing one of the build-*.sh scripts.
# e.g. ./ci/kokoro/simulate build-aarch64.sh
kokoro_root=$(mktemp -d)
kokoro_src="${kokoro_root}/git/crosvm"
local_src=$(realpath $(dirname $0)/../../)
cleanup() {
echo "Unmounting ${kokoro_src}"
umount --lazy "${kokoro_src}" || true
rm -rf "${kokoro_root}"
}
main() {
# Bind mount source read-only to kokoro_src.
echo "Bind-mounting ${local_src} to ${kokoro_src}"
mkdir -p "${kokoro_src}"
bindfs "${local_src}" "${kokoro_src}" -p 0000,u=rxD
# Run user-provided kokoro build script.
export KOKORO_ARTIFACTS_DIR="${kokoro_root}"
echo "Running $1 in ${kokoro_root}"
bash $(dirname $0)/$1
echo "$1 returned $?"
}
trap cleanup EXIT
main "$@"