Makefile revision 1.5
11.1Sbouyer## Notes: 21.1Sbouyer## This set of tests creates a dummy directory tree in /tmp and 31.1Sbouyer## populates it with several files. The test requires around 1100 41.3Stron## inodes and 6.8MB. The test system needs to run a kernel with 51.3Stron## FFS Endian Independent support (options FFS_EI) to be able to 61.3Stron## perform this test. 71.1Sbouyer## 81.1Sbouyer## This test verifies that newfs can create filesystems in both bytes 91.1Sbouyer## orders. For each byte order it is checked that: 101.1Sbouyer## - the kernel understands both filesystems created 111.1Sbouyer## - fsck_ffs can convert them from one byte order to the other 121.1Sbouyer## - dump handles properly the 'nodump' flag, an that restore can 131.1Sbouyer## properly restore the filesystem. 141.1Sbouyer## 151.2Sbouyer## This is derived from work done by Brian Grayson, submitted in PR 6706. 161.1Sbouyer 171.5Slukem.include <bsd.sys.mk> # for HOST_SH 181.5Slukem 191.1SbouyerTMPL=/tmp/ffstemplate 201.1SbouyerTMPMP=/tmp/ffsregresstest_mount 211.1SbouyerTMPIM=/var/tmp/ffsregresstest.im 221.1SbouyerTMPREST=/tmp/restoreregress 231.1SbouyerEN?= be 241.1SbouyerDIGITS=0 1 2 3 4 5 6 7 8 9 251.1Sbouyer 261.1SbouyerVND?= vnd0 271.1SbouyerBVND= /dev/${VND} 281.1SbouyerCVND= /dev/r${VND} 291.1SbouyerMPART?= a 301.1Sbouyer.if (${MACHINE_ARCH} == "i386") 311.1SbouyerRPART?= d 321.1Sbouyer.else 331.1SbouyerRPART?= c 341.1Sbouyer.endif 351.1Sbouyer 361.1Sbouyer# As make is called recusively, and we may cd to ${OBJDIR}, we need to call make 371.1Sbouyer# with some variables propagated. 381.1SbouyerSRCDIR?= ${.CURDIR} 391.1SbouyerMAKECMD= ${MAKE} -f ${SRCDIR}/Makefile SRCDIR=${SRCDIR} EN=${EN} VND=${VND} MPART=${MPART} RPART=${RPART} 401.1Sbouyer 411.1Sbouyerregress: template 421.1Sbouyer ${MAKECMD} EN=be makeregress 431.1Sbouyer ${MAKECMD} clean-tmpfs 441.1Sbouyer ${MAKECMD} EN=le makeregress 451.1Sbouyer ${MAKECMD} clean 461.1Sbouyer 471.1Sbouyermakeregress: tmpfs 481.1Sbouyer ${MAKECMD} dump 491.1Sbouyer ${MAKECMD} fsck 501.1Sbouyer ${MAKECMD} clean-dump; 511.1Sbouyer 521.1Sbouyerclean: clean-tmpfs clean-template clean-dump 531.1Sbouyerclean-dump: 541.1Sbouyer @echo "*** Cleaning up ${TMPREST}." 551.1Sbouyer -rm -rf ${TMPREST} 561.1Sbouyerclean-tmpfs: 571.1Sbouyer @echo "*** Cleaning up ${TMPMP}." 581.1Sbouyer -umount ${TMPMP} 591.1Sbouyer -vnconfig -u ${BVND}${RPART} 601.1Sbouyer -rm -rf ${TMPMP} ${TMPIM} 611.1Sbouyerclean-template: 621.1Sbouyer @echo "*** Cleaning up ${TMPL}." 631.1Sbouyer -rm -rf ${TMPL} 641.1Sbouyer 651.1Sbouyercmp: 661.1Sbouyer diff -r -q ${TMPL} ${TMPMP} 671.1Sbouyer 681.1Sbouyerdump: 691.1Sbouyer @echo "*** Testing dump nodump flag support." 701.1Sbouyer @# First of all, estimate the size of a dump of just the tmpfs. 711.5Slukem ${HOST_SH} ${SRCDIR}/estimatecompare 2572 -S -h9 -0 ${CVND}${MPART} 721.1Sbouyer 731.1Sbouyer @# Now estimate the size, after honoring the nodump flag. 741.5Slukem ${HOST_SH} ${SRCDIR}/estimatecompare 347 -S -h0 -0 ${CVND}${MPART} 751.1Sbouyer @echo "*** Testing dump/restore support" 761.1Sbouyer mkdir ${TMPREST} 771.1Sbouyer dump -0 -h9 -B10000 -f - ${CVND}${MPART} | \ 781.1Sbouyer (cd ${TMPREST}; restore -rf -) 791.1Sbouyer @#restore should have created a restoresymtable file 801.1Sbouyer rm ${TMPREST}/restoresymtable 811.1Sbouyer diff -r -q ${TMPL} ${TMPREST} 821.1Sbouyer 831.1Sbouyerfsck: 841.1Sbouyer @echo "*** checking fsck_ffs endian conversion." 851.1Sbouyer umount ${BVND}${MPART} 861.1Sbouyer.if (${EN} == le) 871.1Sbouyer fsck_ffs -B be -y ${CVND}${MPART} 881.1Sbouyer mount -o async ${BVND}${MPART} ${TMPMP} 891.1Sbouyer ${MAKECMD} cmp 901.1Sbouyer umount ${BVND}${MPART} 911.1Sbouyer fsck_ffs -B le -y ${CVND}${MPART} 921.1Sbouyer mount -o async ${BVND}${MPART} ${TMPMP} 931.1Sbouyer ${MAKECMD} cmp 941.1Sbouyer.else 951.1Sbouyer fsck_ffs -B le -y ${CVND}${MPART} 961.1Sbouyer mount -o async ${BVND}${MPART} ${TMPMP} 971.1Sbouyer ${MAKECMD} cmp 981.1Sbouyer umount ${BVND}${MPART} 991.1Sbouyer fsck_ffs -B be -y ${CVND}${MPART} 1001.1Sbouyer mount -o async ${BVND}${MPART} ${TMPMP} 1011.1Sbouyer ${MAKECMD} cmp 1021.1Sbouyer.endif 1031.1Sbouyer 1041.1Sbouyertmpfs: 1051.1Sbouyer @echo "*** Creating a dummy directory tree at ${TMPMP} monted on" \ 1061.1Sbouyer "${TMPIM}, ${EN} byte order." 1071.1Sbouyer dd if=/dev/zero of=${TMPIM} count=5860 1081.1Sbouyer vnconfig -v ${BVND}${RPART} ${TMPIM} 1091.4Stron disklabel -f ${SRCDIR}/disktab -rw ${VND} floppy288 1101.1Sbouyer newfs -B ${EN} -i 500 -b 8192 -f 1024 ${CVND}${MPART} 1111.1Sbouyer mkdir ${TMPMP} 1121.1Sbouyer mount -o async ${BVND}${MPART} ${TMPMP} 1131.1Sbouyer # Arg, cp will give an error if the symlink is copied before its target 1141.1Sbouyer -cp -Rp ${TMPL}/* ${TMPMP} 1151.1Sbouyer ${MAKECMD} cmp 1161.1Sbouyer 1171.1Sbouyertemplate: 1181.1Sbouyer mkdir ${TMPL} 1191.1Sbouyer @# Create a directory with a 10K file, with the file marked nodump. 1201.1Sbouyer mkdir ${TMPL}/nodumpfile 1211.1Sbouyer jot -r -c -s '' -n 10240 > ${TMPL}/nodumpfile/10k 1221.1Sbouyer chflags nodump ${TMPL}/nodumpfile/10k 1231.1Sbouyer @# And some ordinary 10k files. 1241.1Sbouyer mkdir ${TMPL}/dumpfile 1251.1Sbouyer TMPFS_DUMP=${TMPL}/dumpfile/dumpfile.10k; \ 1261.1Sbouyer for f in ${DIGITS}; do \ 1271.1Sbouyer jot -r -c -s '' -n 10240 > $$TMPFS_DUMP.$$f; done; 1281.1Sbouyer @# A subdir with a short and a long symbolic link in it 1291.1Sbouyer mkdir ${TMPL}/dumpfile/subdir 1301.1Sbouyer ln -s ../dumpfile.10k.0 ${TMPL}/dumpfile/subdir/link; 1311.1Sbouyer ln -s ../dumpfile.10k.1 ${TMPL}/dumpfile/subdir/really_really_really_really_really_really_long_name_to_use_up_space.link; 1321.1Sbouyer @# And now the same files, but in a dir marked nodump: 1331.1Sbouyer mkdir ${TMPL}/nodumpdir 1341.1Sbouyer chflags nodump ${TMPL}/nodumpdir 1351.1Sbouyer TMPFS_1=${TMPL}/nodumpdir/10k; \ 1361.1Sbouyer for f in ${DIGITS}; do \ 1371.1Sbouyer jot -r -c -s '' -n 10240 > $$TMPFS_1.$$f; \ 1381.1Sbouyer done 1391.1Sbouyer 1401.1Sbouyer @# Also create a large directory that uses more than one direct block 1411.1Sbouyer @# (so it has to be larger than 8K). 1421.1Sbouyer @# Make sure one entry is for a deleted file, also. 1431.1Sbouyer mkdir ${TMPL}/2blkdir 1441.1Sbouyer TMPFS_1=${TMPL}/2blkdir; \ 1451.1Sbouyer jot -r -c -s '' -n 10 > $$TMPFS_1/10b; \ 1461.1Sbouyer for f in ${DIGITS}; do for g in ${DIGITS}; do \ 1471.1Sbouyer jot -r -c -s '' -n 10 > \ 1481.1Sbouyer $$TMPFS_1/really_really_really_really_really_really_long_name_to_use_up_space_$$f$$g ;\ 1491.1Sbouyer done; done; \ 1501.1Sbouyer rm $$TMPFS_1/10b 1511.1Sbouyer 1521.1Sbouyer @# Now create a directory with at least one indirect block. 1531.1Sbouyer @# On a FS with 8K blocks, we need at least 1 + 12*8192 bytes, or 1541.1Sbouyer @# 98305 bytes, in the directory. 1000 files does the trick, 1551.1Sbouyer @# with the long filename below. 1561.1Sbouyer mkdir ${TMPL}/indirblk 1571.1Sbouyer chflags nodump ${TMPL}/indirblk 1581.1Sbouyer TMPFS_1=${TMPL}/indirblk; \ 1591.1Sbouyer jot -r -c -s '' -n 10 > $$TMPFS_1/10b; \ 1601.1Sbouyer for e in 0; do\ 1611.1Sbouyer for f in ${DIGITS}; do for g in ${DIGITS}; do for h in ${DIGITS}; do \ 1621.1Sbouyer jot -r -c -s '' -n 10 > \ 1631.1Sbouyer $$TMPFS_1/really_really_really_really_really_really_long_name_to_use_up_dir_entry_space$$e$$f$$g$$h ;\ 1641.1Sbouyer done; done; done; done; \ 1651.1Sbouyer rm $$TMPFS_1/10b 1661.1Sbouyer @# ^--- As before, make sure at least one direntry is a deleted file. 167