File: test_fs_hfsplus

package info (click to toggle)
parted 3.2-7
  • links: PTS, VCS
  • area: main
  • in suites: 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 (94 lines) | stat: -rw-r--r-- 2,275 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
#!/bin/bash
# fsck_hfs seems to be broken : it doesn't even succeed in scanning a freshly
# created by newfs_hfs partition.
# update : retry with my newfs_hfs that round file system size down to 4 ko

do_diff()
{
	mount "${TEST_DRIVE}1" $TEST_MOUNT_POINT -t $FILE_SYSTEM > /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_newfs_hfs()
{
# -w option for newfs_hfs adds an HFS wrapper around the HFS+ F.S.
# update : don't use -w yet because it doesn't works well
# it seems that the wrapper bad block file is stored differently by
# newfs_hfs than by mac os X install format program
# -dfn for fsck_hfs means Debug, Force, No
# Debug => print more information
# Force => force check even if clean bit is set
# No => don't modify the F.S.
	ped_test "mkpart && newfs_hfs && fsck_hfs"\
		"mklabel $TEST_FS_USE_DISK_LABEL\
		 mkpart primary $FILE_SYSTEM 1 $DEFAULT_END"\
		"newfs_hfs -v \"PED HFS TEST\" ${TEST_DRIVE}1"
# &&\
#		 fsck_hfs -dfn ${TEST_DRIVE}1"
}

prepare_resize_tests()
{
	part_num=1
	part=$TEST_DRIVE$part_num
	hole_parent=`echo $TEST_DATA_HOLE | sed -e "s/[-_.a-zA-Z0-9]+\///g"`

	umount $TEST_MOUNT_POINT 2>&1 > /dev/null

	mount $part $TEST_MOUNT_POINT -t $FILE_SYSTEM \
	&& cp $TEST_DATA/* $TEST_MOUNT_POINT -r \
	&& cp -r $TEST_DATA $TEST_MOUNT_POINT/tmp_copy \
	&& rm -rf $TEST_MOUNT_POINT/$TEST_DATA_HOLE \
	&& mv $TEST_MOUNT_POINT/tmp_copy/$TEST_DATA_HOLE \
	      $TEST_MOUNT_POINT/$hole_parent \
	&& rm -rf $TEST_MOUNT_POINT/tmp_copy

	umount $TEST_MOUNT_POINT 2>&1 > /dev/null
}

test_resize_move_end_backward()
{
# -dfn for fsck_hfs means Debug, Force, No
# Debug => print more information
# Force => force check even if clean bit is set
# No => don't modify the F.S.
	do_test_diff "resize: move end backward"\
		$TEST_DATA $TEST_MOUNT_POINT \
		"resize 1 1 $RESIZE_END"\
		""
#fsck_hfs -dfn ${TEST_DRIVE}1 2>&1"
}

main()
{
	export DEFAULT_END=250
	export RESIZE_END=200
	export FILE_SYSTEM=hfsplus

	if ! test_newfs_hfs; then
		return 1
	fi

	prepare_resize_tests
	test_resize_move_end_backward
}

main