Makefile revision 1.5
1## Notes: 2## This set of tests creates a dummy directory tree in /tmp and 3## populates it with several files. The test requires around 1100 4## inodes and 6.8MB. The test system needs to run a kernel with 5## FFS Endian Independent support (options FFS_EI) to be able to 6## perform this test. 7## 8## This test verifies that newfs can create filesystems in both bytes 9## orders. For each byte order it is checked that: 10## - the kernel understands both filesystems created 11## - fsck_ffs can convert them from one byte order to the other 12## - dump handles properly the 'nodump' flag, an that restore can 13## properly restore the filesystem. 14## 15## This is derived from work done by Brian Grayson, submitted in PR 6706. 16 17.include <bsd.sys.mk> # for HOST_SH 18 19TMPL=/tmp/ffstemplate 20TMPMP=/tmp/ffsregresstest_mount 21TMPIM=/var/tmp/ffsregresstest.im 22TMPREST=/tmp/restoreregress 23EN?= be 24DIGITS=0 1 2 3 4 5 6 7 8 9 25 26VND?= vnd0 27BVND= /dev/${VND} 28CVND= /dev/r${VND} 29MPART?= a 30.if (${MACHINE_ARCH} == "i386") 31RPART?= d 32.else 33RPART?= c 34.endif 35 36# As make is called recusively, and we may cd to ${OBJDIR}, we need to call make 37# with some variables propagated. 38SRCDIR?= ${.CURDIR} 39MAKECMD= ${MAKE} -f ${SRCDIR}/Makefile SRCDIR=${SRCDIR} EN=${EN} VND=${VND} MPART=${MPART} RPART=${RPART} 40 41regress: template 42 ${MAKECMD} EN=be makeregress 43 ${MAKECMD} clean-tmpfs 44 ${MAKECMD} EN=le makeregress 45 ${MAKECMD} clean 46 47makeregress: tmpfs 48 ${MAKECMD} dump 49 ${MAKECMD} fsck 50 ${MAKECMD} clean-dump; 51 52clean: clean-tmpfs clean-template clean-dump 53clean-dump: 54 @echo "*** Cleaning up ${TMPREST}." 55 -rm -rf ${TMPREST} 56clean-tmpfs: 57 @echo "*** Cleaning up ${TMPMP}." 58 -umount ${TMPMP} 59 -vnconfig -u ${BVND}${RPART} 60 -rm -rf ${TMPMP} ${TMPIM} 61clean-template: 62 @echo "*** Cleaning up ${TMPL}." 63 -rm -rf ${TMPL} 64 65cmp: 66 diff -r -q ${TMPL} ${TMPMP} 67 68dump: 69 @echo "*** Testing dump nodump flag support." 70 @# First of all, estimate the size of a dump of just the tmpfs. 71 ${HOST_SH} ${SRCDIR}/estimatecompare 2572 -S -h9 -0 ${CVND}${MPART} 72 73 @# Now estimate the size, after honoring the nodump flag. 74 ${HOST_SH} ${SRCDIR}/estimatecompare 347 -S -h0 -0 ${CVND}${MPART} 75 @echo "*** Testing dump/restore support" 76 mkdir ${TMPREST} 77 dump -0 -h9 -B10000 -f - ${CVND}${MPART} | \ 78 (cd ${TMPREST}; restore -rf -) 79 @#restore should have created a restoresymtable file 80 rm ${TMPREST}/restoresymtable 81 diff -r -q ${TMPL} ${TMPREST} 82 83fsck: 84 @echo "*** checking fsck_ffs endian conversion." 85 umount ${BVND}${MPART} 86.if (${EN} == le) 87 fsck_ffs -B be -y ${CVND}${MPART} 88 mount -o async ${BVND}${MPART} ${TMPMP} 89 ${MAKECMD} cmp 90 umount ${BVND}${MPART} 91 fsck_ffs -B le -y ${CVND}${MPART} 92 mount -o async ${BVND}${MPART} ${TMPMP} 93 ${MAKECMD} cmp 94.else 95 fsck_ffs -B le -y ${CVND}${MPART} 96 mount -o async ${BVND}${MPART} ${TMPMP} 97 ${MAKECMD} cmp 98 umount ${BVND}${MPART} 99 fsck_ffs -B be -y ${CVND}${MPART} 100 mount -o async ${BVND}${MPART} ${TMPMP} 101 ${MAKECMD} cmp 102.endif 103 104tmpfs: 105 @echo "*** Creating a dummy directory tree at ${TMPMP} monted on" \ 106 "${TMPIM}, ${EN} byte order." 107 dd if=/dev/zero of=${TMPIM} count=5860 108 vnconfig -v ${BVND}${RPART} ${TMPIM} 109 disklabel -f ${SRCDIR}/disktab -rw ${VND} floppy288 110 newfs -B ${EN} -i 500 -b 8192 -f 1024 ${CVND}${MPART} 111 mkdir ${TMPMP} 112 mount -o async ${BVND}${MPART} ${TMPMP} 113 # Arg, cp will give an error if the symlink is copied before its target 114 -cp -Rp ${TMPL}/* ${TMPMP} 115 ${MAKECMD} cmp 116 117template: 118 mkdir ${TMPL} 119 @# Create a directory with a 10K file, with the file marked nodump. 120 mkdir ${TMPL}/nodumpfile 121 jot -r -c -s '' -n 10240 > ${TMPL}/nodumpfile/10k 122 chflags nodump ${TMPL}/nodumpfile/10k 123 @# And some ordinary 10k files. 124 mkdir ${TMPL}/dumpfile 125 TMPFS_DUMP=${TMPL}/dumpfile/dumpfile.10k; \ 126 for f in ${DIGITS}; do \ 127 jot -r -c -s '' -n 10240 > $$TMPFS_DUMP.$$f; done; 128 @# A subdir with a short and a long symbolic link in it 129 mkdir ${TMPL}/dumpfile/subdir 130 ln -s ../dumpfile.10k.0 ${TMPL}/dumpfile/subdir/link; 131 ln -s ../dumpfile.10k.1 ${TMPL}/dumpfile/subdir/really_really_really_really_really_really_long_name_to_use_up_space.link; 132 @# And now the same files, but in a dir marked nodump: 133 mkdir ${TMPL}/nodumpdir 134 chflags nodump ${TMPL}/nodumpdir 135 TMPFS_1=${TMPL}/nodumpdir/10k; \ 136 for f in ${DIGITS}; do \ 137 jot -r -c -s '' -n 10240 > $$TMPFS_1.$$f; \ 138 done 139 140 @# Also create a large directory that uses more than one direct block 141 @# (so it has to be larger than 8K). 142 @# Make sure one entry is for a deleted file, also. 143 mkdir ${TMPL}/2blkdir 144 TMPFS_1=${TMPL}/2blkdir; \ 145 jot -r -c -s '' -n 10 > $$TMPFS_1/10b; \ 146 for f in ${DIGITS}; do for g in ${DIGITS}; do \ 147 jot -r -c -s '' -n 10 > \ 148 $$TMPFS_1/really_really_really_really_really_really_long_name_to_use_up_space_$$f$$g ;\ 149 done; done; \ 150 rm $$TMPFS_1/10b 151 152 @# Now create a directory with at least one indirect block. 153 @# On a FS with 8K blocks, we need at least 1 + 12*8192 bytes, or 154 @# 98305 bytes, in the directory. 1000 files does the trick, 155 @# with the long filename below. 156 mkdir ${TMPL}/indirblk 157 chflags nodump ${TMPL}/indirblk 158 TMPFS_1=${TMPL}/indirblk; \ 159 jot -r -c -s '' -n 10 > $$TMPFS_1/10b; \ 160 for e in 0; do\ 161 for f in ${DIGITS}; do for g in ${DIGITS}; do for h in ${DIGITS}; do \ 162 jot -r -c -s '' -n 10 > \ 163 $$TMPFS_1/really_really_really_really_really_really_long_name_to_use_up_dir_entry_space$$e$$f$$g$$h ;\ 164 done; done; done; done; \ 165 rm $$TMPFS_1/10b 166 @# ^--- As before, make sure at least one direntry is a deleted file. 167