aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Whitney <enwlinux@gmail.com>2017-06-23 17:28:12 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-23 17:28:12 -0400
commit1dc09bd9c1fdd63cfb1840a96f15e7ba13e1b40b (patch)
tree0f3d46ce80d9a7bddb4a920903eb254f3c536903 /tests
parentfff2d1273f45b161096fd9942dd637a691ca6158 (diff)
downloade2fsprogs-1dc09bd9c1fdd63cfb1840a96f15e7ba13e1b40b.tar.gz
tests: add new test f_del_dup_quota
Add a test to validate the changes in commit b0f5fa880c36: "e2fsck: fix multiply-claimed block quota accounting when deleting files". Signed-off-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tests')
-rw-r--r--tests/f_del_dup_quota/expect.139
-rw-r--r--tests/f_del_dup_quota/expect.27
-rw-r--r--tests/f_del_dup_quota/image.bz2bin0 -> 1472 bytes
-rw-r--r--tests/f_del_dup_quota/name1
-rw-r--r--tests/f_del_dup_quota/script34
5 files changed, 81 insertions, 0 deletions
diff --git a/tests/f_del_dup_quota/expect.1 b/tests/f_del_dup_quota/expect.1
new file mode 100644
index 000000000..71b7440cb
--- /dev/null
+++ b/tests/f_del_dup_quota/expect.1
@@ -0,0 +1,39 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Running additional passes to resolve blocks claimed by more than one inode...
+Pass 1B: Rescanning for multiply-claimed blocks
+Multiply-claimed block(s) in inode 12: 8129
+Multiply-claimed block(s) in inode 13: 8129
+Pass 1C: Scanning directories for inodes with multiply-claimed blocks
+Pass 1D: Reconciling multiply-claimed blocks
+(There are 2 inodes containing multiply-claimed blocks.)
+
+File /testfile1 (inode #12, mod time Wed May 24 23:10:38 2017)
+ has 1 multiply-claimed block(s), shared with 1 file(s):
+ /testfile2 (inode #13, mod time Wed May 24 23:10:45 2017)
+Clone multiply-claimed blocks<y>? no
+Delete file<y>? yes
+File /testfile2 (inode #13, mod time Wed May 24 23:10:45 2017)
+ has 1 multiply-claimed block(s), shared with 1 file(s):
+ /testfile1 (inode #12, mod time Wed May 24 23:10:38 2017)
+Multiply-claimed blocks already reassigned or cloned.
+
+Pass 2: Checking directory structure
+Entry 'testfile1' in / (2) has deleted/unused inode 12. Clear<y>? yes
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Block bitmap differences: -1374
+Fix<y>? yes
+Free blocks count wrong for group #0 (6815, counted=6816).
+Fix<y>? yes
+Free blocks count wrong (6815, counted=6816).
+Fix<y>? yes
+[QUOTA WARNING] Usage inconsistent for ID 0:actual (15360, 3) != expected (17408, 4)
+Update quota info for quota type 0<y>? yes
+[QUOTA WARNING] Usage inconsistent for ID 0:actual (15360, 3) != expected (17408, 4)
+Update quota info for quota type 1<y>? yes
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/2048 files (33.3% non-contiguous), 1376/8192 blocks
+Exit status is 0
diff --git a/tests/f_del_dup_quota/expect.2 b/tests/f_del_dup_quota/expect.2
new file mode 100644
index 000000000..14f99b8e2
--- /dev/null
+++ b/tests/f_del_dup_quota/expect.2
@@ -0,0 +1,7 @@
+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: 12/2048 files (25.0% non-contiguous), 1376/8192 blocks
+Exit status is 0
diff --git a/tests/f_del_dup_quota/image.bz2 b/tests/f_del_dup_quota/image.bz2
new file mode 100644
index 000000000..fc91e2a18
--- /dev/null
+++ b/tests/f_del_dup_quota/image.bz2
Binary files differ
diff --git a/tests/f_del_dup_quota/name b/tests/f_del_dup_quota/name
new file mode 100644
index 000000000..8b29fd416
--- /dev/null
+++ b/tests/f_del_dup_quota/name
@@ -0,0 +1 @@
+delete file containing multiply claimed blocks with quota
diff --git a/tests/f_del_dup_quota/script b/tests/f_del_dup_quota/script
new file mode 100644
index 000000000..5480c3fcf
--- /dev/null
+++ b/tests/f_del_dup_quota/script
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+IMAGE=$test_dir/image.bz2
+
+bzip2 -d < $IMAGE > $TMPFILE
+
+# Run fsck to fix the multiply-claimed block breakage
+FSCK_OPT=-f
+EXP1=$test_dir/expect.1
+OUT1=$test_name.1.log
+
+echo "nyyyyyyy" | E2FSCK_FORCE_INTERACTIVE=y $FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT1
+echo "Exit status is $?" >> $OUT1
+
+# Run a second time to verify that fsck completely repaired everything in
+# the first run, including quota corrections
+FSCK_OPT=-fn
+EXP2=$test_dir/expect.2
+OUT2=$test_name.2.log
+
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT2
+echo "Exit status is $?" >> $OUT2
+
+# Figure out what happened
+rm -f $test_name.failed $test_name.ok
+if cmp -s $EXP1 $OUT1 && cmp -s $EXP2 $OUT2; then
+ echo "$test_name: $test_description: ok"
+ touch $test_name.ok
+else
+ echo "$test_name: $test_description: failed"
+ diff -u $EXP1 $OUT1 >> $test_name.failed
+ diff -u $EXP2 $OUT2 >> $test_name.failed
+fi
+unset EXP1 OUT1 EXP2 OUT2 FSCK_OPT IMAGE