3 # Regression test using pazpar2 against z3950.indexdata.com/marc or gils
4 # Reads Pazpar2 URLs from $1
5 # Outputs to $1_<no>.log
6 # Matches against results in $1_<no>.res
9 # srcdir might be set by make
12 # look for curl in PATH
17 if test -x $p/curl; then
24 if test -z $curl; then
25 echo "curl not found. $PREFIX can not be tested"
28 GET='$curl --silent --output $OUT2 "$f"'
29 POST='$curl --silent --header "Content-Type: text/xml" --data-binary "@$postfile" --output $OUT2 "$f"'
35 if test "x${PREFIX}" = "x"; then
36 echo Missing prefix for run_pazpar2.sh
41 VALGRINDLOG=${PREFIX}_valgrind.log
44 if test -n "$PAZPAR2_USE_VALGRIND"; then
45 usevalgrind=$PAZPAR2_USE_VALGRIND;
48 valgrind --leak-check=full --log-file=$VALGRINDLOG ../src/pazpar2 -X -l pazpar2.log -f ${CFG} >extra_pazpar2.log 2>&1 &
50 YAZ_LOG=zoom,zoomdetails,debug,log,fatal ../src/pazpar2 -d -X -l pazpar2.log -f ${srcdir}/${CFG} >extra_pazpar2.log 2>&1 &
56 # Give it a chance to start properly..
59 # Set to success by default.. Will be set to non-zero in case of failure
62 if ps -p $PP2PID >/dev/null 2>&1; then
67 echo "pazpar2 failed to start"
70 # We can start test for real
73 for f in `cat ${srcdir}/${URLS}`; do
74 if echo $f | grep '^http' >/dev/null; then
75 OUT1=${srcdir}/${PREFIX}_${testno}.res
76 OUT2=${PREFIX}_${testno}.log
77 DIFF=${PREFIX}_${testno}.dif
79 if test -n "${postfile}"; then
84 if test ! -f $OUT2; then
87 if test -f $OUT1; then
88 if diff $OUT1 $OUT2 >$DIFF; then
91 echo "Test $testno: Failed. See $OUT1, $OUT2 and $DIFF"
96 echo "Test $testno: Making for the first time"
100 testno=`expr $testno + 1`
102 elif echo $f | grep '^[0-9]' >/dev/null; then
108 echo "File $f does not exist"
112 if ps -p $PP2PID >/dev/null 2>&1; then
116 echo "Test $testno: pazpar2 died"
123 if test -n "$PP2PID"; then