tests: minix, some corrections and cleanup

- move generic "check_minix_fs_type" tests to the top
 - add some todos/notes about potential issues
 - add "real" badblocks test (-l)
 - don't check sed's but fsck's return value
 - to see debian bug 773892 we would need "-f"
 - add some more hexdumps

CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2016-03-02 20:14:26 +01:00
parent 730f79fc3d
commit 84e324ae65
5 changed files with 56 additions and 14 deletions

View File

@ -27,7 +27,7 @@ Inode 1 not used, marked used in the bitmap.
----------------------------
FILE SYSTEM HAS BEEN CHANGED
----------------------------
0
fsck reports changed and uncorrected: 7
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400 10 00 00 00 00 00 01 00 01 00 05 00 00 00 00 00 |................|

View File

@ -0,0 +1,35 @@
32 inodes
16 blocks
Firstdatazone=5 (5)
Zonesize=1024
Maxsize=268966912
2 bad blocks
mkfs return value: 0
fsck return value: 0
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400 20 00 10 00 01 00 01 00 05 00 00 00 00 1c 08 10 | ...............|
00000410 8f 13 01 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000800 07 00 00 00 fe ff ff ff ff ff ff ff ff ff ff ff |................|
00000810 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00000c00 33 f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff |3...............|
00000c10 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00001000 ed 41 00 00 60 00 00 00 34 29 bd 55 00 02 05 00 |.A..`...4).U....|
00001010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001020 00 80 00 00 00 08 00 00 34 29 bd 55 00 01 08 00 |........4).U....|
00001030 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001400 01 00 2e 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001420 01 00 2e 2e 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00001440 02 00 2e 62 61 64 62 6c 6f 63 6b 73 00 00 00 00 |...badblocks....|
00001450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00004000

View File

@ -4,4 +4,4 @@ Read error: bad block in file '/'
Read error: bad block in file '/'
/: bad directory: '..' isn't second
Inode 1 not used, marked used in the bitmap.
4
fsck reports uncorrected: 4

View File

@ -1 +1 @@
0
fsck reports uncorrected: 4

View File

@ -19,6 +19,7 @@ TS_DESC="fsck images"
ts_init "$*"
# inode contains UID and GID, use always UID=0 to get the same checksum
# TODO any mkfs should use UID=0 per default (custom uid optionally) like mk2fs
ts_skip_nonroot
ts_check_test_command "$TS_CMD_FSCKMINIX"
@ -46,28 +47,34 @@ check_minix_fs_type 'v2c14' '-2 -n 14'
check_minix_fs_type 'v2c30' '-2 -n 30'
check_minix_fs_type 'v3c60' '-3 -n 60'
bad="$TS_OUTDIR/${TS_TESTNAME}.badlist"
# TODO seems that mkfs produces non-sense if badblocks are greater than device.
echo -e "8\n9" > $bad
# NOTE, -c with -l ignores -l.
check_minix_fs_type 'check-blocks' "-l $bad -c"
check_minix_fs_type 'badblocks' "-l $bad"
rm -f $bad
# NOTE this seems odd: a 2nd fsck run would again modify the FS
ts_init_subtest "auto-fix"
img=${TS_OUTPUT}.img
cp "$TS_SELF/broken-root" $img
"$TS_CMD_FSCKMINIX" -sav $img |
sed 's/Filesystem on .* is dirty/Filesystem auto-fix is dirty/' > $TS_OUTPUT 2>&1
echo $? >> $TS_OUTPUT
$TS_CMD_FSCKMINIX -sav $img >> $TS_OUTPUT 2>&1
echo "fsck reports changed and uncorrected: $?" >> $TS_OUTPUT
$TS_CMD_HEXDUMP -C $img >> $TS_OUTPUT 2>&1
sed -i 's/Filesystem on .* is dirty/Filesystem auto-fix is dirty/' $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "bug.773892"
"$TS_CMD_FSCKMINIX" "$TS_SELF/debian.bug.773892" > $TS_OUTPUT 2>&1
echo $? >> $TS_OUTPUT
"$TS_CMD_FSCKMINIX" -f "$TS_SELF/debian.bug.773892" >>$TS_OUTPUT 2>&1 >/dev/null
echo "fsck reports uncorrected: $?" >> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "broken-root"
"$TS_CMD_FSCKMINIX" "$TS_SELF/broken-root" > $TS_OUTPUT 2>&1
echo $? >> $TS_OUTPUT
echo "fsck reports uncorrected: $?" >> $TS_OUTPUT
ts_finalize_subtest
img="$TS_OUTDIR/${TS_TESTNAME}.badlist"
echo "42" > $img
check_minix_fs_type 'check-blocks' "-l $img -c"
rm -f $img
ts_finalize