#!/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 # # For ease of use, just call: ./ci/kokoro/simulate_all crosvm_src=$(realpath $(dirname $0)/../../) kokoro_root=$(mktemp -d) kokoro_src="${kokoro_root}/src/git/crosvm" cleanup() { rm -rf "${kokoro_root}" } main() { echo "Copying ${crosvm_src}/ to ${kokoro_src}" mkdir -p "${kokoro_src}" rsync -arq --exclude "target" --exclude ".git" "${crosvm_src}/" "${kokoro_src}" # Run user-provided kokoro build script. export KOKORO_ARTIFACTS_DIR="${kokoro_root}/src" echo "Running $1 in ${kokoro_root}" bash $(dirname $0)/$1 echo "$1 returned $?" } trap cleanup EXIT main "$@"