From: David Gibson <david@gibson.dropbear.id.au>
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 [thread overview]
Message-ID: <20220706072909.596805-7-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220706072909.596805-1-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 4491 bytes --]
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(a)gibson.dropbear.id.au>
---
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 <david(a)gibson.dropbear.id.au>
-DOWNLOAD_ASSETS =
-LOCAL_ASSETS =
+DOWNLOAD_ASSETS = mbuto
+LOCAL_ASSETS = mbuto.img
ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
assets: $(ASSETS)
+mbuto:
+ git clone git://mbuto.sh/mbuto
+
+mbuto.img: passt.mbuto mbuto
+ ./mbuto/mbuto -p ./$< -c lz4 -f $@
+
check: assets
./run
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 <sbrivio(a)redhat.com>
+INITRAMFS="${BASEPATH}/mbuto.img"
VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
__mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
VMEM="$((${__mem_kib} / 1024 / 4))"
@@ -24,21 +25,12 @@ setup_build() {
layout_host
}
-# setup_passt() - Build guest initrd with mbuto, start qemu and passt
+# setup_passt() - Start qemu and passt
setup_passt() {
MODE=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:
#
# guest | host
@@ -62,7 +54,7 @@ setup_passt() {
' -machine accel=kvm' \
' -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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
@@ -177,7 +169,7 @@ setup_passt_in_ns() {
' -M accel=kvm: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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
@@ -261,14 +253,11 @@ setup_two_guests() {
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
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)' \
' -M accel=kvm: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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
@@ -278,7 +267,7 @@ setup_two_guests() {
' -M accel=kvm: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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
--
@@ -13,6 +13,7 @@
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio(a)redhat.com>
+INITRAMFS="${BASEPATH}/mbuto.img"
VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
__mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
VMEM="$((${__mem_kib} / 1024 / 4))"
@@ -24,21 +25,12 @@ setup_build() {
layout_host
}
-# setup_passt() - Build guest initrd with mbuto, start qemu and passt
+# setup_passt() - Start qemu and passt
setup_passt() {
MODE=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:
#
# guest | host
@@ -62,7 +54,7 @@ setup_passt() {
' -machine accel=kvm' \
' -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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
@@ -177,7 +169,7 @@ setup_passt_in_ns() {
' -M accel=kvm: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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
@@ -261,14 +253,11 @@ setup_two_guests() {
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
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)' \
' -M accel=kvm: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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
@@ -278,7 +267,7 @@ setup_two_guests() {
' -M accel=kvm: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=ttyS0 mitigations=off apparmor=0 ' \
'virtio-net.napi_tx=1"' \
--
2.36.1
next prev parent reply other threads:[~2022-07-06 7:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-06 7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
2022-07-06 7:28 ` [PATCH 01/15] test: Add external mbuto profile, drop udhcpc, and switch to it David Gibson
2022-07-06 7:28 ` [PATCH 02/15] Handle the case of a DNS server on localhost David Gibson
2022-07-06 7:28 ` [PATCH 03/15] tests: qemu-system-ppc64le isn't a thing David Gibson
2022-07-06 7:28 ` [PATCH 04/15] Invoke specific qemu-system-* binaries David Gibson
2022-07-06 7:28 ` [PATCH 05/15] tests: Introduce makefile for building test assets David Gibson
2022-07-06 7:29 ` David Gibson [this message]
2022-07-06 7:29 ` [PATCH 07/15] tests: Search multiple places for aarch64 EDK2 bios image David Gibson
2022-07-06 7:29 ` [PATCH 08/15] Clean up passt.pid file David Gibson
2022-07-06 7:29 ` [PATCH 09/15] tests: Remove unused set_mode() function David Gibson
2022-07-06 7:29 ` [PATCH 10/15] tests: Remove not-very-useful "req" directive David Gibson
2022-07-06 7:29 ` [PATCH 11/15] tests: Don't automatically traverse directories of test files David Gibson
2022-07-06 7:29 ` [PATCH 12/15] tests: Explicitly list test files in test/run, remove "onlyfor" support David Gibson
2022-07-06 7:29 ` [PATCH 13/15] tests: Move distro image download to asset build makefile David Gibson
2022-07-06 7:29 ` [PATCH 14/15] tests: Prepare distro images during asset build phase David Gibson
2022-07-06 7:29 ` [PATCH 15/15] tests: Remove unused DNS6 calculation from fedora tests David Gibson
2022-07-07 14:53 ` [PATCH 00/15] Test fixes, batch 4 Stefano Brivio
2022-07-11 9:42 ` Stefano Brivio
2022-07-12 8:26 ` David Gibson
2022-07-12 12:13 ` Stefano Brivio
2022-07-13 2:11 ` David Gibson
2022-07-13 6:04 ` Stefano Brivio
2022-07-13 10:19 ` David Gibson
2022-07-13 23:39 ` Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220706072909.596805-7-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).