debugfs load/dump test
-mke2fs -Fq -b 1024 ./test.img 512
+mke2fs -Fq -b 1024 test.img 512
Exit status is 0
-debugfs -R ''write test.data test_data'' -w ./test.img
+debugfs -R ''write test.data test_data'' -w test.img
Allocated inode: 12
Exit status is 0
e2fsck -yf -N test_filesys
Pass 5: Checking group summary information
test_filesys: 12/64 files (0.0% non-contiguous), 158/512 blocks
Exit status is 0
-debugfs -R ''dump test_data test.verify'' ./test.img
+debugfs -R ''dump test_data test.verify'' test.img
Exit status is 0
cmp test.data test.verify
Exit status is 0
dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
-echo "mke2fs -Fq -b 1024 $TMPFILE 512" >> $OUT
+echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT
$MKE2FS -Fq $TMPFILE 512 > /dev/null 2>&1
status=$?
dd if=$TEST_BITS of=$TEST_DATA bs=128k count=1 conv=sync > /dev/null 2>&1
echo "file fragment odd size" >> $TEST_DATA
-echo "debugfs -R ''write $TEST_DATA test_data'' -w $TMPFILE" > $OUT.new
+echo "debugfs -R ''write $TEST_DATA test_data'' -w test.img" > $OUT.new
$DEBUGFS -R "write $TEST_DATA test_data" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
-echo "debugfs -R ''dump test_data $VERIFY_DATA'' $TMPFILE" > $OUT.new
+echo "debugfs -R ''dump test_data $VERIFY_DATA'' test.img" > $OUT.new
$DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
-../e2fsck/e2fsck: The ext2 superblock is corrupt while trying to open ./test.img
+../e2fsck/e2fsck: The ext2 superblock is corrupt while trying to open test.img
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
Exit status is 0
-----------------------------------------------
-debugfs -R ''set_inode_field <7> block[2] 42'' -w ./test.img
+debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img
Exit status is 0
Resize inode not valid. Recreate? yes
Exit status is 0
-----------------------------------------------
-debugfs -R ''clri <7>'' -w ./test.img
+debugfs -R ''clri <7>'' -w test.img
Exit status is 0
Resize inode not valid. Recreate? yes
Exit status is 0
-----------------------------------------------
-debugfs -R ''set_inode_field <7> bmap[524] 57'' -w ./test.img
+debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img
Exit status is 0
Resize inode not valid. Recreate? yes
Exit status is 0
-----------------------------------------------
-debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w ./test.img
+debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img
Exit status is 0
../e2fsck/e2fsck: Group descriptors look bad... trying backup blocks...
Pass 1: Checking inodes, blocks, and sizes
Exit status is 1
-----------------------------------------------
-debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w ./test.img
+debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img
Exit status is 0
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
echo ----------------------------------------------- >> $OUT
echo " " >> $OUT
-echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w $TMPFILE" > $OUT.new
+echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img" > $OUT.new
$DEBUGFS -R "set_inode_field <7> block[2] 42" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
echo ----------------------------------------------- >> $OUT
echo " " >> $OUT
-echo "debugfs -R ''clri <7>'' -w $TMPFILE" > $OUT.new
+echo "debugfs -R ''clri <7>'' -w test.img" > $OUT.new
$DEBUGFS -R "clri <7>" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
echo ----------------------------------------------- >> $OUT
echo " " >> $OUT
-echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w $TMPFILE" > $OUT.new
+echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img" > $OUT.new
$DEBUGFS -R "set_inode_field <7> bmap[524] 57" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
echo ----------------------------------------------- >> $OUT
echo " " >> $OUT
-echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w $TMPFILE" > $OUT.new
+echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img" > $OUT.new
$DEBUGFS -R "set_super_value reserved_gdt_blocks 15679" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
echo ----------------------------------------------- >> $OUT
echo " " >> $OUT
-echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w $TMPFILE" > $OUT.new
+echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img" > $OUT.new
$DEBUGFS -R "set_super_value reserved_gdt_blocks 32" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
+++ /dev/null
-./test.img: Cannot create filesystem with requested number of inodes while setting up superblock
-./test.img: Attempt to read block from filesystem resulted in short read while opening filesystem
-features: Filesystem not open
-
-../e2fsck/e2fsck: Attempt to read block from filesystem resulted in short read while trying to open ./test.img
-Could this be a zero-length partition?
-Exit status is 8
-
-../misc/dumpe2fs: Attempt to read block from filesystem resulted in short read while trying to open ./test.img
-Couldn't find valid filesystem superblock.
-DESCRIPTION="test bg overhead calculation"
+echo -n "test bg overhead calculation: "
+
+OUT=$test_name.log
+EXP=$test_dir/expect
FS_SIZE=1024
MKE2FS_OPTS="-b 1024 -m 0 -g 256 -N 3745"
-. $cmd_dir/run_mke2fs
+MKE2FS_SKIP_PROGRESS=true
+MKE2FS_SKIP_CHECK_MSG=true
+export MKE2FS_SKIP_PROGRESS MKE2FS_SKIP_CHECK_MSG
+> $TMPFILE
+
+cp /dev/null $OUT
+
+$MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d | \
+ sed -e "s;$TMPFILE;test.img;" | tr -d \\015 > $OUT
+
+rm -f $TMPFILE
+
+rm -f $test_name.ok $test_name.failed
+cmp -s $OUT $EXP
+status1=$?
+
+if [ "$status1" = 0 ] ; then
+ echo "ok"
+ touch $test_name.ok
+else
+ echo "failed"
+ diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+fi
+rm -f tmp_expect
+
+unset OUT EXP DESCRIPTION FS_SIZE MKE2FS_OPTS MKE2FS_SKIP_PROGRESS
resize2fs test
-debugfs -R ''stat file'' ./test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''
+debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''
Inode: 1550 Type: regular Mode: 0644 Flags: 0x0
Extended attributes stored in inode body:
name = "propervalue" (11)
Exit status is 0
-resize2fs ./test.img 5M
-Resizing the filesystem on ./test.img to 5120 (1k) blocks.
-The filesystem on ./test.img is now 5120 blocks long.
+resize2fs test.img 5M
+Resizing the filesystem on test.img to 5120 (1k) blocks.
+The filesystem on test.img is now 5120 blocks long.
Exit status is 0
-debugfs -R ''stat file'' ./test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''
+debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''
Inode: 12 Type: regular Mode: 0644 Flags: 0x0
Extended attributes stored in inode body:
name = "propervalue" (11)
echo "resize2fs test" > $OUT
# Look at existing inline extended attribute
-echo "debugfs -R ''stat file'' $TMPFILE 2>&1 | grep ''^Inode\|in inode body\|name = ''" >> $OUT
+echo "debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''" >> $OUT
$DEBUGFS -R "stat file" $TMPFILE 2>&1 | grep "^Inode\|in inode body\|name = " >> $OUT
status=$?
echo Exit status is $status >> $OUT
# resize it
-echo "resize2fs $TMPFILE 5M" >> $OUT
+echo "resize2fs test.img 5M" >> $OUT
$RESIZE2FS $TMPFILE 5M 2>&1 >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -e '1d' $OUT.new >> $OUT
+sed -e '1d' $OUT.new | sed -e "s;$TMPFILE;test.img;" >> $OUT
# Look at inline extended attribute in resized fs
-echo "debugfs -R ''stat file'' $TMPFILE 2>&1 | grep ''^Inode\|in inode body\|name = ''" >> $OUT
+echo "debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''" >> $OUT
$DEBUGFS -R "stat file" $TMPFILE 2>&1 | grep "^Inode\|in inode body\|name = " >> $OUT
status=$?
echo Exit status is $status >> $OUT
mke2fs -q -F -o Linux -b 1024 -g 256 test.img 1024
resize2fs -p test.img 10000
-Resizing the filesystem on ./test.img to 10000 (1k) blocks.
+Resizing the filesystem on test.img to 10000 (1k) blocks.
Begin pass 1 (max = 35)
Extending the inode table ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on ./test.img is now 9985 blocks long.
+The filesystem on test.img is now 9985 blocks long.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Free inodes: 1217-1248
--------------------------------
resize2fs -p test.img 20000
-Resizing the filesystem on ./test.img to 20000 (1k) blocks.
+Resizing the filesystem on test.img to 20000 (1k) blocks.
Begin pass 1 (max = 39)
Extending the inode table ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on ./test.img is now 19969 blocks long.
+The filesystem on test.img is now 19969 blocks long.
Filesystem did not have a UUID; generating one.
Free inodes: 2465-2496
--------------------------------
resize2fs -p test.img 30000
-Resizing the filesystem on ./test.img to 30000 (1k) blocks.
+Resizing the filesystem on test.img to 30000 (1k) blocks.
Begin pass 1 (max = 39)
Extending the inode table ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on ./test.img is now 29953 blocks long.
+The filesystem on test.img is now 29953 blocks long.
Filesystem did not have a UUID; generating one.
Free inodes: 3713-3744
--------------------------------
resize2fs -p test.img 40000
-Resizing the filesystem on ./test.img to 40000 (1k) blocks.
+Resizing the filesystem on test.img to 40000 (1k) blocks.
Begin pass 1 (max = 40)
Extending the inode table ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on ./test.img is now 40000 blocks long.
+The filesystem on test.img is now 40000 blocks long.
Filesystem did not have a UUID; generating one.
grep -v "whichever comes first" >> $OUT
echo resize2fs -p test.img 10000 >> $OUT
-$RESIZE2FS -p $TMPFILE 10000 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS -p $TMPFILE 10000 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo "--------------------------------" >> $OUT
echo resize2fs -p test.img 20000 >> $OUT
-$RESIZE2FS -p $TMPFILE 20000 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS -p $TMPFILE 20000 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo "--------------------------------" >> $OUT
echo resize2fs -p test.img 30000 >> $OUT
-$RESIZE2FS -p $TMPFILE 30000 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS -p $TMPFILE 30000 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo "--------------------------------" >> $OUT
echo resize2fs -p test.img 40000 >> $OUT
-$RESIZE2FS -p $TMPFILE 40000 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS -p $TMPFILE 40000 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384
resize2fs test.img 65536
-Resizing the filesystem on ./test.img to 65536 (1k) blocks.
-The filesystem on ./test.img is now 65536 blocks long.
+Resizing the filesystem on test.img to 65536 (1k) blocks.
+The filesystem on test.img is now 65536 blocks long.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
--------------------------------
mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 65536
resize2fs test.img 16384
-Resizing the filesystem on ./test.img to 16384 (1k) blocks.
-The filesystem on ./test.img is now 16384 blocks long.
+Resizing the filesystem on test.img to 16384 (1k) blocks.
+The filesystem on test.img is now 16384 blocks long.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Free inodes: 3841-4096
--------------------------------
resize2fs test.img 165536
-Resizing the filesystem on ./test.img to 165536 (1k) blocks.
-The filesystem on ./test.img is now 165536 blocks long.
+Resizing the filesystem on test.img to 165536 (1k) blocks.
+The filesystem on test.img is now 165536 blocks long.
Filesystem did not have a UUID; generating one.
grep -v "whichever comes first" >> $OUT
echo resize2fs test.img 65536 >> $OUT
-$RESIZE2FS $TMPFILE 65536 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS $TMPFILE 65536 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
grep -v "whichever comes first" >> $OUT
echo resize2fs test.img 16384 >> $OUT
-$RESIZE2FS $TMPFILE 16384 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS $TMPFILE 16384 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
echo "--------------------------------" >> $OUT
echo resize2fs test.img 165536 >> $OUT
-$RESIZE2FS $TMPFILE 165536 2>&1 | sed -e '1d' >> $OUT
+$RESIZE2FS $TMPFILE 165536 2>&1 | sed -e '1d' | \
+ sed -e "s;$TMPFILE;test.img;" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
status=$?
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1
status=$?
echo Exit status is $status >> $OUT1.new
-sed -e '1d' $OUT1.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT1
+sed -e '1d' $OUT1.new | sed -e '/^JFS DEBUG:/d' | \
+ sed -e "s;$TMPFILE;test.img;" | tr -d \\015 >> $OUT1
rm -f $OUT1.new
if [ "$ONE_PASS_ONLY" != "true" ]; then
$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
status=$?
echo Exit status is $status >> $OUT2.new
- sed -e '1d' $OUT2.new | sed -e '/^JFS DEBUG:/d' > $OUT2
+ sed -e '1d' $OUT2.new | sed -e '/^JFS DEBUG:/d' | \
+ sed -e "s;$TMPFILE;test.img;" > $OUT2
rm -f $OUT2.new
fi
TEST_ICOUNT=../tests/progs/test_icount
LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
DYLD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
-TMPFILE=./test.img
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
TZ=GMT0
. $TEST_CONFIG
+TMPFILE=$(mktemp)
+
for test_dir in $TESTS
do
test_name=`echo $test_dir | sed -e 's;.*/;;'`
printf "e2undo with mke2fs: "
if test -x $E2UNDO_EXE; then
-E2FSPROGS_UNDO_DIR=./
+E2FSPROGS_UNDO_DIR=/tmp
export E2FSPROGS_UNDO_DIR
-TDB_FILE=./mke2fs-test.img.e2undo
+TDB_FILE=$E2FSPROGS_UNDO_DIR/mke2fs-$(basename $TMPFILE).e2undo
OUT=$test_name.log
rm -f $TDB_FILE >/dev/null 2>&1
printf "e2undo with tune2fs: "
if test -x $E2UNDO_EXE; then
-E2FSPROGS_UNDO_DIR=./
+E2FSPROGS_UNDO_DIR=/tmp
export E2FSPROGS_UNDO_DIR
-TDB_FILE=./tune2fs-test.img.e2undo
+TDB_FILE=$E2FSPROGS_UNDO_DIR/tune2fs-$(basename $TMPFILE).e2undo
OUT=$test_name.log
rm -f $TDB_FILE >/dev/null 2>&1