crosvm/ci/crosvm_builder/entrypoint
Dennis Kempin 3f63661afc Run integration_tests by calling crosvm binary
Instead of instanciating crosvm directly, we can start the binary as
a sub-process.
This includes parsing of crosvm options in the tests, and makes the
test cases closer to real-world usage.

To make make this possible, we need to make sure that the crosvm binary
is uploaded to the VM before running the test, which is done by the
sync_so script, which is baked into the builder container.
We prevent future container re-builds for just maintaining the script,
I have removed them from the container, and call the scripts from the
local source directly.

The test runner is also updated to ensure all package binaries are
built (currently only tests are built).

BUG=b:182841358
TEST=./test_all passes

Change-Id: I7dfd21abcb2b90fe125eb43f85572fbf645b888a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2744280
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-03-19 20:35:53 +00:00

54 lines
1.4 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.
# Clean scratch directory if requested.
if [ "$1" = "--clean" ]; then
shift
echo "Cleaning scratch directory..."
rm -rf /workspace/scratch/*
fi
echo "Building ChromeOS dependencies..."
if ! make -j $(nproc) -C ci/build_environment \
>/workspace/logs/build_environment.log 2>&1; then
echo "Failed to build ChromeOS dependencies"
cat /workspace/logs/build_environment.log
# Drop into an interactive shell for debugging.
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_X86_64_UNKNOWN_LINUX_GNU_RUNNER="\
/workspace/src/platform/crosvm/ci/vm_tools/exec_binary_in_vm"
if [[ $# -eq 0 ]]; then
test_target="Virtual Machine (See 'screen -r vm' or 'ssh vm')"
else
test_target="Virtual Machine"
fi
export CROSVM_USE_VM=1
else
test_target="Native execution"
fi
echo ""
echo "crosvm builder is ready:"
echo " Cargo version: $(cargo --version)"
echo " Test target: ${test_target}"
echo ""
# Run user provided command or interactive shell
if [[ $# -eq 0 ]]; then
/bin/bash
else
echo "$ $@"
/bin/bash -c "$@"
fi