diff --git a/testing/runalltests.sh b/testing/runalltests.sh index 6a3fdc1fd..bcf91e2a8 100755 --- a/testing/runalltests.sh +++ b/testing/runalltests.sh @@ -43,6 +43,19 @@ printf("%.2f", 100.0*('$1'-'$2')/'$2'); }' } +#timesum computes the total cpu time +timesum() { +awk ' BEGIN { +total = 0.0; +} +{ + total += $2; +} +END { + printf("%.2f\n", total); +}' $1 +} + imdir="$1" vid="$2" bindir=${0%/*} @@ -89,8 +102,19 @@ do wdelta=`deltapc $wderrs $oldwerrs` nswdelta=`deltapc $nswderrs $oldnswerrs` sumfile=$rdir/$vid.$set.sum - echo "$vid $set $cherrs $chacc $chdelta% $wderrs $wdacc\ - $wdelta% $nswderrs $nswdacc $nswdelta%" >$sumfile + if [ -r testing/reports/$set.times ] + then + total_time=`timesum testing/reports/$set.times` + if [ -r testing/reports/prev/$set.times ] + then + paste testing/reports/prev/$set.times testing/reports/$set.times | + awk '{ printf("%s %.2f\n", $1, $4-$2); }' |sort -k2n >testing/reports/$set.timedelta + fi + else + total_time='0.0' + fi + echo "$vid $set $cherrs $chacc $chdelta% $wderrs $wdacc\ + $wdelta% $nswderrs $nswdacc $nswdelta% ${total_time}s" >$sumfile # Sum totals over all the testsets. let totalerrs=totalerrs+cherrs let totalwerrs=totalwerrs+wderrs diff --git a/testing/runtestset.sh b/testing/runtestset.sh index b44d51c9e..c71a43ffe 100755 --- a/testing/runtestset.sh +++ b/testing/runtestset.sh @@ -35,7 +35,7 @@ then tess="./tesseract.exe" fi else - tess="ccmain/tesseract" + tess="time -f %U -o times.txt ccmain/tesseract" export TESSDATA_PREFIX=$PWD/ fi @@ -43,9 +43,17 @@ pages=$1 imdir=${pages%/pages} setname=${imdir##*/} -resdir=testing/results/$setname -echo "Testing on set $setname in directory $imdir to $resdir" +if [ $# -eq 2 -a "$2" = "-zoning" ] +then + config=unlv.auto + resdir=testing/results/zoning.$setname +else + config=unlv + resdir=testing/results/$setname +fi +echo -e "Testing on set $setname in directory $imdir to $resdir\n" mkdir -p $resdir +rm -f testing/reports/$setname.times while read page dir do # A pages file may be a list of files with subdirs or maybe just @@ -57,5 +65,15 @@ do srcdir="$imdir" fi # echo "$srcdir/$page.tif" - $tess $srcdir/$page.tif $resdir/$page nobatch unlv + $tess $srcdir/$page.tif $resdir/$page nobatch $config 2>&1 |grep -v "OCR Engine" + if [ -r times.txt ] + then + read t >testing/reports/$setname.times + echo -e "\033M$page $t" + if [ "$t" = "Command terminated by signal 2" ] + then + exit 0 + fi + fi done <$pages