From: Adam Dickmeiss Date: Mon, 7 Jul 2014 14:52:30 +0000 (+0200) Subject: test: Pass PERF_PROG rather than option --perf X-Git-Tag: v1.7.1~15^2~2 X-Git-Url: http://jira.indexdata.com/?a=commitdiff_plain;h=5aad7dab52c5cfc82a4232674de5c56fc052ce75;p=pazpar2-moved-to-github.git test: Pass PERF_PROG rather than option --perf --- diff --git a/test/run_pazpar2.sh b/test/run_pazpar2.sh index 34829b9..1f4a94d 100755 --- a/test/run_pazpar2.sh +++ b/test/run_pazpar2.sh @@ -17,6 +17,7 @@ kill_pazpar2() if test -z "$SKIP_PAZPAR2" -a -n "$PP2PID"; then kill $PP2PID PP2PID="" + rm -f pazpar2.pid fi if test -f ztest.pid; then kill `cat ztest.pid` @@ -28,7 +29,6 @@ kill_pazpar2() fi } -perf=false ztest=false icu=false while test $# -gt 0; do @@ -43,9 +43,6 @@ while test $# -gt 0; do --icu) icu=true ;; - --perf) - perf=true - ;; -*) echo "Bad option $1" exit 1 @@ -151,20 +148,21 @@ else maxrounds=10 fi LEVELS=loglevel,fatal,warn,log,debug,zoom,zoomdetails -if test -n "$PAZPAR2_USE_VALGRIND"; then +if test "$PERF_PROG"; then + eval $PERF_PROG ../src/pazpar2 -p pazpar2.pid -X -l ${PREFIX}_pazpar2.log -f ${srcdir}/${CFG} >${PREFIX}_extra_pazpar2.log 2>&1 & + PP2PID=$! + sleep 5 + if test -f pazpar2.pid; then + PP2PID=`cat pazpar2.pid` + echo "Got PID $PP2PID" + fi +elif 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 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=$! @@ -283,7 +281,7 @@ if [ "$WAIT_PAZPAR2" ] ; then fi kill_pazpar2 sleep 2 -if $perf; then +if test "$PERF_PROG"; then tail -3 ${PREFIX}_extra_pazpar2.log fi exit $code diff --git a/test/test_perf.sh b/test/test_perf.sh index bf0e59d..c6fd22c 100755 --- a/test/test_perf.sh +++ b/test/test_perf.sh @@ -4,7 +4,12 @@ TEST=`basename $0 .sh` # srcdir might be set by make srcdir=${srcdir:-"."} -exec ${srcdir}/run_pazpar2.sh --ztest --icu --perf $TEST +if test -z "$PERF_PROG"; then + if test -x /usr/bin/time; then + PERF_PROG="/usr/bin/time -p" + fi +fi +exec ${srcdir}/run_pazpar2.sh --ztest --icu $TEST # Local Variables: # mode:shell-script