~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: 2014-08-19 15:37:06 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20140819153706-i1gaio8lg534dara
Tags: 2.02.109-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# along with this program; if not, write to the Free Software Foundation,
10
10
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
11
11
 
12
 
. lib/test
 
12
. lib/inittest
13
13
 
14
14
which mkfs.ext3 || skip
15
15
 
16
16
check_logical_block_size() {
17
 
    local DEV_=$(cat SCSI_DEBUG_DEV)
18
17
    # Verify logical_block_size - requires Linux >= 2.6.31
19
 
    SYSFS_LOGICAL_BLOCK_SIZE=$(echo /sys/block/$(basename $DEV_)/queue/logical_block_size)
20
 
    if [ -f "$SYSFS_LOGICAL_BLOCK_SIZE" ] ; then
21
 
        ACTUAL_LOGICAL_BLOCK_SIZE=$(cat $SYSFS_LOGICAL_BLOCK_SIZE)
22
 
        test $ACTUAL_LOGICAL_BLOCK_SIZE = $1
23
 
    fi
 
18
    SYSFS_LOGICAL_BLOCK_SIZE="/sys/block/$(basename $(< SCSI_DEBUG_DEV))/queue/logical_block_size"
 
19
    test -f "$SYSFS_LOGICAL_BLOCK_SIZE" || return 0
 
20
    test "$(< $SYSFS_LOGICAL_BLOCK_SIZE)" -eq "$1" # ACTUAL_LOGICAL_BLOCK_SIZE
24
21
}
25
22
 
26
23
check_optimal_io_size() {
27
 
    local DEV_=$(cat SCSI_DEBUG_DEV)
28
24
    # Verify optimal_io_size
29
 
    SYSFS_OPTIMAL_IO_SIZE=$(echo /sys/block/$(basename $DEV_)/queue/optimal_io_size)
30
 
    if [ -f "$SYSFS_OPTIMAL_IO_SIZE" ] ; then
31
 
        ACTUAL_OPTIMAL_IO_SIZE=$(cat $SYSFS_OPTIMAL_IO_SIZE)
32
 
        test $ACTUAL_OPTIMAL_IO_SIZE = $1
33
 
    fi
 
25
    SYSFS_OPTIMAL_IO_SIZE="/sys/block/$(basename $(< SCSI_DEBUG_DEV))/queue/optimal_io_size"
 
26
    test -f "$SYSFS_OPTIMAL_IO_SIZE" || return 0
 
27
    test "$(< $SYSFS_OPTIMAL_IO_SIZE)" -eq "$1" # ACTUAL_OPTIMAL_IO_SIZE
34
28
}
35
29
 
36
30
lvdev_() {
64
58
# Test that kernel supports topology
65
59
aux prepare_scsi_debug_dev $DEV_SIZE || skip
66
60
 
67
 
if [ ! -e /sys/block/$(basename $(cat SCSI_DEBUG_DEV))/alignment_offset ] ; then
 
61
if [ ! -e /sys/block/$(basename $(< SCSI_DEBUG_DEV))/alignment_offset ] ; then
68
62
        aux cleanup_scsi_debug_dev
69
63
        skip
70
64
fi
79
73
check_logical_block_size $LOGICAL_BLOCK_SIZE
80
74
 
81
75
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
82
 
vgcreate $vg $(cat DEVICES)
 
76
get_devs
 
77
 
 
78
vgcreate $vg "${DEVICES[@]}"
83
79
test_snapshot_mount
84
80
vgremove $vg
85
81
 
94
90
check_logical_block_size $LOGICAL_BLOCK_SIZE
95
91
 
96
92
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
97
 
vgcreate $vg $(cat DEVICES)
 
93
vgcreate $vg "${DEVICES[@]}"
98
94
test_snapshot_mount
99
95
vgremove $vg
100
96
 
109
105
check_logical_block_size $LOGICAL_BLOCK_SIZE
110
106
 
111
107
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
112
 
vgcreate $vg $(cat DEVICES)
 
108
vgcreate $vg "${DEVICES[@]}"
113
109
test_snapshot_mount
114
110
vgremove $vg
115
111
 
126
122
check_optimal_io_size 786432
127
123
 
128
124
aux prepare_pvs 1 $PER_DEV_SIZE
129
 
check pv_field $(cat DEVICES) pe_start 768.00k
 
125
check pv_field "${DEVICES[@]}" pe_start 768.00k
130
126
 
131
127
aux cleanup_scsi_debug_dev