Using own ztest log file
[pazpar2-moved-to-github.git] / test / test_filter.sh
1 #!/bin/sh
2 #
3
4 # srcdir might be set by make
5 srcdir=${srcdir:-"."}
6
7 TEST=test_filter_
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 $F -l ${TEST}ztest.log -p ztest.pid -D tcp:localhost:9999
31 sleep 1
32 if test ! -f ztest.pid; then
33     echo "yaz-ztest could not be started"
34     exit 0
35 fi
36
37 # Test using test_http.cfg
38 ${srcdir}/run_pazpar2.sh test_filter
39 E=$?
40 kill `cat ztest.pid`
41 rm ztest.pid
42 exit $E
43
44 # Local Variables:
45 # mode:shell-script
46 # sh-indentation: 2
47 # sh-basic-offset: 4
48 # End: