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