aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>2021-01-21 21:45:04 -0800
committerTheodore Ts'o <tytso@mit.edu>2021-01-27 20:12:33 -0500
commit3e994cc5b85e0021221fb3a8779bd08f9360b450 (patch)
treeb3fcef1b820d324b2e68d4c63a0a3bd9d90a1fea
parentf5de3d7c1b645a3368cd37fcdcc17d3cf2692f7c (diff)
downloade2fsprogs-3e994cc5b85e0021221fb3a8779bd08f9360b450.tar.gz
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>
-rw-r--r--tests/j_recover_fast_commit/commands4
-rw-r--r--tests/j_recover_fast_commit/expect22
-rw-r--r--tests/j_recover_fast_commit/image.gzbin0 -> 3595 bytes
-rwxr-xr-xtests/j_recover_fast_commit/script26
4 files changed, 52 insertions, 0 deletions
diff --git a/tests/j_recover_fast_commit/commands b/tests/j_recover_fast_commit/commands
new file mode 100644
index 000000000..74e20e4ef
--- /dev/null
+++ b/tests/j_recover_fast_commit/commands
@@ -0,0 +1,4 @@
+ls
+ls a/
+ex a/new
+ex a/data
diff --git a/tests/j_recover_fast_commit/expect b/tests/j_recover_fast_commit/expect
new file mode 100644
index 000000000..18e2fe06e
--- /dev/null
+++ b/tests/j_recover_fast_commit/expect
@@ -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
diff --git a/tests/j_recover_fast_commit/image.gz b/tests/j_recover_fast_commit/image.gz
new file mode 100644
index 000000000..b7357afc4
--- /dev/null
+++ b/tests/j_recover_fast_commit/image.gz
Binary files differ
diff --git a/tests/j_recover_fast_commit/script b/tests/j_recover_fast_commit/script
new file mode 100755
index 000000000..22ef63259
--- /dev/null
+++ b/tests/j_recover_fast_commit/script
@@ -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