mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2026-01-08 12:38:21 +00:00
Having all the workspace crates under the crates/ directory is unnecessary. Rust documentation itself recommends all crates to be in the root directory: https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html#creating-the-second-package-in-the-workspace I paste the text content here, in case the online page ever changes or becomes unavailable: ## Creating the Second Package in the Workspace Next, let’s create another member package in the workspace and call it add_one. Change the top-level Cargo.toml to specify the add_one path in the members list: Filename: Cargo.toml [workspace] members = [ "adder", "add_one", ] Then generate a new library crate named add_one: $ cargo new add_one --lib Created library `add_one` package Your add directory should now have these directories and files: ├── Cargo.lock ├── Cargo.toml ├── add_one │ ├── Cargo.toml │ └── src │ └── lib.rs ├── adder │ ├── Cargo.toml │ └── src │ └── main.rs └── target Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
61 lines
1.8 KiB
Bash
Executable File
61 lines
1.8 KiB
Bash
Executable File
#!/bin/bash -xe
|
|
|
|
cd $(dirname "$0")
|
|
|
|
libvirtd --daemon
|
|
virtlogd --daemon
|
|
export LIBGUESTFS_BACKEND=direct
|
|
|
|
mkdir -p test-data/
|
|
pushd test-data
|
|
IMAGE=Fedora-Cloud-Base-38-1.6.x86_64.qcow2
|
|
test -e "$IMAGE" || wget --quiet "https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/x86_64/images/$IMAGE" -O "$IMAGE"
|
|
qemu-img create -f qcow2 -F qcow2 -b "$PWD/$IMAGE" fedora-overlay.qcow2
|
|
|
|
test -e test-key-id_rsa || ssh-keygen -N "" -f test-key-id_rsa
|
|
|
|
virt-sysprep -a fedora-overlay.qcow2 \
|
|
--ssh-inject root:file:test-key-id_rsa.pub
|
|
|
|
fallocate -l 5GiB big-image.img
|
|
popd
|
|
|
|
SSH_OPTS="-i test-data/test-key-id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o User=root -o Port=2222"
|
|
|
|
vhost-device-scsi --socket-path /tmp/vhost-user-scsi.sock test-data/big-image.img &
|
|
|
|
sleep 1
|
|
|
|
qemu-system-x86_64 \
|
|
-enable-kvm -cpu host \
|
|
-device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02\
|
|
-netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 \
|
|
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
|
|
-hda test-data/fedora-overlay.qcow2 \
|
|
-object memory-backend-memfd,id=mem,size=8192M,share=on \
|
|
-numa node,memdev=mem \
|
|
-device vhost-user-scsi-pci,num_queues=1,param_change=off,chardev=vus \
|
|
-chardev socket,id=vus,path=/tmp/vhost-user-scsi.sock \
|
|
-smp 4 -m 8192 \
|
|
-serial mon:stdio \
|
|
-display none &
|
|
|
|
|
|
while ! ssh $SSH_OPTS localhost echo waiting for guest to come online
|
|
do
|
|
sleep 1
|
|
done
|
|
|
|
|
|
scp $SSH_OPTS test-script.sh localhost:~/
|
|
ssh $SSH_OPTS localhost /root/test-script.sh || echo "tests failed"
|
|
|
|
export RESULT_DIR="$PWD/results/$(date --rfc-3339=s)"
|
|
mkdir -p "$RESULT_DIR"
|
|
|
|
scp $SSH_OPTS -r localhost:/root/blktests/results/ "$RESULT_DIR/"
|
|
ssh $SSH_OPTS localhost poweroff
|
|
|
|
wait # wait for qemu to terminate
|
|
|