~ubuntu-branches/ubuntu/trusty/util-linux/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/ts/fdisk/align-512-512-topology

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2011-05-11 08:38:31 UTC
  • mfrom: (1.3.10 upstream)
  • mto: (1.6.3 upstream) (4.5.5 sid)
  • mto: This revision was merged to the branch mainline in revision 82.
  • Revision ID: james.westby@ubuntu.com-20110511083831-tty7wnezw55fmrn4
ImportĀ upstreamĀ versionĀ 2.19.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
#
 
4
# This file is part of util-linux.
 
5
#
 
6
# This file 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 2 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# This file 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.
 
15
#
 
16
 
 
17
 
 
18
#
 
19
# Test alignment for 512/512 disk *with* topology -- aligned to optimal
 
20
# I/O size (32KiB)
 
21
#
 
22
 
 
23
TS_TOPDIR="$(dirname $0)/../.."
 
24
TS_DESC="align 512/512 +topology"
 
25
 
 
26
. $TS_TOPDIR/functions.sh
 
27
ts_init "$*"
 
28
ts_skip_nonroot
 
29
 
 
30
modprobe --dry-run --quiet scsi_debug
 
31
[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
 
32
 
 
33
rmmod scsi_debug &> /dev/null
 
34
modprobe scsi_debug dev_size_mb=50 sector_size=512
 
35
[ "$?" == 0 ] || ts_die "Cannot init device"
 
36
 
 
37
sleep 3
 
38
 
 
39
DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
 
40
[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device"
 
41
 
 
42
DEVICE="/dev/${DEVNAME}"
 
43
 
 
44
ts_log "Create partitions"
 
45
$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
 
46
n
 
47
p
 
48
1
 
49
 
 
50
+10M
 
51
n
 
52
p
 
53
2
 
54
 
 
55
+10M
 
56
n
 
57
p
 
58
3
 
59
 
 
60
+10M
 
61
n
 
62
e
 
63
 
 
64
 
 
65
n
 
66
 
 
67
+5M
 
68
n
 
69
 
 
70
+5M
 
71
n
 
72
 
 
73
 
 
74
p
 
75
w
 
76
q
 
77
EOF
 
78
 
 
79
ts_log "Alignment offsets:"
 
80
cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTPUT 2>&1
 
81
 
 
82
sleep 3
 
83
rmmod scsi_debug
 
84
 
 
85
# remove device name used and disk ID
 
86
sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
 
87
sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
 
88
sed -i -e 's/Building a new.*//g' $TS_OUTPUT
 
89
 
 
90
ts_finalize