2 # exercise the align-check command
4 # Copyright (C) 2009-2011 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/init.sh"; path_prepend_ ../parted
23 require_scsi_debug_module_
25 grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
26 skip_ 'this system lacks a new-enough libblkid'
28 # create memory-backed device
29 scsi_debug_setup_ physblk_exp=3 lowest_aligned=7 sector_size=$ss > dev-name ||
30 skip_ 'failed to create scsi_debug device'
31 scsi_dev=$(cat dev-name)
34 parted -s $scsi_dev mklabel gpt || fail=1
38 parted -s $scsi_dev mkpart p1 ext2 ${i}s 800s || fail=1
39 wait_for_dev_to_appear_ $p1 || fail=1
40 parted -s $scsi_dev align-check min 1 > out 2>&1
43 test $(expr $i % 8) = 7 && exp_result=0 || exp_result=1
44 test $result = $exp_result || fail=1
45 compare out /dev/null || fail=1
47 parted -s $scsi_dev rm 1
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; }