Path: blob/main/e2e_tests/guest_under_test/upload_prebuilts.sh
5394 views
#!/bin/bash1# Copyright 2020 The ChromiumOS Authors2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.45# Builds and uploads prebuilts to cloud storage.6#7# Note: Only Googlers with access to the crosvm-testing cloud storage bin can8# upload prebuilts.9#10# See README.md for how to uprev the prebuilt version.1112set -e13cd "${0%/*}"1415readonly PREBUILT_VERSION="$(cat ./PREBUILT_VERSION)"16readonly GS_PREFIX="gs://crosvm/integration_tests/guest"1718function prebuilts_exist_error() {19echo "Prebuilts of version ${PREBUILT_VERSION} already exist. See README.md"20exit 121}2223function upload() {24local arch=$125local remote_bzimage="${GS_PREFIX}-bzimage-${arch}-${PREBUILT_VERSION}"26local remote_rootfs="${GS_PREFIX}-rootfs-${arch}-${PREBUILT_VERSION}"2728# Local files29local cargo_target=$(cargo metadata --no-deps --format-version 1 |30jq -r ".target_directory")31local local_bzimage=${cargo_target}/guest_under_test/${arch}/bzImage32local local_rootfs=${cargo_target}/guest_under_test/${arch}/rootfs3334echo "Checking if prebuilts already exist."35gsutil stat "${remote_bzimage}" && prebuilts_exist_error36gsutil stat "${remote_rootfs}" && prebuilts_exist_error3738echo "Building rootfs and kernel."39make ARCH=${arch} "${local_bzimage}" "${local_rootfs}"4041echo "Uploading files."42gsutil cp -n "${local_bzimage}" "${remote_bzimage}"43gsutil cp -n "${local_rootfs}" "${remote_rootfs}"44}4546upload x86_6447upload aarch64484950