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 # terminate pazpar2 if test takes more than this (in seconds)
17 if test -n "$PP2PID"; then
20 if test -n "$SLEEP_PID"; then
27 if test "x${PREFIX}" = "x"; then
28 echo Missing prefix for run_pazpar2.sh
32 # look for curl in PATH
37 if test -x $p/curl; then
44 if test -z $curl; then
45 echo "curl not found. $PREFIX can not be tested"
48 GET='$curl --silent --output $OUT2 "$f"'
49 POST='$curl --silent --header "Content-Type: text/xml" --data-binary "@$postfile" --output $OUT2 "$f"'
51 if [ -z "$SKIP_PAZPAR2" ] ; then
52 # remove log if starting pazpar2
53 rm -f ${PREFIX}_pazpar2.log
58 VALGRINDLOG=${PREFIX}_valgrind.log
60 if test `uname` = "Linux"; then
67 LEVELS=loglevel,fatal,warn,log,debug,notime,zoom,zoomdetails
68 if test -n "$PAZPAR2_USE_VALGRIND"; then
69 valgrind --num-callers=30 --show-reachable=yes --leak-check=full --log-file=$VALGRINDLOG ../src/pazpar2 -v $LEVELS -X -l ${PREFIX}_pazpar2.log -f ${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 &
72 elif test -n "$SKIP_PAZPAR2"; then
73 echo "Skipping pazpar2. Must already be running with correct config!!! "
75 ../src/pazpar2 -v $LEVELS -d -X -l ${PREFIX}_pazpar2.log -f ${srcdir}/${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 &
80 if [ -z "$SKIP_PAZPAR2" -a -z "$WAIT_PAZPAR2" ] ; then
81 if ps -p $PP2PID >/dev/null 2>&1; then
82 (sleep $WAIT; kill_pazpar2 >/dev/null) &
87 echo "pazpar2 failed to start"
92 # Set to success by default.. Will be set to non-zero in case of failure
95 # We can start test for real
98 for f in `cat ${srcdir}/${URLS}`; do
99 if echo $f | grep '^http' >/dev/null; then
100 OUT1=${srcdir}/${PREFIX}_${testno}.res
101 OUT2=${PREFIX}_${testno}.log
102 DIFF=${PREFIX}_${testno}.dif
104 if [ -n "$DEBUG" ] ; then
105 echo "test $testno: $f"
107 while test $rounds -gt 0; do
108 if test -n "${postfile}"; then
113 if test ! -f $OUT2; then
116 rounds=`expr $rounds - 1`
117 if test -f $OUT1 -a -z "$PAZPAR2_OVERRIDE_TEST"; then
118 if diff $OUT1 $OUT2 >$DIFF; then
123 if test $rounds -eq 0; then
124 echo "Test $testno: Failed. See $OUT1, $OUT2 and $DIFF"
130 if test $rounds -eq 0; then
131 echo "Test $testno: Making for the first time"
136 if test $rounds -gt 0; then
140 testno=`expr $testno + 1`
143 elif echo $f | grep '^[0-9]' >/dev/null; then
146 if test -f $srcdir/$f; then
149 echo "File $f does not exist"
153 if [ -z "$SKIP_PAZPAR2" ] ; then
154 if ps -p $PP2PID >/dev/null 2>&1; then
158 if test -n "$SLEEP_PID"; then
159 echo "Test $testno: pazpar2 terminated (timeout, probably)"
161 echo "Test $testno: pazpar2 died"
168 if [ "$WAIT_PAZPAR2" ] ; then
170 while test $i -lt $WAIT_PAZPAR2; do
180 if [ -z "$SKIP_PAZPAR2" ] ; then