QA: run /qa/check on a disk image too

This should catch bugs introduced in the disk image generation, in hjfs
and in ahci driver. Also, the checks are run with a single core virtual
machine so that some kind of bugs I might introduce in the scheduler
could break the build.
This commit is contained in:
Giacomo Tesio 2017-02-05 02:37:00 +01:00
parent ded9ac9fb9
commit 3c714125b0
3 changed files with 42 additions and 12 deletions

35
QA.sh
View File

@ -24,14 +24,6 @@ if [ "$(uname)" = "Linux" ] && [ -e /dev/kvm ]; then
fi
fi
if [ "$DISK" = "" ]; then
export DISK=$JEHANNE/hacking/sample-disk.img
fi
if [ -a $DISK ]; then
bootDisk="-device ahci,id=ahci -drive id=boot,file=$DISK,index=0,cache=writeback,if=none -device ide-drive,drive=boot,bus=ahci.0"
fi
if [ "$KERNDIR" = "" ]; then
KERNDIR=$JEHANNE/arch/$ARCH/kern/
fi
@ -41,10 +33,32 @@ fi
if [ "$NCPU" = "" ]; then
NCPU=1
fi
if [ "$CPU_MODEL" = "" ]; then
CPU_MODEL=Opteron_G1
fi
appendLine="nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0 $KAPPEND"
appendLine="-append '$appendLine'"
kernelLine="-kernel $KERNEL $*"
if [ "$DISK" = "" ]; then
if [ "$QA_DISK" != "" ]; then
# disk to run QA checks
export DISK=$QA_DISK
# will boot from disk, no need for kernel and so on
appendLine=""
kernelLine=""
else
export DISK=$JEHANNE/hacking/sample-disk.img
fi
fi
if [ -a $DISK ]; then
bootDisk="-device ahci,id=ahci -drive id=boot,file=$DISK,index=0,cache=writeback,if=none -device ide-drive,drive=boot,bus=ahci.0"
fi
cd $KERNDIR
read -r cmd <<EOF
$kvmdo qemu-system-x86_64 -s -cpu Opteron_G1 -smp $NCPU -m 2048 $kvmflag \
$kvmdo qemu-system-x86_64 -s -cpu $CPU_MODEL -smp $NCPU -m 2048 $kvmflag \
-serial stdio \
--nographic \
--monitor /dev/null \
@ -56,8 +70,7 @@ $bootDisk \
-redir tcp:9999::9 \
-redir tcp:17010::17010 \
-redir tcp:17013::17013 \
-append "nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0 $KAPPEND" \
-kernel $KERNEL $*
$appendLine $kernelLine
EOF
#-no-reboot -D $JEHANNE/../qemu.log -d int,cpu_reset,in_asm \

View File

@ -47,6 +47,15 @@ if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then
if [ "$QA_CHECKS" != "" ]; then
echo "Run QA checks"
echo /qa/check | NCPU=2 KERNEL=workhorse.32bit KERNDIR=$JEHANNE/hacking/bin/ runqemu
echo "Create disk image to run QA checks"
sed -i -e 's/menu.c32/FromAHCI/g' -e 's/nobootprompt/console=comconsole nobootprompt/g' $JEHANNE/hacking/disk-setup/syslinux.cfg
$JEHANNE/hacking/disk-create.sh
(cd $JEHANNE/hacking/; git checkout disk-setup/syslinux.cfg)
echo "Run QA checks in sample disk"
export QA_DISK=$JEHANNE/hacking/sample-disk.img
echo /qa/check | NCPU=1 runqemu -p 'jehanne#'
fi
echo "Move cross-compiling toolchain to $JEHANNE/tmp/toolchain for Travis caches"

View File

@ -62,6 +62,13 @@ EOF
export KERNEL=$JEHANNE/hacking/bin/workhorse.32bit
export KERNDIR=$JEHANNE/hacking/bin/
if [ "$DISK_KERNEL" = "" ]; then
export DISK_KERNEL=/arch/$ARCH/kern/jehanne.32bit
fi
if [ "$DISK_INITRD" = "" ]; then
export DISK_INITRD=/arch/amd64/kern/initrd
fi
# install everything
cat << EOF | runqemu
disk/fdisk -p /dev/sdE0/data >> /dev/sdE0/ctl
@ -69,7 +76,7 @@ disk/prep -w -a nvram -a fs /dev/sdE0/plan9
disk/prep -p /dev/sdE0/plan9 >> /dev/sdE0/ctl
cat /dev/sdE0/ctl
disk/format -d /dev/sdE0/dos /hacking/disk-setup/syslinux.cfg /hacking/disk-setup/bios/* /arch/amd64/kern/initrd /arch/amd64/kern/jehanne.32bit
disk/format -d /dev/sdE0/dos /hacking/disk-setup/syslinux.cfg /hacking/disk-setup/bios/* $DISK_INITRD $DISK_KERNEL
dd -if /hacking/nvram -of /dev/sdE0/nvram
@ -113,6 +120,7 @@ cd qa
dircp /root/qa .
cd /n/newfs
lc
$AFTER_DISK_FILL
unmount /n/newfs
echo df >> /srv/hjfs.cmd
echo sync >> /srv/hjfs.cmd