3 # Regression test using pazpar2 against z3950.indexdata.com/marc
4 # Reads Pazpar2 URLs from test_http_urls
5 # Outputs to test_http_<no>.log
6 # Matches against results in test_http_<no>.res
10 # srcdir might be set by make
15 if test -x /usr/bin/wget; then
18 if test -x /usr/bin/lynx; then
27 if test "x${PREFIX}" = "x"; then
28 echo Missing prefix for run_pazpar2.sh
35 if test "$usevalgrind"; then
36 valgrind --leak-check=full --log-file=valgrind ../src/pazpar2 -X -l pazpar2.log -f ${CFG} >extra_pazpar2.log 2>&1 &
38 YAZ_LOG=zoom,zoomdetails,debug,log,fatal ../src/pazpar2 -d -X -l pazpar2.log -f ${srcdir}/${CFG} >extra_pazpar2.log 2>&1 &
44 # Give it a chance to start properly..
47 # Set to success by default.. Will be set to non-zero in case of failure
50 if ps -p $PP2PID >/dev/null 2>&1; then
55 echo "pazpar2 failed to start"
58 # We can start test for real
65 for f in `cat ${srcdir}/${URLS}`; do
66 if echo $f | grep '^http' >/dev/null; then
67 OUT1=${srcdir}/${PREFIX}_${testno}.res
68 OUT2=${PREFIX}_${testno}.log
69 DIFF=${PREFIX}_${testno}.dif
70 if test -f $OUT1; then
72 if test -n "${wget}"; then
73 if test -n "${postfile}"; then
74 ${wget} -q -O $OUT2 --header="Content-Type: text/xml" --post-file=$postfile $f
76 ${wget} -q -O $OUT2 $f
78 elif test -n "${lynx}"; then
79 ${lynx} -dump $f >$OUT2
83 if diff $OUT1 $OUT2 >$DIFF; then
86 echo "Test $testno: Failed. See $OUT1, $OUT2 and $DIFF"
91 echo "Test $testno: Making for the first time"
92 ${wget} -q -O $OUT1 $f
95 testno=`expr $testno + 1`
97 elif echo $f | grep '^[0-9]' >/dev/null; then
103 echo "File $f does not exist"
107 if ps -p $PP2PID >/dev/null 2>&1; then
110 echo "Test $testno: pazpar2 died"
119 if test -n "$PP2PID"; then