File: test_fs_reiserfs

package info (click to toggle)
parted 3.2-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 15,312 kB
  • ctags: 12,128
  • sloc: ansic: 68,106; sh: 18,156; makefile: 632; perl: 179; python: 45; asm: 36; sed: 16
file content (97 lines) | stat: -rwxr-xr-x 1,965 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /bin/bash

do_diff()
{
	mount "${TEST_DRIVE}1" $TEST_MOUNT_POINT -t reiserfs > /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 primary reiserfs 1 1"\
		"mklabel $TEST_FS_USE_DISK_LABEL\
		 mkpartfs primary reiserfs 1 1\
		 check 1"\
		"echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1"

	ped_test "mkpartfs"\
		"mklabel $TEST_FS_USE_DISK_LABEL\
		mkpartfs primary reiserfs 1 $DEFAULT_END\
		check 1"\
		"echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1"

	ped_test "mkfs"\
		"mkfs 1 reiserfs\
		 check 1"\
		"echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&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 reiserfs \
	&& 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"\
		"echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&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"\
		"echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&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"\
		"echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&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