1#!/bin/bash 2# Copyright 2021 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5# 6# Simulates a Kokoro run executing one of the build-*.sh scripts. 7# e.g. ./ci/kokoro/simulate build-aarch64.sh 8# 9# For ease of use, just call: ./ci/kokoro/simulate_all 10 11crosvm_src=$(realpath $(dirname $0)/../../) 12kokoro_root=$(mktemp -d) 13kokoro_src="${kokoro_root}/src/git/crosvm" 14 15cleanup() { 16 rm -rf "${kokoro_root}" 17} 18 19main() { 20 echo "Copying ${crosvm_src}/ to ${kokoro_src}" 21 mkdir -p "${kokoro_src}" 22 rsync -arq --exclude "target" --exclude ".git" "${crosvm_src}/" "${kokoro_src}" 23 24 # Run user-provided kokoro build script. 25 export KOKORO_ARTIFACTS_DIR="${kokoro_root}/src" 26 echo "Running $1 in ${kokoro_root}" 27 bash $(dirname $0)/$1 28 echo "$1 returned $?" 29} 30 31trap cleanup EXIT 32main "$@" 33