[Ocfs2-tools-devel] [PATCH 3/3] Ocfs2-tests: Add testcases for fsck-test to verify if new corruption for inline-data can be fixed.

Tristan Ye tristan.ye at oracle.com
Mon Sep 8 19:17:03 PDT 2008


Add new testcase for fsck-test to verfiy if newly added corruptions for inline-data
can be fixed by fsck.the corruptions will mess up the inline-data flag and id_count.

Btw,the newly added corruptions mentioned above in fswreck were 44,45(corrupt code).
Therefore 4 .stdout files added for comparison when fscking...

Should apply the patch for fswreck to add new corruptions first before your testing,
this patch also has been sent out.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 programs/fsck-tests/fsck-test.sh                   |   27 ++++++++++++++++++-
 .../fsck-tests/medium-disk/fsck.ocfs2.44.stdout    |   21 +++++++++++++++
 .../fsck-tests/medium-disk/fsck.ocfs2.45.stdout    |   25 ++++++++++++++++++
 .../fsck-tests/small-disk/fsck.ocfs2.44.stdout     |   21 +++++++++++++++
 .../fsck-tests/small-disk/fsck.ocfs2.45.stdout     |   25 ++++++++++++++++++
 5 files changed, 117 insertions(+), 2 deletions(-)
 create mode 100644 programs/fsck-tests/medium-disk/fsck.ocfs2.44.stdout
 create mode 100644 programs/fsck-tests/medium-disk/fsck.ocfs2.45.stdout
 create mode 100644 programs/fsck-tests/small-disk/fsck.ocfs2.44.stdout
 create mode 100644 programs/fsck-tests/small-disk/fsck.ocfs2.45.stdout

diff --git a/programs/fsck-tests/fsck-test.sh b/programs/fsck-tests/fsck-test.sh
index 7af55df..7f97f62 100755
--- a/programs/fsck-tests/fsck-test.sh
+++ b/programs/fsck-tests/fsck-test.sh
@@ -195,6 +195,10 @@ DISK_SIZE="small"
 LOG_DIR=`dirname ${BINDIR}`
 
 
+declare -a FS_FEATURES=""
+FS_FEATURES_OPTION="--fs-features="
+FS_FEATURES_ARGS=""
+
 #
 # ext_setup		Guess the position of fsck.ocfs2, fswreck and fill
 #			FSCK_BIN, FSWRECK_BIN
@@ -350,6 +354,22 @@ function smoke_test()
 	test_pass_or_fail 0
 }
 
