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# Synchronizes dependencies of crosvm into the virtual machine to allow test 7# binaries to execute. 8 9${0%/*}/wait_for_vm_with_timeout || exit 1 10 11crosvm_root="/workspace/src/platform/crosvm" 12rust_toolchain=$(cat ${crosvm_root}/rust-toolchain) 13target_dir=$( 14 cargo metadata --no-deps --format-version 1 | 15 jq -r ".target_directory" 16) 17 18# List of shared objects used by crosvm that need to be synced. 19shared_objects=( 20 /workspace/scratch/lib/*.so* 21 /root/.rustup/toolchains/${rust_toolchain}-*/lib/libstd-*.so 22 /root/.rustup/toolchains/${rust_toolchain}-*/lib/libtest-*.so 23) 24rsync -azPLq --rsync-path="sudo rsync" ${shared_objects[@]} vm:/usr/lib 25 26# Files needed by binaries at runtime in the working directory. 27if [ -z "${CARGO_BUILD_TARGET}" ]; then 28 runtime_files=( 29 "${target_dir}/debug/crosvm" 30 ) 31else 32 runtime_files=( 33 "${target_dir}/${CARGO_BUILD_TARGET}/debug/crosvm" 34 ) 35fi 36 37rsync -azPLq --rsync-path="sudo rsync" ${runtime_files} vm:/tmp 38