1#!/bin/sh 2 3name="$(mktemp -u mirror.XXXXXX)" 4class="mirror" 5base=`basename $0` 6 7gmirror_test_cleanup() 8{ 9 [ -c /dev/$class/$name ] && gmirror destroy $name 10 geom_test_cleanup 11} 12trap gmirror_test_cleanup ABRT EXIT INT TERM 13 14gmirror_worker_pid() 15{ 16 pgrep -S -n "g_mirror mirror\..*" 17} 18 19syncwait() 20{ 21 while $(gmirror status -s $name | grep -q SYNCHRONIZING); do 22 sleep 0.1; 23 done 24} 25 26consumerrefs() 27{ 28 gclass=$1 29 geom=$2 30 31 if [ $# -ne 2 ]; then 32 echo "Bad usage consumerrefs" >&2 33 exit 1 34 fi 35 36 geom "${gclass}" list "${geom}" | \ 37 grep -A5 ^Consumers | \ 38 grep Mode | \ 39 cut -d: -f2 40} 41 42disconnectwait() 43{ 44 gclass=$1 45 geom=$2 46 47 if [ $# -ne 2 ]; then 48 echo "Bad usage disconnectwait" >&2 49 exit 1 50 fi 51 52 while [ $(consumerrefs "$gclass" "$geom") != r0w0e0 ]; do 53 sleep 0.05 54 done 55} 56 57. `dirname $0`/../geom_subr.sh 58