mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
This search/replace updates all copyright notices to drop the "All rights reserved", Use "ChromiumOS" instead of "Chromium OS" and drops the trailing dots. This fulfills the request from legal and unifies our notices. ./tools/health-check has been updated to only accept this style. BUG=b:246579983 TEST=./tools/health-check Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dennis Kempin <denniskempin@google.com>
87 lines
2.5 KiB
Bash
Executable file
87 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright 2022 The ChromiumOS Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Note: To simulate this locally, sudo needs to be passwordless for the duration of the build (~1h).
|
|
# This could be achieved by refreshing sudo in the background before running ci/simulate.py:
|
|
#
|
|
# while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
|
# ./ci/kokoro/simulate.py ./ci/kokoro/build-chromeos.sh
|
|
|
|
set -ex
|
|
|
|
source "$(dirname $0)/common.sh"
|
|
|
|
CROS_ROOT="${KOKORO_ARTIFACTS_DIR}/cros"
|
|
CROSVM_ROOT="${KOKORO_ARTIFACTS_DIR}/git/crosvm"
|
|
DEPOT_TOOLS="${KOKORO_ARTIFACTS_DIR}/depot_tools"
|
|
|
|
BOARD="amd64-generic"
|
|
# TODO: Add other packages tracking the crosvm repo.
|
|
PACKAGE_LIST=(
|
|
'chromeos-base/crosvm'
|
|
)
|
|
|
|
# Python script to check for at least version 3.9
|
|
VERSION_CHECK="
|
|
import sys
|
|
sys.exit(sys.version_info.major != 3 or sys.version_info.minor < 9)
|
|
"
|
|
|
|
setup_depot_tools() {
|
|
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git \
|
|
"$DEPOT_TOOLS"
|
|
export PATH="${DEPOT_TOOLS}:${PATH}"
|
|
}
|
|
|
|
setup_cros_source() {
|
|
repo init -q -u https://chromium.googlesource.com/chromiumos/manifest \
|
|
-b stable --depth=1 -c -g minilayout,crosvm
|
|
time repo sync -c # ~5min
|
|
time cros_sdk --create # ~16min
|
|
}
|
|
|
|
setup_crosvm_source() {
|
|
# Pull kokoro's version of crosvm into the cros monorepo
|
|
(
|
|
cd "${CROS_ROOT}/src/platform/crosvm" &&
|
|
git remote add crosvm "$CROSVM_ROOT" &&
|
|
git fetch crosvm &&
|
|
git checkout FETCH_HEAD
|
|
)
|
|
# Uprev ebuild files
|
|
local colon_separated_packages="$(printf '%s:' "${PACKAGE_LIST[@]}")"
|
|
./chromite/scripts/cros_uprev \
|
|
--package="$colon_separated_packages" \
|
|
--overlay-type=public
|
|
}
|
|
|
|
build_and_test_crosvm() {
|
|
# TODO: We currently build crosvm twice. Once with build_packages, once to run tests.
|
|
# ~20min
|
|
time cros_sdk build_packages --board "$BOARD" implicit-system "${PACKAGE_LIST[@]}"
|
|
# ~6min
|
|
time cros_sdk cros_run_unit_tests --board "$BOARD" --packages "${PACKAGE_LIST[@]}"
|
|
}
|
|
|
|
cleanup_cros() {
|
|
# Delete cros repo to prevent it from being treated as a build artifact by Kokoro.
|
|
cros_sdk --delete || true
|
|
sudo rm -rf "${CROS_ROOT}" || true
|
|
# Call original cleanup function from common.sh
|
|
cleanup
|
|
}
|
|
trap cleanup_cros EXIT
|
|
|
|
main() {
|
|
mkdir -p "$CROS_ROOT"
|
|
cd "$CROS_ROOT"
|
|
|
|
setup_depot_tools
|
|
setup_cros_source
|
|
setup_crosvm_source
|
|
build_and_test_crosvm
|
|
}
|
|
|
|
main
|