#!/bin/sh
# Yes, that's POSIX sh, not bash!
-tmpnam=`mktemp`
-conffile=${tmpnam}.conf
-pidfile=${tmpnam}.pid
+tmpdir=`mktemp -d`
+conffile=${tmpdir}/nbd.conf
+pidfile=${tmpdir}/nbd.pid
+tmpnam=${tmpdir}/nbd.dd
+mydir=$(dirname "`readlink -f $0`")
ulimit -c unlimited
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
- rm -f ${pidfile}
else
kill $PID
fi
if [ -z "$2" ]
then
- rm -f $tmpnam ${conffile}
+ rm -rf $tmpdir
fi
exit $retval
fi
./nbd-tester-client localhost -N export1 -w -f
retval=$?
;;
+ */integrity)
+ # Integrity test
+ cat >${conffile} <<EOF
+[generic]
+[export1]
+ exportname = $tmpnam
+ flush = true
+ fua = true
+ rotational = true
+ filesize = 52428800
+ temporary = true
+EOF
+ ./nbd-server -C ${conffile} -p ${pidfile} &
+ PID=$!
+ sleep 1
+ ./nbd-tester-client localhost -N export1 -i -t ${mydir}/integrity-test.tr
+ retval=$?
+ ;;
+ */integrityhuge)
+ # Integrity test
+ cat >${conffile} <<EOF
+[generic]
+[export1]
+ exportname = $tmpnam
+ flush = true
+ fua = true
+ rotational = true
+ filesize = 52428800
+ temporary = true
+EOF
+ ./nbd-server -C ${conffile} -p ${pidfile} &
+ PID=$!
+ sleep 1
+ ./nbd-tester-client localhost -N export1 -i -t ${mydir}/integrityhuge-test.tr
+ retval=$?
+ ;;
*)
echo "E: unknown test $1"
exit 1
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
- rm -f ${pidfile}
else
kill $PID
fi
if [ -z "$2" ]
then
- rm -f $tmpnam ${conffile}
+ rm -rf $tmpdir
fi
if [ $retval -ne 0 ]
then