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