summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-31 14:18:58 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-31 14:18:58 (GMT)
commitf9924c6636791410d89c2ec015e25de55449de12 (patch)
tree19d8b9c85f8366a6c2ee07e83feb415574fe8cbc
parent041b5493ed4823ad8591b23d3a97f95b77229398 (diff)
downloadlibsvgtiny-f9924c6636791410d89c2ec015e25de55449de12.tar.gz
libsvgtiny-f9924c6636791410d89c2ec015e25de55449de12.tar.bz2
improve test suite runner
-rwxr-xr-xtest/runtest.sh65
1 files changed, 61 insertions, 4 deletions
diff --git a/test/runtest.sh b/test/runtest.sh
index 3cd5e8c..cb5bc47 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -1,20 +1,77 @@
#!/bin/sh
+#
+# run test images through libnssvg and count results
+# This file is part of libsvgtiny
+#
+# Licensed under the MIT License,
+# http://opensource.org/licenses/mit-license.php
+# Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
TEST_PATH=$1
-TEST_OUT=${TEST_PATH}/test
+TEST_OUT=${TEST_PATH}/mvg
+TEST_LOG=${TEST_PATH}/test.log
mkdir -p ${TEST_OUT}
+echo "SVG tests" > ${TEST_LOG}
+
+# svg test directories
+
+# netsurf test svg
+SVGTESTS="test/data/*.svg"
+
svgdecode()
{
OUTF=$(basename ${1} .svg)
- echo "TEST: ${OUTF}"
- ${TEST_PATH}/test_decode_svg ${1} > ${TEST_OUT}/${OUTF}.mvg
+ CMPF=$(dirname ${1})/${OUTF}.mvg
+ echo "SVG:${1}" >> ${TEST_LOG}
+ ${TEST_PATH}/test_decode_svg ${1} 1.0 ${TEST_OUT}/${OUTF}.mvg 2>> ${TEST_LOG}
+ ECODE=$?
+
+ echo "Exit code:${ECODE}" >> ${TEST_LOG}
+ if [ "${ECODE}" -gt 0 ];then
+ return ${ECODE}
+ fi
+
+ if [ -f "${CMPF}" ]; then
+ cmp ${CMPF} ${TEST_OUT}/${OUTF}.ppm >> ${TEST_LOG} 2>> ${TEST_LOG}
+ if [ "$?" -ne 0 ]; then
+ return 128
+ fi
+ fi
+
#convert mvg:${TEST_OUT}/${OUTF}.mvg png:${TEST_OUT}/${OUTF}.png
+
+ return 0
}
+SVGTESTTOTC=0
+SVGTESTPASSC=0
+SVGTESTFAILC=0
+SVGTESTERRC=0
+
+echo "Testing SVG decode"
-for SVG in $(ls test/data/*.svg);do
+for SVG in $(ls ${SVGTESTS});do
+ SVGTESTTOTC=$((SVGTESTTOTC+1))
svgdecode ${SVG}
+ ECODE=$?
+ if [ "${ECODE}" -gt 127 ];then
+ SVGTESTERRC=$((SVGTESTERRC+1))
+ else
+ if [ "${ECODE}" -gt 0 ];then
+ SVGTESTFAILC=$((SVGTESTFAILC+1))
+ else
+ SVGTESTPASSC=$((SVGTESTPASSC+1))
+ fi
+ fi
done
+echo "Tests:${SVGTESTTOTC} Pass:${SVGTESTPASSC} Fail:${SVGTESTFAILC} Error:${SVGTESTERRC}"
+
+# exit code
+if [ "${SVGTESTERRC}" -gt 0 ]; then
+ exit 1
+fi
+
+exit 0