tests: add fast commit recovery tests

Add j_recover_fast_commit test that ensure that e2fsck is able to
recover a disk from fast commit log.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Harshad Shirwadkar 2021-01-21 21:45:04 -08:00 committed by Theodore Ts'o
parent f5de3d7c1b
commit 3e994cc5b8
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,4 @@
ls
ls a/
ex a/new
ex a/data

View File

@ -0,0 +1,22 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 14/256 files (14.3% non-contiguous), 1365/2048 blocks
Exit status is 0
debugfs: ls
2 (12) . 2 (12) .. 11 (20) lost+found 12 (968) a
debugfs: ls a/
12 (12) . 2 (12) .. 13 (12) data 14 (976) new
debugfs: ex a/new
Level Entries Logical Physical Length Flags
0/ 0 1/ 1 0 - 0 1107 - 1107 1
debugfs: ex a/data
Level Entries Logical Physical Length Flags
0/ 1 1/ 1 0 - 255 1618 256
1/ 1 1/ 5 0 - 15 1619 - 1634 16
1/ 1 2/ 5 16 - 31 1601 - 1616 16
1/ 1 3/ 5 32 - 63 1985 - 2016 32
1/ 1 4/ 5 64 - 127 1537 - 1600 64
1/ 1 5/ 5 128 - 255 1793 - 1920 128

Binary file not shown.

View File

@ -0,0 +1,26 @@
#!/bin/bash
FSCK_OPT=-fy
IMAGE=$test_dir/image.gz
CMDS=$test_dir/commands
gunzip < $IMAGE > $TMPFILE
# Run fsck to fix things?
EXP=$test_dir/expect
OUT=$test_name.log
cp $TMPFILE /tmp/debugthis
$FSCK $FSCK_OPT -E journal_only -N test_filesys $TMPFILE 2>/dev/null | head -n 1000 | tail -n +2 > $OUT
echo "Exit status is $?" >> $OUT
$DEBUGFS -f $CMDS $TMPFILE >> $OUT 2>/dev/null
# Figure out what happened
if cmp -s $EXP $OUT; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff -u $EXP $OUT >> $test_name.failed
fi