The goal is to enable anyone to simply run our current test suite.
Change-Id: I27d8856cb82a4be2baa5dc5273526383b7f4fc2c
_SUBDIR+= libexec sbin usr.bin
_SUBDIR+= commands man
_SUBDIR+= common drivers kernel servers
-_SUBDIR+= usr.sbin share rescue sys etc tests compat .WAIT distrib regress
+_SUBDIR+= usr.sbin share rescue sys etc test compat .WAIT distrib regress
.if defined(__MINIX)
_SUBDIR+= benchmarks
./usr/sbin/ti1225 minix-sys
./usr/sbin/vbox minix-sys
./usr/sbin/virtio_net minix-sys
+./usr/tests/minix-posix/mod minix-sys
+./usr/tests/minix-posix/test47 minix-sys
+./usr/tests/minix-posix/test51 minix-sys
+./usr/tests/minix-posix/test57 minix-sys
+./usr/tests/minix-posix/test62 minix-sys
+./usr/tests/minix-posix/test63 minix-sys
./usr/spool/mail minix-sys
./usr/spool minix-sys
./usr/src minix-sys
+./usr/tests minix-sys
+./usr/tests/minix-posix minix-sys
+./usr/tests/minix-posix/run minix-sys
+./usr/tests/minix-posix/t10a minix-sys
+./usr/tests/minix-posix/t11a minix-sys
+./usr/tests/minix-posix/t11b minix-sys
+./usr/tests/minix-posix/t40a minix-sys
+./usr/tests/minix-posix/t40b minix-sys
+./usr/tests/minix-posix/t40c minix-sys
+./usr/tests/minix-posix/t40d minix-sys
+./usr/tests/minix-posix/t40e minix-sys
+./usr/tests/minix-posix/t40f minix-sys
+./usr/tests/minix-posix/t60a minix-sys
+./usr/tests/minix-posix/t60b minix-sys
+./usr/tests/minix-posix/t67a minix-sys
+./usr/tests/minix-posix/t67b minix-sys
+./usr/tests/minix-posix/t68a minix-sys
+./usr/tests/minix-posix/t68b minix-sys
+./usr/tests/minix-posix/test1 minix-sys
+./usr/tests/minix-posix/test10 minix-sys
+./usr/tests/minix-posix/test11 minix-sys
+./usr/tests/minix-posix/test12 minix-sys
+./usr/tests/minix-posix/test13 minix-sys
+./usr/tests/minix-posix/test14 minix-sys
+./usr/tests/minix-posix/test15 minix-sys
+./usr/tests/minix-posix/test16 minix-sys
+./usr/tests/minix-posix/test17 minix-sys
+./usr/tests/minix-posix/test18 minix-sys
+./usr/tests/minix-posix/test19 minix-sys
+./usr/tests/minix-posix/test2 minix-sys
+./usr/tests/minix-posix/test20 minix-sys
+./usr/tests/minix-posix/test21 minix-sys
+./usr/tests/minix-posix/test22 minix-sys
+./usr/tests/minix-posix/test23 minix-sys
+./usr/tests/minix-posix/test24 minix-sys
+./usr/tests/minix-posix/test25 minix-sys
+./usr/tests/minix-posix/test26 minix-sys
+./usr/tests/minix-posix/test27 minix-sys
+./usr/tests/minix-posix/test28 minix-sys
+./usr/tests/minix-posix/test29 minix-sys
+./usr/tests/minix-posix/test3 minix-sys
+./usr/tests/minix-posix/test30 minix-sys
+./usr/tests/minix-posix/test31 minix-sys
+./usr/tests/minix-posix/test32 minix-sys
+./usr/tests/minix-posix/test33 minix-sys
+./usr/tests/minix-posix/test34 minix-sys
+./usr/tests/minix-posix/test35 minix-sys
+./usr/tests/minix-posix/test36 minix-sys
+./usr/tests/minix-posix/test37 minix-sys
+./usr/tests/minix-posix/test38 minix-sys
+./usr/tests/minix-posix/test39 minix-sys
+./usr/tests/minix-posix/test4 minix-sys
+./usr/tests/minix-posix/test40 minix-sys
+./usr/tests/minix-posix/test41 minix-sys
+./usr/tests/minix-posix/test42 minix-sys
+./usr/tests/minix-posix/test43 minix-sys
+./usr/tests/minix-posix/test44 minix-sys
+./usr/tests/minix-posix/test45 minix-sys
+./usr/tests/minix-posix/test46 minix-sys
+./usr/tests/minix-posix/test48 minix-sys
+./usr/tests/minix-posix/test49 minix-sys
+./usr/tests/minix-posix/test5 minix-sys
+./usr/tests/minix-posix/test50 minix-sys
+./usr/tests/minix-posix/test52 minix-sys
+./usr/tests/minix-posix/test53 minix-sys
+./usr/tests/minix-posix/test54 minix-sys
+./usr/tests/minix-posix/test55 minix-sys
+./usr/tests/minix-posix/test56 minix-sys
+./usr/tests/minix-posix/test58 minix-sys
+./usr/tests/minix-posix/test59 minix-sys
+./usr/tests/minix-posix/test6 minix-sys
+./usr/tests/minix-posix/test60 minix-sys
+./usr/tests/minix-posix/test61 minix-sys
+./usr/tests/minix-posix/test64 minix-sys
+./usr/tests/minix-posix/test65 minix-sys
+./usr/tests/minix-posix/test66 minix-sys
+./usr/tests/minix-posix/test67 minix-sys
+./usr/tests/minix-posix/test68 minix-sys
+./usr/tests/minix-posix/test7 minix-sys
+./usr/tests/minix-posix/test8 minix-sys
+./usr/tests/minix-posix/test9 minix-sys
+./usr/tests/minix-posix/testinterp minix-sys
+./usr/tests/minix-posix/testsh1 minix-sys
+./usr/tests/minix-posix/testsh2 minix-sys
./usr/tmp minix-sys
./usr/var/db minix-sys
./usr/var/db/pkg minix-sys
./usr/spool/lpd
./usr/spool/mail
./usr/src
+./usr/tests
+./usr/tests/minix-posix
./usr/var
./usr/var/db
./usr/var/db/pkg
set -e
if [ `id -u` -ne 0 ]
-then
- echo "This script should be running as root calling sudo"
+then echo "This script should be running as root calling sudo"
sudo $0
exit 1
fi
-MP_MINIX=/tmp/minix
-MP_BOOT=/tmp/minixboot
-
: ${ARCH=evbearm-el}
: ${OBJ=../obj.${ARCH}}
: ${CROSS_TOOLS=${OBJ}/"tooldir.`uname -s`-`uname -r`-`uname -m`"/bin}
: ${CROSS_PREFIX=${CROSS_TOOLS}/arm-elf32-minix-}
+: ${JOBS=-j4}
: ${DESTDIR=${OBJ}/destdir.$ARCH}
-: ${FSTAB=$DESTDIR/etc/fstab}
+: ${FSTAB=${DESTDIR}/etc/fstab}
+
+: ${MP_MINIX=/tmp/minix}
+: ${MP_BOOT=/tmp/minixboot}
+
: ${LOOP=/dev/loop0}
: ${EMPTYIMG=minix_arm_sd_empty.img}
: ${IMG=minix_arm_sd.img}
BUILDSH=build.sh
-if [ ! -f $BUILDSH ]
-then echo "Please invoke me from the root source dir, where $BUILDSH is."
+if [ ! -f ${BUILDSH} ]
+then echo "Please invoke me from the root source dir, where ${BUILDSH} is."
exit 1
fi
if [ ! -f ${EMPTYIMG}.bz2 ]
-then echo Retrieving $EMPTYIMG
+then echo Retrieving ${EMPTYIMG}
wget http://www.minix3.org/arm/${EMPTYIMG}.bz2
fi
if [ ! -f $IMG ]
-then echo decompressing $EMPTYIMG onto $IMG
+then echo decompressing ${EMPTYIMG} onto ${IMG}
bzip2 -d -k ${EMPTYIMG}.bz2
- mv $EMPTYIMG $IMG
+ mv ${EMPTYIMG} ${IMG}
fi
# remove fstab and generated pw db
-rm -rf $DESTDIR/etc
+rm -rf ${DESTDIR}/etc
-sh build.sh -j4 -m$ARCH -O $OBJ -D $DESTDIR -u distribution
+sh build.sh ${JOBS} -m ${ARCH} -O ${OBJ} -D ${DESTDIR} -u distribution
-cat >$FSTAB <<END_FSTAB
+cat >${FSTAB} <<END_FSTAB
/dev/c0d0p1s0 / mfs rw 0 1
/dev/c0d0p1s2 /usr mfs rw 0 2
/dev/c0d0p1s1 /home mfs rw 0 2
END_FSTAB
-rm -f $DESTDIR/SETS.*
+rm -f ${DESTDIR}/SETS.*
-${CROSS_TOOLS}/nbpwd_mkdb -V 0 -p -d $DESTDIR $DESTDIR/etc/master.passwd
+${CROSS_TOOLS}/nbpwd_mkdb -V 0 -p -d ${DESTDIR} ${DESTDIR}/etc/master.passwd
-set -x
+umount ${MP_MINIX}/home || true
+umount ${MP_MINIX}/usr || true
+umount ${MP_MINIX} || true
+umount ${MP_BOOT} || true
-umount $MP_MINIX/home || true
-umount $MP_MINIX/usr || true
-umount $MP_MINIX || true
-umount $MP_BOOT || true
+losetup -d ${LOOP} || true
-losetup -d $LOOP || true
-losetup $LOOP $IMG
+echo "Mounting disk image."
+losetup ${LOOP} $IMG
${CROSS_TOOLS}/nbmkfs.mfs ${LOOP}p5
${CROSS_TOOLS}/nbmkfs.mfs ${LOOP}p6
${CROSS_TOOLS}/nbmkfs.mfs ${LOOP}p7
-mkdir -p $MP_BOOT
-mount ${LOOP}p1 $MP_BOOT
+mkdir -p ${MP_BOOT}
+mount ${LOOP}p1 ${MP_BOOT}
mkdir -p ${MP_MINIX}
mount ${LOOP}p5 ${MP_MINIX}
mount ${LOOP}p6 ${MP_MINIX}/home
mount ${LOOP}p7 ${MP_MINIX}/usr
-cp releasetools/uEnv.txt releasetools/cmdline.txt $MP_BOOT
-#
+echo "Synchronizing filesystem with newly built binaries."
+rsync -a ${DESTDIR}/ ${MP_MINIX}/
+
+echo "Copying configuration and boot modules."
+cp releasetools/uEnv.txt releasetools/cmdline.txt ${MP_BOOT}
+
# also copy to the obj directory to allow tftp booting
# using obj dir as root
cp releasetools/uEnv.txt releasetools/cmdline.txt ${OBJ}
${CROSS_PREFIX}objcopy ${OBJ}/kernel/kernel -O binary ${OBJ}/kernel.bin
-cp ${OBJ}/kernel.bin $MP_BOOT
-
-set -x
-
-rsync -a $DESTDIR/ $MP_MINIX/
+cp ${OBJ}/kernel.bin ${MP_BOOT}
for f in vm rs pm sched vfs ds mfs pfs init
do
- cp ${OBJ}/servers/$f/$f ${OBJ}/$f.elf
- ${CROSS_PREFIX}strip -s ${OBJ}/$f.elf
- cp ${OBJ}/$f.elf $MP_BOOT
+ cp ${OBJ}/servers/${f}/${f} ${OBJ}/${f}.elf
+ ${CROSS_PREFIX}strip -s ${OBJ}/${f}.elf
+ cp ${OBJ}/${f}.elf ${MP_BOOT}
done
for f in tty memory log
do
- cp ${OBJ}/drivers/$f/$f ${OBJ}/$f.elf
- ${CROSS_PREFIX}strip -s ${OBJ}/$f.elf
- cp ${OBJ}/$f.elf $MP_BOOT
+ cp ${OBJ}/drivers/${f}/${f} ${OBJ}/${f}.elf
+ ${CROSS_PREFIX}strip -s ${OBJ}/${f}.elf
+ cp ${OBJ}/${f}.elf ${MP_BOOT}
done
# Unmount disk image
+echo "Unmounting disk image"
sync
-umount $MP_MINIX/home
-umount $MP_MINIX/usr
-umount $MP_MINIX
-umount $MP_BOOT
-losetup -d $LOOP
+umount ${MP_MINIX}/home
+umount ${MP_MINIX}/usr
+umount ${MP_MINIX}
+umount ${MP_BOOT}
+losetup -d ${LOOP}
-DBG=-O0 -g
-CFLAGS+= -Wall -Werror -fno-builtin
-LDADD+= -lm -lcompat_minix
+BINDIR?= /usr/tests/minix-posix
+WARNS?= 1
# Tests have no manpages
-MKMAN=no
+MKMAN= no
# They are all bin-owned; by default normal executable mode
-BINOWN=root
+BINOWN= bin
+
+CFLAGS+= -fno-builtin
+LDADD+= -lm -lcompat_minix
+
+.include <bsd.own.mk>
# Some have special flags compiling
-CFLAGS.test51=-mhard-float
-CFLAGS.test52=-mhard-float
+.if ${MACHINE_ARCH} == "i386"
+# LSC FIXME: Compilation error for now on ARM with that!
+COPTS.test51.c= -mhard-float
+COPTS.test52.c= -mhard-float
+.endif
+
+COPTS.test9.c= -O0
+COPTS.test37.c= -O0
+COPTS.test53.c= -O0
+COPTS.test68.c= -O0
# Some have special libraries
-LDADD.test59= -lmthread
-LDFLAGS.mod= -shared # make shared object
+LDADD.test59= -lmthread
+LDFLAGS.mod= -shared # make shared object
# Some have an extra file
-OBJS.test57=test57loop.o
+OBJS.test57= test57loop.o
-.for t in \
+# Tests to compile, For every architecture
+MINIX_TESTS= \
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
-41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
-61 62 64 65 66 67 68
-PROG+= test$(t)
+41 42 43 44 45 46 48 49 50 52 53 54 55 56 58 59 60 \
+61 64 65 66 67 68
+
+.if ${MACHINE_ARCH} == "i386"
+MINIX_TESTS+= \
+ 47 51 57 \
+ 62
+.endif # ${MACHINE_ARCH} == "i386"
+
+.if ${MACHINE_ARCH} == "earm"
+# LSC Not yet supported on ARM
+MKPIC:= no
+LDSTATIC:= -static
+.endif
+
+.for t in ${MINIX_TESTS}
+PROGS+= test${t}
.endfor
-PROG+= t10a t11a t11b t40a t40b t40c t40d t40e t40f t60a t60b \
+PROGS+= t10a t11a t11b t40a t40b t40c t40d t40e t40f t60a t60b \
t67a t67b t68a t68b
-.include <bsd.own.mk>
+SCRIPTS+= run testinterp.sh testsh1.sh testsh2.sh
-.if $(MKPIC) == "yes"
+.if ${MKPIC} == "yes"
# Build them as dynamic executables by default if shared libraries
# are available; so that the building and executing of dynamic
# executables is tested
# Add test that must be linked dynamically, and its dynamically loaded
# module
-PROG+= test63 mod
+PROGS+= test63 mod
.endif
-.include <bsd.prog.mk>
-
-# Some are suid-root
-all:
- chmod 4755 test11 test33 test43 test44 test46 test56 test60 test61 \
- test65
-
+# LSC Make sure there is not leftover after a failed testrun
clean: .PHONY .MAKE
$(MAKE) -C select clean
- rm -rf *.o *.s *.bak test? test?? t10a t11a t11b \
- t40a t40b t40c t40d t40e t40f \
- t60a t60b t67a t67b t68a t68b \
- DIR*
+ rm -rf DIR*
+
+.include <bsd.prog.mk>
total=`expr 0` # total number of tests tried
badones= # list of tests that failed
+# Tests which require setuid
+setuids="test11 test33 test43 test44 test46 test56 test60 test61 test65"
+
tests=" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
# Directory must be owned by bin
[ "$USER" != root ] || chown bin .
+# If root, make sure the setuid tests have the correct permissions
+[ "$USER" = root ] && chown root ${setuids}
+[ "$USER" = root ] && chmod 4755 ${setuids}
+
# Count tests
for i in `echo $tests`; do
if [ -x ./test$i ]; then