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