crosvm/kokoro/kokoro_simulator.sh
Zach Reizner f55812ac20 kokoro: build and run all crosvm unit tests in docker
TEST=run kokoro presubmit
BUG=b:73822503

Change-Id: Ica341fd8a064f4deb64fecbd4277ed6cc285ef2d
Reviewed-on: https://chromium-review.googlesource.com/1236888
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2018-09-22 01:43:12 -07:00

36 lines
989 B
Bash
Executable file

#!/bin/bash
# Copyright 2018 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 -ex
main() {
cd "$(dirname "$0")"
local kokoro_simulator_root=/tmp/kokoro_simulator
local src_root="${kokoro_simulator_root}"/git/crosvm
local base_image_tarball="${kokoro_simulator_root}"/crosvm-base.tar.xz
local base_image="crosvm-base"
mkdir -p "${kokoro_simulator_root}"
if [[ ! -e "${base_image_tarball}" ]]; then
if [[ "$(docker images -q ${base_image} 2> /dev/null)" == "" ]]; then
docker build -t ${base_image} - < Dockerfile
fi
docker save ${base_image} | xz -T 0 -z >"${base_image_tarball}"
fi
if [[ ! -e "${src_root}" ]]; then
mkdir -p "${kokoro_simulator_root}"/git
ln -s "$(realpath ../)" "${src_root}"
fi
export KOKORO_ARTIFACTS_DIR="${kokoro_simulator_root}"
export KOKORO_GFILE_DIR="${kokoro_simulator_root}"
./build.sh
}
main "$@"