git: eaf5ec88c2df - main - stand: Add testing for i386 as well to full-test.sh

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 25 Jan 2023 15:07:31 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=eaf5ec88c2df8efe49ce819c81aae582935c2e4c

commit eaf5ec88c2df8efe49ce819c81aae582935c2e4c
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-01-25 15:02:08 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-25 15:04:59 +0000

    stand: Add testing for i386 as well to full-test.sh
    
    Sponsored by:           Netflix
---
 tools/boot/full-test.sh | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/tools/boot/full-test.sh b/tools/boot/full-test.sh
index 6f45d6bfe20f..11f575779b92 100644
--- a/tools/boot/full-test.sh
+++ b/tools/boot/full-test.sh
@@ -279,7 +279,7 @@ make_linuxboot_images()
 	zfs=${IMAGES}/${ma_combo}/linuxboot-${ma_combo}.zfs
 	img=${IMAGES}/${ma_combo}/linuxboot-${ma_combo}.img
 	img2=${IMAGES}/${ma_combo}/linuxboot-${ma_combo}-zfs.img
-	pool="linuxboot-testing"
+	pool="linuxboot"
 	mkdir -p ${IMAGES}/${ma_combo}
 	makefs -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
 	       -o volume_label=EFISYS -s100m ${esp} ${src}
@@ -444,7 +444,6 @@ make_freebsd_images()
 	ufs=${IMAGES}/${ma_combo}/freebsd-${ma_combo}.ufs
 	img=${IMAGES}/${ma_combo}/freebsd-${ma_combo}.img
 	mkdir -p ${IMAGES}/${ma_combo}
-# XXX 4096 sector?
 	makefs -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
 	       -o volume_label=EFISYS -s100m ${esp} ${src}
 	makefs -t ffs -B little -s 200m -o label=root ${ufs} ${dir} ${dir2}
@@ -454,6 +453,30 @@ make_freebsd_images()
 
     set -x
 
+    # BIOS i386
+    a=i386:i386
+    m=${a%%:*}
+    ma=${a##*:}
+    ma_combo="${m}"
+    [ "${m}" != "${ma}" ] && ma_combo="${m}-${ma}"
+    dir=${TREES}/${ma_combo}/freebsd
+    dir2=${TREES}/${ma_combo}/test-stand
+    ufs=${IMAGES}/${ma_combo}/freebsd-${ma_combo}.ufs
+    img=${IMAGES}/${ma_combo}/freebsd-${ma_combo}.img
+    mkdir -p ${IMAGES}/${ma_combo}
+    mkdir -p ${dir2}/etc
+    cat > ${dir2}/etc/fstab <<EOF
+/dev/ufs/root	/		ufs	rw	1	1
+EOF
+    makefs -t ffs -B little -s 200m \
+	   -o label=root,version=2,bsize=32768,fsize=4096,density=16384 \
+	   ${ufs} ${dir} ${dir2}
+    mkimg -s gpt -b ${dir2}/boot/pmbr \
+	  -p freebsd-boot:=${dir2}/boot/gptboot \
+	  -p freebsd-ufs:=${ufs} \
+	  -o ${img}
+    rm -f ${src}/etc/fstab
+
     # PowerPC for 32-bit mac
     a=powerpc:powerpc
     m=${a%%:*}
@@ -557,6 +580,24 @@ ${qemu_bin}/qemu-system-ppc -m 1g -M mac99,via=pmu \\
         -monitor telnet::4444,server,nowait \\
         -serial stdio \$*
 EOF
+
+    set -x
+    a=i386:i386
+    m=${a%%:*}
+    ma=${a##*:}
+    ma_combo="${m}"
+    [ "${m}" != "${ma}" ] && ma_combo="${m}-${ma}"
+    img=${IMAGES}/${ma_combo}/freebsd-${ma_combo}.img
+    out=${SCRIPTS}/${ma_combo}/freebsd-test.sh
+    mkdir -p ${SCRIPTS}/${ma_combo}
+    cat > ${out} <<EOF
+${qemu_bin}/qemu-system-i386 -m 1g \\
+	-vga none -nographic \\
+	-drive file=${img},format=raw \\
+	-nographic \\
+        -monitor telnet::4444,server,nowait \\
+        -serial stdio \$*
+EOF
 }
 
 # The smallest FAT32 filesystem is 33292 KB