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
13 if test -x /usr/bin/curl; then
14 GET='/usr/bin/curl -s -o $OUT2 "$f"'
15 POST='/usr/bin/curl -s -H "Content-Type: text/xml" --data-binary "@$postfile" -o $OUT2 "$f"'
16 elif test -x /usr/bin/wget; then
17 GET='/usr/bin/wget -q -O $OUT2 $f'
18 POST='/usr/bin/wget -q -O $OUT2 --header="Content-Type: text/xml" --post-file=$postfile $f'
19 elif test -x /usr/bin/lynx; then
20 GET='/usr/bin/lynx -dump "$f" >$OUT2'
29 if test "x${PREFIX}" = "x"; then
30 echo Missing prefix for run_pazpar2.sh
35 VALGRINDLOG=${PREFIX}_valgrind.log
39 valgrind --leak-check=full --log-file=$VALGRINDLOG ../src/pazpar2 -X -l pazpar2.log -f ${CFG} >extra_pazpar2.log 2>&1 &
41 YAZ_LOG=zoom,zoomdetails,debug,log,fatal ../src/pazpar2 -d -X -l pazpar2.log -f ${srcdir}/${CFG} >extra_pazpar2.log 2>&1 &
47 # Give it a chance to start properly..
50 # Set to success by default.. Will be set to non-zero in case of failure
53 if ps -p $PP2PID >/dev/null 2>&1; then
58 echo "pazpar2 failed to start"
61 # We can start test for real
68 for f in `cat ${srcdir}/${URLS}`; do
69 if echo $f | grep '^http' >/dev/null; then
70 OUT1=${srcdir}/${PREFIX}_${testno}.res
71 OUT2=${PREFIX}_${testno}.log
72 DIFF=${PREFIX}_${testno}.dif
74 if test -n "${postfile}"; then
79 if test -f $OUT1; then
80 if test -f $OUT2; then
81 if diff $OUT1 $OUT2 >$DIFF; then
84 # wget returns 0-size file on HTTP error, curl dont.
85 if test -s $OUT1; then
86 echo "Test $testno: Failed. See $OUT1, $OUT2 and $DIFF"
92 echo "Test $test: can not be performed"
95 echo "Test $testno: Making for the first time"
99 testno=`expr $testno + 1`
101 elif echo $f | grep '^[0-9]' >/dev/null; then
107 echo "File $f does not exist"
111 if ps -p $PP2PID >/dev/null 2>&1; then
114 echo "Test $testno: pazpar2 died"
122 if test -n "$PP2PID"; then