-if test -n "$PAZPAR2_USE_VALGRIND"; then
- valgrind --leak-check=full --log-file=$VALGRINDLOG ../src/pazpar2 -X -l pazpar2.log -f ${CFG} >extra_pazpar2.log 2>&1 &
-elif test -n "$SKIP_PAZPAR2"; then
- echo "Skipping pazpar2. Must already be running with correct config!!! "
-else
- YAZ_LOG=zoom,zoomdetails,debug,log,fatal ../src/pazpar2 -d -X -l pazpar2.log -f ${srcdir}/${CFG} >extra_pazpar2.log 2>&1 &
+ oIFS=$IFS
+ IFS=:
+ F=''
+ for p in $PATH; do
+ if test -x $p/yaz-ztest -a -x $p/yaz-client; then
+ VERSION=`$p/yaz-client -V 2>/dev/null|awk '{print $3;}'|awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+ if test -n "$VERSION"; then
+ if test $VERSION -ge 4002052; then
+ F=$p/yaz-ztest
+ break
+ fi
+ fi
+ fi
+ done
+ if test -z "$F"; then
+ for p in ${srcdir}/../../yaz ${srcdir}/../../yaz-*; do
+ if test -x $p/ztest/yaz-ztest; then
+ VERSION=`$p/ztest/yaz-ztest -V 2>/dev/null|awk '{print $3;}'|awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+ if test -n "$VERSION"; then
+ if test "$VERSION" -ge 4002052; then
+ F=$p/ztest/yaz-ztest
+ break
+ fi
+ fi
+ fi
+ done
+ fi
+ IFS=$oIFS
+ if test -z "$F"; then
+ echo "Skipping ${PREFIX}: recent yaz-ztest not found"
+ exit 0
+ fi
+ rm -f ztest.pid
+ rm -f ${PREFIX}_ztest.log
+ $F -l ${PREFIX}_ztest.log -p ztest.pid -D tcp:localhost:9999
+ sleep 1
+ if test ! -f ztest.pid; then
+ echo "yaz-ztest could not be started"
+ exit 0
+ fi