X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=test%2Frun_pazpar2.sh;h=20395aa0a61782c2e9ad7d9e50a47a79233e2c77;hb=7bc88fffb14f38a6e50c1343df95c18d4faaa81e;hp=de6c021d049187752e6f8c5ffc99ee4376ef3b85;hpb=7895ed928aac63bc69f3ee778d80335fb3c605ed;p=pazpar2-moved-to-github.git diff --git a/test/run_pazpar2.sh b/test/run_pazpar2.sh index de6c021..20395aa 100755 --- a/test/run_pazpar2.sh +++ b/test/run_pazpar2.sh @@ -9,16 +9,14 @@ # srcdir might be set by make srcdir=${srcdir:-"."} -YAZ_ZTEST_XML_FETCH=${srcdir}/ -export YAZ_ZTEST_XML_FETCH - # terminate pazpar2 if test takes more than this (in seconds) WAIT=120 kill_pazpar2() { - if test -n "$PP2PID"; then + if test -z "$SKIP_PAZPAR2" -a -n "$PP2PID"; then kill $PP2PID + PP2PID="" fi if test -f ztest.pid; then kill `cat ztest.pid` @@ -30,6 +28,7 @@ kill_pazpar2() fi } +perf=false ztest=false icu=false while test $# -gt 0; do @@ -44,6 +43,9 @@ while test $# -gt 0; do --icu) icu=true ;; + --perf) + perf=true + ;; -*) echo "Bad option $1" exit 1 @@ -87,6 +89,9 @@ if test "$icu" = "true"; then fi if test "$ztest" = "true" ; then + YAZ_ZTEST_XML_FETCH=${srcdir}/${PREFIX}. + export YAZ_ZTEST_XML_FETCH + oIFS=$IFS IFS=: F='' @@ -145,18 +150,24 @@ else sec=1 maxrounds=10 fi -LEVELS=loglevel,fatal,warn,log,debug,notime,zoom,zoomdetails +LEVELS=loglevel,fatal,warn,log,debug,zoom,zoomdetails if test -n "$PAZPAR2_USE_VALGRIND"; then 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 & PP2PID=$! - sleep 6 + sleep 0.01 WAIT=400 elif test -n "$SKIP_PAZPAR2"; then echo "${PREFIX}: not starting Pazpar2 (should be running already)" +elif $perf; then + /usr/bin/time -p ../src/pazpar2 -p pazpar2.pid -X -l ${PREFIX}_pazpar2.log -f ${srcdir}/${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 & + PP2PID=$! + sleep 1 + if test -f pazpar2.pid; then + PP2PID=`cat pazpar2.pid` + fi else ../src/pazpar2 -v $LEVELS -d -X -l ${PREFIX}_pazpar2.log -f ${srcdir}/${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 & PP2PID=$! - sleep 2 fi if [ -z "$SKIP_PAZPAR2" -a -z "$WAIT_PAZPAR2" ] ; then @@ -183,7 +194,8 @@ code=0 # We can start test for real testno=1 -rounds=1 +# set rounds to "wait" because pazpar2 might not be ready +rounds=$maxrounds for f in `cat ${srcdir}/${URLS}`; do if echo $f | grep '^http' >/dev/null; then OUT1=${srcdir}/${PREFIX}_${testno}.res @@ -216,10 +228,11 @@ for f in `cat ${srcdir}/${URLS}`; do fi fi else - if test $rounds -eq 0; then + if test $testno -eq 1 -o $rounds -eq 0; then echo "${PREFIX} $testno: Making for the first time" mv $OUT2 $OUT1 code=1 + rounds=0 fi fi if test $rounds -gt 0; then @@ -249,7 +262,9 @@ for f in `cat ${srcdir}/${URLS}`; do else echo "${PREFIX} $testno: pazpar2 died" fi - exit 1 + PP2PID="" + code=1 + break fi fi done @@ -263,15 +278,10 @@ if [ "$WAIT_PAZPAR2" ] ; then done echo "done" fi -# Kill programs -if test -f ztest.pid; then - kill `cat ztest.pid` - rm -f ztest.pid -fi - -if [ -z "$SKIP_PAZPAR2" ] ; then - kill_pazpar2 - sleep 2 +kill_pazpar2 +sleep 2 +if $perf; then + tail -3 ${PREFIX}_extra_pazpar2.log fi exit $code