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