OSDN Git Service

tests: add testcase for "mke2fs -E offset=N..."
authorMarcus Huewe <suse-tux@gmx.de>
Sun, 27 Mar 2016 02:24:51 +0000 (22:24 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 27 Mar 2016 02:24:51 +0000 (22:24 -0400)
Test that mke2fs does not modify any data before the offset and
after the end of the filesystem.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/t_mke2fs_offset/script [new file with mode: 0755]

diff --git a/tests/t_mke2fs_offset/script b/tests/t_mke2fs_offset/script
new file mode 100755 (executable)
index 0000000..97b9bd1
--- /dev/null
@@ -0,0 +1,20 @@
+test_description="mke2fs with offset option (-E offset=N)"
+OUT="$test_name.log"
+
+echo "testing mke2fs with -E offset=524288 option" > "$OUT"
+yes a | dd of="$TMPFILE" bs=1k count=2048 2>/dev/null
+$MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" 1024 >> "$OUT" 2>&1
+# compute crc of the first and last 512 1k blocks
+crc_first=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM`
+crc_last=`dd if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM`
+crc_exp=`yes a | dd bs=1k count=512 2>/dev/null | $CRCSUM`
+
+if [ "$crc_first" = "$crc_last" -a "$crc_first" = "$crc_exp" ]; then
+       echo "$test_name: $test_description: ok"
+       touch "$test_name.ok"
+else
+       echo "$test_name: $test_description: failed"
+       echo "crc_first: $crc_first" > "$test_name.failed"
+       echo "crc_last: $crc_last" >> "$test_name.failed"
+       echo "crc_exp: $crc_exp" >> "$test_name.failed"
+fi