projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Option --perf performs timing of pazpar2 process
[pazpar2-moved-to-github.git]
/
test
/
run_pazpar2.sh
diff --git
a/test/run_pazpar2.sh
b/test/run_pazpar2.sh
index
de6c021
..
20395aa
100755
(executable)
--- a/
test/run_pazpar2.sh
+++ b/
test/run_pazpar2.sh
@@
-9,16
+9,14
@@
# srcdir might be set by make
srcdir=${srcdir:-"."}
# 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()
{
# 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
kill $PP2PID
+ PP2PID=""
fi
if test -f ztest.pid; then
kill `cat ztest.pid`
fi
if test -f ztest.pid; then
kill `cat ztest.pid`
@@
-30,6
+28,7
@@
kill_pazpar2()
fi
}
fi
}
+perf=false
ztest=false
icu=false
while test $# -gt 0; do
ztest=false
icu=false
while test $# -gt 0; do
@@
-44,6
+43,9
@@
while test $# -gt 0; do
--icu)
icu=true
;;
--icu)
icu=true
;;
+ --perf)
+ perf=true
+ ;;
-*)
echo "Bad option $1"
exit 1
-*)
echo "Bad option $1"
exit 1
@@
-87,6
+89,9
@@
if test "$icu" = "true"; then
fi
if test "$ztest" = "true" ; then
fi
if test "$ztest" = "true" ; then
+ YAZ_ZTEST_XML_FETCH=${srcdir}/${PREFIX}.
+ export YAZ_ZTEST_XML_FETCH
+
oIFS=$IFS
IFS=:
F=''
oIFS=$IFS
IFS=:
F=''
@@
-145,18
+150,24
@@
else
sec=1
maxrounds=10
fi
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=$!
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)"
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=$!
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
fi
if [ -z "$SKIP_PAZPAR2" -a -z "$WAIT_PAZPAR2" ] ; then
@@
-183,7
+194,8
@@
code=0
# We can start test for real
testno=1
# 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
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
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
echo "${PREFIX} $testno: Making for the first time"
mv $OUT2 $OUT1
code=1
+ rounds=0
fi
fi
if test $rounds -gt 0; then
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
else
echo "${PREFIX} $testno: pazpar2 died"
fi
- exit 1
+ PP2PID=""
+ code=1
+ break
fi
fi
done
fi
fi
done
@@
-263,15
+278,10
@@
if [ "$WAIT_PAZPAR2" ] ; then
done
echo "done"
fi
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
fi
exit $code