~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to test/shell/topology-support.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2013-03-03 12:33:47 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20130303123347-smfwei6dodkdth55
Tags: 2.02.98-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
1
2
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
2
3
#
3
4
# This copyrighted material is made available to anyone wishing to use,
8
9
# along with this program; if not, write to the Free Software Foundation,
9
10
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10
11
 
11
 
which mkfs.ext3 || exit 200
12
 
 
13
12
. lib/test
14
13
 
15
 
check_logical_block_size()
16
 
{
 
14
which mkfs.ext3 || skip
 
15
 
 
16
check_logical_block_size() {
17
17
    local DEV_=$(cat SCSI_DEBUG_DEV)
18
18
    # Verify logical_block_size - requires Linux >= 2.6.31
19
 
    SYSFS_LOGICAL_BLOCK_SIZE=`echo /sys/block/$(basename $DEV_)/queue/logical_block_size`
 
19
    SYSFS_LOGICAL_BLOCK_SIZE=$(echo /sys/block/$(basename $DEV_)/queue/logical_block_size)
20
20
    if [ -f "$SYSFS_LOGICAL_BLOCK_SIZE" ] ; then
21
 
        ACTUAL_LOGICAL_BLOCK_SIZE=`cat $SYSFS_LOGICAL_BLOCK_SIZE`
 
21
        ACTUAL_LOGICAL_BLOCK_SIZE=$(cat $SYSFS_LOGICAL_BLOCK_SIZE)
22
22
        test $ACTUAL_LOGICAL_BLOCK_SIZE = $1
23
23
    fi
24
24
}
25
25
 
26
 
lvdev_()
27
 
{
 
26
lvdev_() {
28
27
    echo "$DM_DEV_DIR/$1/$2"
29
28
}
30
29
 
31
 
test_snapshot_mount()
32
 
{
33
 
    lvcreate -L 16M -n $lv1 $vg $dev1
 
30
test_snapshot_mount() {
 
31
    lvcreate -L 16M -n $lv1 $vg "$dev1"
34
32
    mkfs.ext3 $(lvdev_ $vg $lv1)
35
33
    mkdir test_mnt
36
 
    mount $(lvdev_ $vg $lv1) test_mnt
 
34
    mount "$(lvdev_ $vg $lv1)" test_mnt
37
35
    lvcreate -L 16M -n $lv2 -s $vg/$lv1
38
36
    umount test_mnt
39
37
    # mount the origin
40
 
    mount $(lvdev_ $vg $lv1) test_mnt
 
38
    mount "$(lvdev_ $vg $lv1)" test_mnt
41
39
    umount test_mnt
42
40
    # mount the snapshot
43
 
    mount $(lvdev_ $vg $lv2) test_mnt
 
41
    mount "$(lvdev_ $vg $lv2)" test_mnt
44
42
    umount test_mnt
45
43
    rm -r test_mnt
46
44
    vgchange -an $vg
55
53
DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE))
56
54
 
57
55
# Test that kernel supports topology
58
 
aux prepare_scsi_debug_dev $DEV_SIZE
 
56
aux prepare_scsi_debug_dev $DEV_SIZE || skip
 
57
 
59
58
if [ ! -e /sys/block/$(basename $(cat SCSI_DEBUG_DEV))/alignment_offset ] ; then
60
59
        aux cleanup_scsi_debug_dev
61
 
        exit 200
 
60
        skip
62
61
fi
63
62
aux cleanup_scsi_debug_dev
64
63