2
# exercise the new align-check command
2
# exercise the align-check command
4
# Copyright (C) 2009-2010 Free Software Foundation, Inc.
4
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
6
6
# This program is free software; you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
if test "$VERBOSE" = yes; then
19
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
28
23
require_scsi_debug_module_
30
# check for scsi_debug module
31
modprobe -n scsi_debug ||
32
skip_test_ "you lack the scsi_debug kernel module"
34
25
grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
35
skip_test_ 'this system lacks a new-enough libblkid'
26
skip_ 'this system lacks a new-enough libblkid'
37
28
# create memory-backed device
38
scsi_debug_setup_ dev_size_mb=550 physblk_exp=3 lowest_aligned=7 > dev-name ||
39
skip_test_ 'failed to create scsi_debug device'
29
scsi_debug_setup_ physblk_exp=3 lowest_aligned=7 sector_size=$ss > dev-name ||
30
skip_ 'failed to create scsi_debug device'
40
31
scsi_dev=$(cat dev-name)
45
34
parted -s $scsi_dev mklabel gpt || fail=1
49
parted -s $scsi_dev mkpart p1 ext2 ${i}s 80000s || fail=1
38
parted -s $scsi_dev mkpart p1 ext2 ${i}s 800s || fail=1
50
39
wait_for_dev_to_appear_ $p1 || fail=1
51
40
parted -s $scsi_dev align-check min 1 > out 2>&1
54
43
test $(expr $i % 8) = 7 && exp_result=0 || exp_result=1
55
44
test $result = $exp_result || fail=1
56
compare out /dev/null || fail=1
45
compare /dev/null out || fail=1
58
47
parted -s $scsi_dev rm 1
60
49
test $i = 70 && break
51
# Wait up to 10s for the partition file to disappear.
52
wait_for_dev_to_disappear_ $p1 10 || { fail=1; warn $p1 failed to disappear; }