1433d6423SLionel Sambuc# Supporting routines for blocktest. Do not run directly. 2433d6423SLionel Sambuc 3433d6423SLionel Sambuc# usage: devtopair /dev/cXdY.. 4433d6423SLionel Sambuc# returns a label, minor pair in the form "label=at_wini_N,minor=M" 5433d6423SLionel Sambucdevtopair() { 6433d6423SLionel Sambuc label=`awk "/^$(stat -f '%Hr' $1) / "'{print $2}' /proc/dmap` 7433d6423SLionel Sambuc if [ ! -z "$label" ]; then echo "label=$label,minor=`stat -f '%Lr' $1`"; fi 8433d6423SLionel Sambuc} 9433d6423SLionel Sambuc 10433d6423SLionel Sambuc# usage: block_test /dev/cXdY.. "params,for,blocktest" 11433d6423SLionel Sambuc# runs the blocktest driver on the given device with the given parameters 12433d6423SLionel Sambucblock_test() { 13433d6423SLionel Sambuc if [ ! -x blocktest ]; then echo "compile blocktest first!" >&2; exit 1; fi 14433d6423SLionel Sambuc if [ ! -b "$1" ]; then echo "$1 is not a block device" >&2; exit 1; fi 15433d6423SLionel Sambuc pair=$(devtopair $1) 16433d6423SLionel Sambuc if [ -z "$pair" ]; then echo "driver not found for $1" >&2; exit 1; fi 17*c58da9fbSDavid van Moolenbroek minix-service up `pwd`/blocktest -args "$pair,$2" -config system.conf \ 18433d6423SLionel Sambuc -script /etc/rs.single -label blocktest_$(stat -f '%r' $1) 19433d6423SLionel Sambuc} 20