tests: Add virtio-fs testing

This commit introduces the testing of the --fs option based on the
virtio-fs implementation. This does not simply add a test, but also
updates the integration script by generating a new kernel embedding
the virtio-fs patches and by downloading the virtiofsd daemon.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-06-14 17:41:13 -07:00
committed by Samuel Ortiz
parent 53085c7ccc
commit 0fcca3ed74
3 changed files with 2709 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ if [ ! -f "$OS_IMAGE" ]; then
popd
fi
# Build generic kernel
VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux"
BZIMAGE_IMAGE="$WORKLOADS_DIR/bzImage"
@@ -44,6 +44,39 @@ if [ ! -f "$VMLINUX_IMAGE" ]; then
popd
fi
# Build custom kernel based on virtio-pmem and virtio-fs upstream patches
VMLINUX_CUSTOM_IMAGE="$WORKLOADS_DIR/vmlinux-custom"
LINUX_CUSTOM_DIR="linux-custom"
if [ ! -f "$VMLINUX_CUSTOM_IMAGE" ]; then
SRCDIR=$PWD
pushd $WORKLOADS_DIR
git clone --depth 1 "https://github.com/sboeuf/linux.git" -b "virtio-pmem_and_virtio-fs" $LINUX_CUSTOM_DIR
pushd $LINUX_CUSTOM_DIR
cp $SRCDIR/resources/linux-virtio-pmem-and-virtio-fs-config .config
make bzImage -j `nproc`
cp vmlinux $VMLINUX_CUSTOM_IMAGE
popd
rm -r $LINUX_CUSTOM_DIR
popd
fi
VIRTIOFSD_URL="$(curl --silent https://api.github.com/repos/intel/nemu/releases/latest | grep "browser_download_url" | grep "virtiofsd-x86_64" | grep -o 'https://.*[^ "]')"
VIRTIOFSD="$WORKLOADS_DIR/virtiofsd"
if [ ! -f "$VIRTIOFSD" ]; then
pushd $WORKLOADS_DIR
wget --quiet $VIRTIOFSD_URL -O "virtiofsd"
chmod +x "virtiofsd"
sudo setcap cap_sys_admin+epi "virtiofsd"
popd
fi
SHARED_DIR="$WORKLOADS_DIR/shared_dir"
if [ ! -d "$SHARED_DIR" ]; then
mkdir -p $SHARED_DIR
echo "foo" > "$SHARED_DIR/file1"
echo "bar" > "$SHARED_DIR/file3"
fi
rm /tmp/cloudinit.img
mkdosfs -n config-2 -C /tmp/cloudinit.img 8192
@@ -53,4 +86,4 @@ cargo build
sudo setcap cap_net_admin+ep target/debug/cloud-hypervisor
# Tests must be executed serially for now as they have a hardcoded IP address
cargo test --features "integration_tests" -- --test-threads=1
cargo test --features "integration_tests" -- --test-threads=1