tests: Move mbuto download and execution to asset build
Move the download of mbuto and using it to create a sample initramfs to the asset build makefile, rather than embedding it in the test scripts themselves. The two_guests tests used to use two separate copies of the mbuto image. As an initramfs the mbuto image is strictly readonly though, so that's not necessary. So, also use the same image for both guests. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
db551e5de0
commit
2297637251
3 changed files with 16 additions and 19 deletions
2
test/.gitignore
vendored
2
test/.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
perf.js
|
perf.js
|
||||||
test_logs/
|
test_logs/
|
||||||
|
mbuto/
|
||||||
|
*.img
|
||||||
|
|
|
@ -5,13 +5,19 @@
|
||||||
# Copyright Red Hat
|
# Copyright Red Hat
|
||||||
# Author: David Gibson <david@gibson.dropbear.id.au>
|
# Author: David Gibson <david@gibson.dropbear.id.au>
|
||||||
|
|
||||||
DOWNLOAD_ASSETS =
|
DOWNLOAD_ASSETS = mbuto
|
||||||
LOCAL_ASSETS =
|
LOCAL_ASSETS = mbuto.img
|
||||||
|
|
||||||
ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
|
ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
|
||||||
|
|
||||||
assets: $(ASSETS)
|
assets: $(ASSETS)
|
||||||
|
|
||||||
|
mbuto:
|
||||||
|
git clone git://mbuto.sh/mbuto
|
||||||
|
|
||||||
|
mbuto.img: passt.mbuto mbuto
|
||||||
|
./mbuto/mbuto -p ./$< -c lz4 -f $@
|
||||||
|
|
||||||
check: assets
|
check: assets
|
||||||
./run
|
./run
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
# Copyright (c) 2021 Red Hat GmbH
|
# Copyright (c) 2021 Red Hat GmbH
|
||||||
# Author: Stefano Brivio <sbrivio@redhat.com>
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
||||||
|
|
||||||
|
INITRAMFS="${BASEPATH}/mbuto.img"
|
||||||
VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
|
VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
|
||||||
__mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
|
__mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
|
||||||
VMEM="$((${__mem_kib} / 1024 / 4))"
|
VMEM="$((${__mem_kib} / 1024 / 4))"
|
||||||
|
@ -24,21 +25,12 @@ setup_build() {
|
||||||
layout_host
|
layout_host
|
||||||
}
|
}
|
||||||
|
|
||||||
# setup_passt() - Build guest initrd with mbuto, start qemu and passt
|
# setup_passt() - Start qemu and passt
|
||||||
setup_passt() {
|
setup_passt() {
|
||||||
MODE=passt
|
MODE=passt
|
||||||
|
|
||||||
layout_passt
|
layout_passt
|
||||||
|
|
||||||
__mbuto_dir="$(mktemp -d)"
|
|
||||||
pane_run GUEST "git -C ${__mbuto_dir} clone git://mbuto.sh/mbuto"
|
|
||||||
pane_status GUEST
|
|
||||||
|
|
||||||
pane_run GUEST "${__mbuto_dir}/mbuto/mbuto -p test/passt.mbuto -c lz4 -f mbuto.img"
|
|
||||||
pane_status GUEST
|
|
||||||
|
|
||||||
rm -rf "${__mbuto_dir}"
|
|
||||||
|
|
||||||
# Ports:
|
# Ports:
|
||||||
#
|
#
|
||||||
# guest | host
|
# guest | host
|
||||||
|
@ -62,7 +54,7 @@ setup_passt() {
|
||||||
' -machine accel=kvm' \
|
' -machine accel=kvm' \
|
||||||
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
||||||
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
||||||
' -initrd mbuto.img -nographic -serial stdio' \
|
' -initrd '${INITRAMFS}' -nographic -serial stdio' \
|
||||||
' -nodefaults' \
|
' -nodefaults' \
|
||||||
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
||||||
'virtio-net.napi_tx=1"' \
|
'virtio-net.napi_tx=1"' \
|
||||||
|
@ -177,7 +169,7 @@ setup_passt_in_ns() {
|
||||||
' -M accel=kvm:tcg' \
|
' -M accel=kvm:tcg' \
|
||||||
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
||||||
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
||||||
' -initrd mbuto.img -nographic -serial stdio' \
|
' -initrd '${INITRAMFS}' -nographic -serial stdio' \
|
||||||
' -nodefaults' \
|
' -nodefaults' \
|
||||||
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
||||||
'virtio-net.napi_tx=1"' \
|
'virtio-net.napi_tx=1"' \
|
||||||
|
@ -261,14 +253,11 @@ setup_two_guests() {
|
||||||
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
|
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
|
||||||
pane_run PASST_2 "./passt -f ${__opts} -t 10004 -u 10004"
|
pane_run PASST_2 "./passt -f ${__opts} -t 10004 -u 10004"
|
||||||
|
|
||||||
pane_run GUEST_2 'cp mbuto.img mbuto_2.img'
|
|
||||||
pane_status GUEST_2
|
|
||||||
|
|
||||||
pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)' \
|
pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)' \
|
||||||
' -M accel=kvm:tcg' \
|
' -M accel=kvm:tcg' \
|
||||||
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
||||||
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
||||||
' -initrd mbuto.img -nographic -serial stdio' \
|
' -initrd '${INITRAMFS}' -nographic -serial stdio' \
|
||||||
' -nodefaults' \
|
' -nodefaults' \
|
||||||
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
||||||
'virtio-net.napi_tx=1"' \
|
'virtio-net.napi_tx=1"' \
|
||||||
|
@ -278,7 +267,7 @@ setup_two_guests() {
|
||||||
' -M accel=kvm:tcg' \
|
' -M accel=kvm:tcg' \
|
||||||
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
' -m '${VMEM}' -cpu host -smp '${VCPUS} \
|
||||||
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
' -kernel ' "/boot/vmlinuz-$(uname -r)" \
|
||||||
' -initrd mbuto_2.img -nographic -serial stdio' \
|
' -initrd '${INITRAMFS}' -nographic -serial stdio' \
|
||||||
' -nodefaults' \
|
' -nodefaults' \
|
||||||
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
' -append "console=ttyS0 mitigations=off apparmor=0 ' \
|
||||||
'virtio-net.napi_tx=1"' \
|
'virtio-net.napi_tx=1"' \
|
||||||
|
|
Loading…
Reference in a new issue