Enable the yaz-ztest in the test
[pazpar2-moved-to-github.git] / test / test_termlist_block.sh
1 #!/bin/sh
2 #
3
4 # srcdir might be set by make
5 srcdir=${srcdir:-"."}
6
7 TEST=test_termlist_block
8
9 # look for yaz-ztest in PATH
10 oIFS=$IFS
11 IFS=:
12 F=''
13 for p in $PATH; do
14     if test -x $p/yaz-ztest -a -x $p/yaz-client; then
15         VERSION=`$p/yaz-client -V|awk '{print $3;}'|awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
16         if test $VERSION -ge 4000000; then
17             F=$p/yaz-ztest
18             break
19         fi
20     fi
21 done
22 IFS=$oIFS
23
24 if test -z "$F"; then
25     echo "yaz-ztest not found"
26     exit 0
27 fi
28
29 rm -f ztest.pid
30 rm -f ${TEST}_ztest.log
31 $F -l ${TEST}_ztest.log -p ztest.pid -D tcp:localhost:9999
32 sleep 1
33 if test ! -f ztest.pid; then
34     echo "yaz-ztest could not be started"
35     exit 0
36 fi
37
38 # Test using test_http.cfg
39 ${srcdir}/run_pazpar2.sh ${TEST}
40 E=$?
41 kill `cat ztest.pid`
42 rm ztest.pid
43 exit $E
44
45 # Local Variables:
46 # mode:shell-script
47 # sh-indentation: 2
48 # sh-basic-offset: 4
49 # End: