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 -n "$PAZPAR2_USE_VALGRIND"; then
61 valgrind --num-callers=30 --show-reachable=yes --leak-check=full --log-file=$VALGRINDLOG ../src/pazpar2 -X -l ${PREFIX}_pazpar2.log -f ${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 &
62 elif test -n "$SKIP_PAZPAR2"; then
63 echo "Skipping pazpar2. Must already be running with correct config!!! "
65 YAZ_LOG=zoom,zoomdetails,debug,log,fatal ../src/pazpar2 -v loglevel,fatal,warn,log,debug,notime,zoom,zoomdetails -d -X -l ${PREFIX}_pazpar2.log -f ${srcdir}/${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 &
70 if [ -z "$SKIP_PAZPAR2" ] ; then
71 if ps -p $PP2PID >/dev/null 2>&1; then
72 (sleep $WAIT; kill_pazpar2 >/dev/null) &
78 echo "pazpar2 failed to start"
83 # Set to success by default.. Will be set to non-zero in case of failure
86 # We can start test for real
88 for f in `cat ${srcdir}/${URLS}`; do
89 if echo $f | grep '^http' >/dev/null; then
90 OUT1=${srcdir}/${PREFIX}_${testno}.res
91 OUT2=${PREFIX}_${testno}.log
92 DIFF=${PREFIX}_${testno}.dif
94 if [ -n "$DEBUG" ] ; then
95 echo "test $testno: $f"
97 if test -n "${postfile}"; then
102 if test ! -f $OUT2; then
105 if test -f $OUT1 -a -z "$PAZPAR2_OVERRIDE_TEST"; then
106 if diff $OUT1 $OUT2 >$DIFF; then
109 echo "Test $testno: Failed. See $OUT1, $OUT2 and $DIFF"
114 echo "Test $testno: Making for the first time"
118 testno=`expr $testno + 1`
120 elif echo $f | grep '^[0-9]' >/dev/null; then
121 if [ -n "$DEBUG" ] ; then
126 if test -f $srcdir/$f; then
129 echo "File $f does not exist"
133 if [ -z "$SKIP_PAZPAR2" ] ; then
134 if ps -p $PP2PID >/dev/null 2>&1; then
138 if test -n "$SLEEP_PID"; then
139 echo "Test $testno: pazpar2 terminated (timeout, probably)"
141 echo "Test $testno: pazpar2 died"
150 if [ -z "$SKIP_PAZPAR2" ] ; then