Skip to content

Commit

Permalink
Switch to run-test-ci for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
zuphilip committed May 9, 2017
1 parent 0afd2b5 commit ca63141
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 45 deletions.
48 changes: 12 additions & 36 deletions run-test
@@ -1,39 +1,15 @@
#!/bin/bash -e
BASE=$(dirname $0)

# 'RUNNER' is the binary that the scripts are executed by. It defaults to
# 'python2' if not set in the environment.
# Examples:
# PATH=$PWD:$PATH RUNNER='coverage run --include=$PWD/**/*' ./run-test
# PATH=$PWD:$PATH RUNNER='python3' ./run-test
# See ./run-coverage for a real example.
RUNNER="${RUNNER:-python2}"

test_page() {
set -x
$RUNNER ocropus-nlbin "$BASE/tests/testpage.png" -o temp
$RUNNER ocropus-gpageseg 'temp/????.bin.png'
$RUNNER ocropus-rpred -n 'temp/????/??????.bin.png'
$RUNNER ocropus-hocr 'temp/????.bin.png' -o temp.html
$RUNNER ocropus-visualize-results temp
$RUNNER ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html
set +x
echo "# to see recognition results, type: firefox temp.html"
echo "# to see correction page, type: firefox temp-correction.html"
echo "# to see details on the recognition process, type: firefox temp/index.html"
}

test_conf() {
local TESTIMAGE=0079-01000d
mkdir -p temp
cp "$BASE/tests/$TESTIMAGE"* temp
set -x
$RUNNER ocropus-rpred temp/$TESTIMAGE.png
$RUNNER ocropus-errs temp/$TESTIMAGE.gt.txt
$RUNNER ocropus-econf temp/$TESTIMAGE.gt.txt
}

rm -rf temp
test_page
test_conf
BASE=$(dirname $0)

rm -rf temp
ocropus-nlbin $BASE/tests/testpage.png -o temp
ocropus-gpageseg 'temp/????.bin.png'
ocropus-rpred -n 'temp/????/??????.bin.png'
ocropus-hocr 'temp/????.bin.png' -o temp.html
ocropus-visualize-results temp
ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html

echo "to see recognition results, type: firefox temp.html"
echo "to see correction page, type: firefox temp-correction.html"
echo "to see details on the recognition process, type: firefox temp/index.html"
46 changes: 37 additions & 9 deletions run-test-ci
@@ -1,11 +1,39 @@
#!/bin/bash -e

BASE=$(dirname "$0")

rm -rf temp
ocropus-nlbin "$BASE"/tests/testpage.png -o temp
ocropus-gpageseg 'temp/????.bin.png'
ocropus-rpred --parallel=0 --nocheck 'temp/0001/01000?.bin.png'
ocropus-hocr 'temp/????.bin.png' -o temp.html 2>/dev/null
ocropus-visualize-results temp
ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html
BASE=$(dirname $0)

# 'RUNNER' is the binary that the scripts are executed by. It defaults to
# 'python2' if not set in the environment.
# Other examples:
# PATH=$PWD:$PATH RUNNER='python2 -m coverage run --include=$PWD/**/*' ./run-test
# PATH=$PWD:$PATH RUNNER='python3' ./run-test
# See ./run-coverage for a real example.
RUNNER="${RUNNER:-python2}"

test_page() {
set -x
$RUNNER ocropus-nlbin "$BASE/tests/testpage.png" -o temp
$RUNNER ocropus-gpageseg 'temp/????.bin.png'
$RUNNER ocropus-rpred --parallel=0 --nocheck 'temp/0001/01000?.bin.png'
$RUNNER ocropus-hocr 'temp/????.bin.png' -o temp.html 2>/dev/null
$RUNNER ocropus-visualize-results temp
$RUNNER ocropus-gtedit html temp/????/??????.bin.png -o temp-correction.html
set +x
echo "# to see recognition results, type: firefox temp.html"
echo "# to see correction page, type: firefox temp-correction.html"
echo "# to see details on the recognition process, type: firefox temp/index.html"
}

test_conf() {
local TESTIMAGE=0079-01000d
mkdir -p temp
cp "$BASE/tests/$TESTIMAGE"* temp
set -x
$RUNNER ocropus-rpred temp/$TESTIMAGE.png
$RUNNER ocropus-errs temp/$TESTIMAGE.gt.txt
$RUNNER ocropus-econf temp/$TESTIMAGE.gt.txt
}

rm -rf temp
test_page
test_conf

0 comments on commit ca63141

Please sign in to comment.