crosvm/ci/crosvm_builder/entrypoint

39 lines
999 B
Text
Raw Normal View History

#!/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 \
>/root/build_environment.log 2>&1; then
echo "Failed to build ChromeOS dependencies"
cat /root/build_environment.log
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/vm/exec_file"
test_target="Virtual Machine (See 'screen -r vm')"
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 "$ $@"
$@
fi