From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: [PATCH 06/15] tests: Move mbuto download and execution to asset build Date: Wed, 06 Jul 2022 17:29:00 +1000 Message-ID: <20220706072909.596805-7-david@gibson.dropbear.id.au> In-Reply-To: <20220706072909.596805-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1411099421012538341==" --===============1411099421012538341== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 --- test/.gitignore | 2 ++ test/Makefile | 10 ++++++++-- test/lib/setup | 23 ++++++----------------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index edb2221..895c3ae 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,2 +1,4 @@ perf.js test_logs/ +mbuto/ +*.img diff --git a/test/Makefile b/test/Makefile index 02c60a3..b72280d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,13 +5,19 @@ # Copyright Red Hat # Author: David Gibson =20 -DOWNLOAD_ASSETS =3D -LOCAL_ASSETS =3D +DOWNLOAD_ASSETS =3D mbuto +LOCAL_ASSETS =3D mbuto.img =20 ASSETS =3D $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS) =20 assets: $(ASSETS) =20 +mbuto: + git clone git://mbuto.sh/mbuto + +mbuto.img: passt.mbuto mbuto + ./mbuto/mbuto -p ./$< -c lz4 -f $@ + check: assets ./run =20 diff --git a/test/lib/setup b/test/lib/setup index 97e603c..604cfee 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -13,6 +13,7 @@ # Copyright (c) 2021 Red Hat GmbH # Author: Stefano Brivio =20 +INITRAMFS=3D"${BASEPATH}/mbuto.img" VCPUS=3D"$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )" __mem_kib=3D"$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)" VMEM=3D"$((${__mem_kib} / 1024 / 4))" @@ -24,21 +25,12 @@ setup_build() { layout_host } =20 -# setup_passt() - Build guest initrd with mbuto, start qemu and passt +# setup_passt() - Start qemu and passt setup_passt() { MODE=3Dpasst =20 layout_passt =20 - __mbuto_dir=3D"$(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 mb= uto.img" - pane_status GUEST - - rm -rf "${__mbuto_dir}" - # Ports: # # guest | host @@ -62,7 +54,7 @@ setup_passt() { ' -machine accel=3Dkvm' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ - ' -initrd mbuto.img -nographic -serial stdio' \ + ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ ' -append "console=3DttyS0 mitigations=3Doff apparmor=3D0 ' \ 'virtio-net.napi_tx=3D1"' \ @@ -177,7 +169,7 @@ setup_passt_in_ns() { ' -M accel=3Dkvm:tcg' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ - ' -initrd mbuto.img -nographic -serial stdio' \ + ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ ' -append "console=3DttyS0 mitigations=3Doff apparmor=3D0 ' \ 'virtio-net.napi_tx=3D1"' \ @@ -261,14 +253,11 @@ setup_two_guests() { [ ${TRACE} -eq 1 ] && __opts=3D"${__opts} --trace" pane_run PASST_2 "./passt -f ${__opts} -t 10004 -u 10004" =20 - pane_run GUEST_2 'cp mbuto.img mbuto_2.img' - pane_status GUEST_2 - pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)' \ ' -M accel=3Dkvm:tcg' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ - ' -initrd mbuto.img -nographic -serial stdio' \ + ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ ' -append "console=3DttyS0 mitigations=3Doff apparmor=3D0 ' \ 'virtio-net.napi_tx=3D1"' \ @@ -278,7 +267,7 @@ setup_two_guests() { ' -M accel=3Dkvm:tcg' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ - ' -initrd mbuto_2.img -nographic -serial stdio' \ + ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ ' -append "console=3DttyS0 mitigations=3Doff apparmor=3D0 ' \ 'virtio-net.napi_tx=3D1"' \ --=20 2.36.1 --===============1411099421012538341==--