summaryrefslogtreecommitdiffstats
path: root/debug/test/test_fs_ext2
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
commita398d2c2b5fd6ab0545d8bb019f9a970b2309404 (patch)
tree272fc7ab226258d7ceddee12c8c682c8e711c2b0 /debug/test/test_fs_ext2
parentInitial commit. (diff)
downloadparted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.tar.xz
parted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.zip
Adding upstream version 3.6.upstream/3.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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