crosvm/ci/vm_tools/exec_binary_in_vm
Junichi Uekawa 74b18b8ccb vm_tools: Use /var/tmp instead of /tmp.
/tmp is mounted as tmpfs, and tmpfs does not provide O_DIRECT capabilities. Try
using a ext4 file system.

BUG=b:190435784
TEST=time ./ci/builder --vm #    boot_test_vm_odirect passes

Change-Id: I3f8245052ed06c703cc3aa320d300d5f21254e90
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3083206
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2021-08-11 02:22:40 +00:00

30 lines
797 B
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.
#
# Uploads and executes a file in the VM. This script can be set as a runner
# for cargo to execute tests inside the VM.
${0%/*}/wait_for_vm_with_timeout || exit 1
vm_tmp_dir=/var/tmp
if [ "$1" = "--no-sync" ]; then
shift
else
echo "Syncing dependencies..."
${0%/*}/sync_deps || exit 1
fi
filepath=$1
filename=$(basename $filepath)
echo "Executing $filename ${@:2}"
scp -q $filepath vm:$vm_tmp_dir/$filename
ssh vm -q -t "cd $vm_tmp_dir && sudo ./$filename ${@:2}"
# Make sure to preserve the exit code of $filename after cleaning up the file.
ret=$?
ssh vm -q -t "rm $vm_tmp_dir/$filename"
exit $ret