summaryrefslogtreecommitdiffstats
path: root/debug/test/test_fs_ext2
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdebug/test/test_fs_ext297
1 files changed, 97 insertions, 0 deletions
diff --git a/debug/test/test_fs_ext2 b/debug/test/test_fs_ext2
new file mode 100755
index 0000000..f1f2ec0
--- /dev/null
+++ b/debug/test/test_fs_ext2
@@ -0,0 +1,97 @@
+#! /bin/bash
+
+do_diff()
+{
+ mount "${TEST_DRIVE}1" $TEST_MOUNT_POINT -t ext2 > /dev/null
+
+ if diff -rq $1 $2 --exclude lost+found >> test_log; then
+ ped_test_ok
+ else
+ ped_test_failed
+ fi
+
+ umount $TEST_MOUNT_POINT 2>&1 > /dev/null
+}
+
+do_test_diff()
+{
+ ped_testing "$1"
+ if ped_test_get_val "$4" "$5" "$6"; then
+ ped_test_failed
+ return 1
+ fi
+ do_diff "$2" "$3"
+}
+
+test_mkpartfs()
+{
+ ped_test "mkpartfs 1 ext2 1 1"\
+ "mklabel $TEST_FS_USE_DISK_LABEL\
+ mkpartfs 1 ext2 1 1\
+ check 1"\
+ "/sbin/e2fsck -n -f ${TEST_DRIVE}1"
+
+ ped_test "mkpartfs"\
+ "mklabel $TEST_FS_USE_DISK_LABEL\
+ mkpartfs primary ext2 1 $DEFAULT_END\
+ check 1"\
+ "/sbin/e2fsck -n -f ${TEST_DRIVE}1"
+
+ ped_test "mkfs"\
+ "mkfs 1 ext2\
+ check 1"\
+ "/sbin/e2fsck -n -f ${TEST_DRIVE}1"
+}
+
+prepare_resize_tests()
+{
+ part_num=1
+ part=$TEST_DRIVE$part_num
+
+ umount $TEST_MOUNT_POINT 2>&1 > /dev/null
+
+ mount $part $TEST_MOUNT_POINT -t ext2 \
+ && cp $TEST_DATA/* $TEST_MOUNT_POINT -r
+ umount $TEST_MOUNT_POINT 2>&1 > /dev/null
+}
+
+test_resize_move_end_forward()
+{
+ do_test_diff "resize: move end forward"\
+ $TEST_DATA $TEST_MOUNT_POINT \
+ "resize 1 1 $[ $DEFAULT_END + 5 ] check 1"\
+ "/sbin/e2fsck -n -f ${TEST_DRIVE}1"
+}
+
+test_resize_move_end_forward_big()
+{
+ do_test_diff "resize: move end forward (big)"\
+ $TEST_DATA $TEST_MOUNT_POINT \
+ "resize 1 1 $[ $DEFAULT_END + 200 ] check 1"\
+ "/sbin/e2fsck -n -f ${TEST_DRIVE}1"
+}
+
+test_resize_move_end_backward()
+{
+ do_test_diff "resize: move end backward"\
+ $TEST_DATA $TEST_MOUNT_POINT \
+ "resize 1 1 $DEFAULT_END check 1"\
+ "/sbin/e2fsck -n -f ${TEST_DRIVE}1"
+}
+
+main()
+{
+ export DEFAULT_END=200
+
+ if ! test_mkpartfs; then
+ return 1
+ fi
+
+ prepare_resize_tests
+ test_resize_move_end_forward
+ test_resize_move_end_backward
+ test_resize_move_end_forward_big
+ test_resize_move_end_backward
+}
+
+main