+#add --fs-feature support for mkfs
+function gen_fs_features()
+{
+        local corrupt="$1"
+        case "$corrupt" in
+                "44")   ;;
+                "45")   FS_FEATURES="inline-data" ;;
+                *)      ;;
+        esac
+
+        for item in $FS_FEATURES;do
+                FS_FEATURES_ARGS="${FS_FEATURES_OPTION}${item} ${FS_FEATURES_ARGS}"
+        done
+
+}
+
 #	$2	Disk size, should be ``small'', ``medium'' or ``large''.
 function corrupt_test()
 {
@@ -396,10 +416,13 @@ function corrupt_test()
 	test_info "dd if=/dev/zero of=$DEVICE bs=1M count=4"
 	test_fail_if_bad "$?" "dd failed" || return
 
-	test_info mkfs.ocfs2 -b "${mkfs_profile[0]}" -C "${mkfs_profile[1]}" \
+	#add --fs-features support for mkfs
+        gen_fs_features ${corrupt}
+
+	test_info mkfs.ocfs2 ${FS_FEATURES_ARGS} -b "${mkfs_profile[0]}" -C "${mkfs_profile[1]}" \
 		-N "${mkfs_profile[2]}" -J "size=${mkfs_profile[3]}" \
 		"$DEVICE" "${mkfs_profile[4]}"
-	yes | "$MKFS_BIN" -b "${mkfs_profile[0]}" -C "${mkfs_profile[1]}" \
+	yes | "$MKFS_BIN" ${FS_FEATURES_ARGS} -b "${mkfs_profile[0]}" -C "${mkfs_profile[1]}" \
 		-N "${mkfs_profile[2]}" -J "size=${mkfs_profile[3]}" \
 		"$DEVICE" "${mkfs_profile[4]}" &>"$STDOUT"
 	test_fail_if_bad "$?" "mkfs failed" || return
diff --git a/programs/fsck-tests/medium-disk/fsck.ocfs2.44.stdout b/programs/fsck-tests/medium-disk/fsck.ocfs2.44.stdout
new file mode 100644
index 0000000..b3bf0b7
--- /dev/null
+++ b/programs/fsck-tests/medium-disk/fsck.ocfs2.44.stdout
@@ -0,0 +1,21 @@
+Checking OCFS2 filesystem in @DEVICE@:
+  label:              <NONE>
+  uuid:               f4 54 89 d1 04 97 4b 52 a7 b6 8c 73 26 77 22 d3 
+  number of blocks:   1048576
+  bytes per block:    4096
+  number of clusters: 1048576
+  bytes per cluster:  4096
+  max slots:          4
+
+ at DEVICE@ was run with -f, check forced.
+Pass 0a: Checking cluster allocation chains
+Pass 0b: Checking inode allocation chains
+Pass 0c: Checking extent block allocation chains
+Pass 1: Checking inodes and blocks.
+[INLINE_DATA_FLAG_INVALID] Inode 16857 has inline flag set but the volume doesn't support it. Clear it? y
+[INLINE_DATA_FLAG_INVALID] Inode 16858 has inline flag set but the volume doesn't support it. Clear it? y
+Pass 2: Checking directory entries.
+Pass 3: Checking directory connectivity.
+Pass 4a: checking for orphaned inodes
+Pass 4b: Checking inodes link counts.
+All passes succeeded.
diff --git a/programs/fsck-tests/medium-disk/fsck.ocfs2.45.stdout b/programs/fsck-tests/medium-disk/fsck.ocfs2.45.stdout
new file mode 100644
index 0000000..f267219
--- /dev/null
+++ b/programs/fsck-tests/medium-disk/fsck.ocfs2.45.stdout
@@ -0,0 +1,25 @@
+Checking OCFS2 filesystem in @DEVICE@:
+  label:              <NONE>
+  uuid:               04 31 ee 61 f6 02 44 ac a1 0b be a8 c7 59 6c b8 
+  number of blocks:   1048576
+  bytes per block:    4096
+  number of clusters: 1048576
+  bytes per cluster:  4096
+  max slots:          4
+
+ at DEVICE@ was run with -f, check forced.
+Pass 0a: Checking cluster allocation chains
+Pass 0b: Checking inode allocation chains
+Pass 0c: Checking extent block allocation chains
+Pass 1: Checking inodes and blocks.
+[INLINE_DATA_COUNT_INVALID] Inode 16851 is inline file and its id_count is 0 which should be 3896. Correct this count? y
+[INODE_SIZE] Inode 16851has a size of 3897 which exceeds the max inline data size 3896. Correct the file size? y
+[INODE_CLUSTERS] Inode 16851 has 1 clusters but it has inline data flag set. Correct the number of clusters? y
+[INLINE_DATA_COUNT_INVALID] Inode 16852 is inline file and its id_count is 0 which should be 3896. Correct this count? y
+[INODE_SIZE] Inode 16852has a size of 3897 which exceeds the max inline data size 3896. Correct the file size? y
+[INODE_CLUSTERS] Inode 16852 has 1 clusters but it has inline data flag set. Correct the number of clusters? y
+Pass 2: Checking directory entries.
+Pass 3: Checking directory connectivity.
+Pass 4a: checking for orphaned inodes
+Pass 4b: Checking inodes link counts.
+All passes succeeded.
diff --git a/programs/fsck-tests/small-disk/fsck.ocfs2.44.stdout b/programs/fsck-tests/small-disk/fsck.ocfs2.44.stdout
new file mode 100644
index 0000000..1cee7df
--- /dev/null
+++ b/programs/fsck-tests/small-disk/fsck.ocfs2.44.stdout
@@ -0,0 +1,21 @@
+Checking OCFS2 filesystem in @DEVICE@:
+  label:              <NONE>
+  uuid:               b6 9a 0a bf 4f b7 45 33 a2 61 8f ab 93 f3 f0 5f 
+  number of blocks:   262144
+  bytes per block:    1024
+  number of clusters: 65536
+  bytes per cluster:  4096
+  max slots:          4
+
+ at DEVICE@ was run with -f, check forced.
+Pass 0a: Checking cluster allocation chains
+Pass 0b: Checking inode allocation chains
+Pass 0c: Checking extent block allocation chains
+Pass 1: Checking inodes and blocks.
+[INLINE_DATA_FLAG_INVALID] Inode 16883 has inline flag set but the volume doesn't support it. Clear it? y
+[INLINE_DATA_FLAG_INVALID] Inode 16884 has inline flag set but the volume doesn't support it. Clear it? y
+Pass 2: Checking directory entries.
+Pass 3: Checking directory connectivity.
+Pass 4a: checking for orphaned inodes
+Pass 4b: Checking inodes link counts.
+All passes succeeded.
diff --git a/programs/fsck-tests/small-disk/fsck.ocfs2.45.stdout b/programs/fsck-tests/small-disk/fsck.ocfs2.45.stdout
new file mode 100644
index 0000000..6b94859
--- /dev/null
+++ b/programs/fsck-tests/small-disk/fsck.ocfs2.45.stdout
@@ -0,0 +1,25 @@
+Checking OCFS2 filesystem in @DEVICE@:
+  label:              <NONE>
+  uuid:               8d a0 35 81 7e 98 4a 52 8d bd 72 92 37 2d 32 89 
+  number of blocks:   262144
+  bytes per block:    1024
+  number of clusters: 65536
+  bytes per cluster:  4096
+  max slots:          4
+
+ at DEVICE@ was run with -f, check forced.
+Pass 0a: Checking cluster allocation chains
+Pass 0b: Checking inode allocation chains
+Pass 0c: Checking extent block allocation chains
+Pass 1: Checking inodes and blocks.
+[INLINE_DATA_COUNT_INVALID] Inode 16863 is inline file and its id_count is 0 which should be 824. Correct this count? y
+[INODE_SIZE] Inode 16863has a size of 825 which exceeds the max inline data size 824. Correct the file size? y
+[INODE_CLUSTERS] Inode 16863 has 1 clusters but it has inline data flag set. Correct the number of clusters? y
+[INLINE_DATA_COUNT_INVALID] Inode 16864 is inline file and its id_count is 0 which should be 824. Correct this count? y
+[INODE_SIZE] Inode 16864has a size of 825 which exceeds the max inline data size 824. Correct the file size? y
+[INODE_CLUSTERS] Inode 16864 has 1 clusters but it has inline data flag set. Correct the number of clusters? y
+Pass 2: Checking directory entries.
+Pass 3: Checking directory connectivity.
+Pass 4a: checking for orphaned inodes
+Pass 4b: Checking inodes link counts.
+All passes succeeded.
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list