2011-12-11 15:37:35 +01:00
|
|
|
# Supporting routines for blocktest. Do not run directly.
|
|
|
|
|
|
|
|
# usage: devtopair /dev/cXdY..
|
|
|
|
# returns a label, minor pair in the form "label=at_wini_N,minor=M"
|
|
|
|
devtopair() {
|
|
|
|
label=`awk "/^$(stat -f '%Hr' $1) / "'{print $2}' /proc/dmap`
|
|
|
|
if [ ! -z "$label" ]; then echo "label=$label,minor=`stat -f '%Lr' $1`"; fi
|
|
|
|
}
|
|
|
|
|
2012-09-07 16:25:03 +02:00
|
|
|
# usage: block_test /dev/cXdY.. "params,for,blocktest"
|
2011-12-11 15:37:35 +01:00
|
|
|
# runs the blocktest driver on the given device with the given parameters
|
2012-09-07 16:25:03 +02:00
|
|
|
block_test() {
|
2011-12-11 15:37:35 +01:00
|
|
|
if [ ! -x blocktest ]; then echo "compile blocktest first!" >&2; exit 1; fi
|
|
|
|
if [ ! -b "$1" ]; then echo "$1 is not a block device" >&2; exit 1; fi
|
|
|
|
pair=$(devtopair $1)
|
|
|
|
if [ -z "$pair" ]; then echo "driver not found for $1" >&2; exit 1; fi
|
|
|
|
service up `pwd`/blocktest -args "$pair,$2" -config system.conf \
|
|
|
|
-script /etc/rs.single -label blocktest_$(stat -f '%r' $1)
|
|
|
|
}
|