mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-11 12:35:26 +00:00
aa0717443e
The VM allows both the x86 and aarch64 builders to run tests which require access to kernel devices that docker would prevent us from accessing. The VM is automatically started in the endpoint script, and the environment is set up to execute `cargo test` binaries inside the VM. This allows for convenient interactive usage. The VM is also integrated into the run_tests scripts, executing tests that do not require special privileges first, while the VM is still booting up, then execuing the remaining tests in the VM. BUG=b:177228167,b:177951276 TEST=These test calls pass: ./ci/builder --vm ./run_tests ./ci/aarch64_builder --vm ./run_tests ./run_tests Change-Id: I20bf2cd848e944d411b97f1f8356279e312d8583 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2642766 Tested-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
45 lines
1.2 KiB
Bash
Executable file
45 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright 2021 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.
|
|
|
|
echo "Building ChromeOS dependencies..."
|
|
if ! make -j $(nproc) -C ci/build_environment TARGET_ARCH=aarch64 \
|
|
>/root/build_environment.log 2>&1; then
|
|
echo "Failed to build ChromeOS dependencies"
|
|
cat /root/build_environment.log
|
|
if [[ $# -eq 0 ]]; then
|
|
/bin/bash
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$1" = "--vm" ]; then
|
|
shift
|
|
echo "Starting testing vm..."
|
|
(cd /workspace/vm && screen -Sdm vm ./start_vm)
|
|
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="\
|
|
/workspace/vm/exec_file"
|
|
test_target="Virtual Machine (See 'screen -r vm')"
|
|
export CROSVM_USE_VM=1
|
|
else
|
|
test_target="User-space emulation"
|
|
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="\
|
|
qemu-${target_arch}-static \
|
|
-E LD_LIBRARY_PATH=/workspace/scratch/lib"
|
|
fi
|
|
|
|
echo ""
|
|
echo "crosvm builder is ready:"
|
|
echo " Cargo version: $(cargo --version)"
|
|
echo " Target architecture: ${CARGO_BUILD_TARGET}"
|
|
echo " Test target: ${test_target}"
|
|
echo ""
|
|
|
|
# Run user provided command or interactive shell
|
|
if [[ $# -eq 0 ]]; then
|
|
/bin/bash
|
|
else
|
|
echo "$ $@"
|
|
$@
|
|
fi
|