2014-07-09 21:07:06 +00:00
|
|
|
#!/bin/sh
|
2013-10-14 16:47:51 +00:00
|
|
|
|
|
|
|
test "x$srcdir" = x && srcdir=.
|
|
|
|
test "x$builddir" = x && builddir=.
|
|
|
|
test "x$top_builddir" = x && top_builddir=../..
|
|
|
|
|
2013-10-28 19:44:03 +00:00
|
|
|
hb_shape=$top_builddir/util/hb-shape$EXEEXT
|
2013-10-14 16:47:51 +00:00
|
|
|
|
|
|
|
fails=0
|
|
|
|
|
2015-12-25 17:18:02 +00:00
|
|
|
reference=false
|
|
|
|
if test "x$1" = x--reference; then
|
|
|
|
reference=true
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2013-10-14 16:47:51 +00:00
|
|
|
if test $# = 0; then
|
|
|
|
set /dev/stdin
|
|
|
|
fi
|
|
|
|
|
|
|
|
for f in "$@"; do
|
2015-12-25 17:18:02 +00:00
|
|
|
$reference || echo "Running tests in $f"
|
2016-02-24 07:06:23 +00:00
|
|
|
while IFS=: read fontfile options unicodes glyphs_expected; do
|
2016-02-24 06:50:33 +00:00
|
|
|
if echo "$fontfile" | grep -q '^#'; then
|
|
|
|
$reference || echo "Skipping $fontfile:$unicodes"
|
|
|
|
continue
|
|
|
|
fi
|
2015-12-25 17:18:02 +00:00
|
|
|
$reference || echo "Testing $fontfile:$unicodes"
|
2015-07-23 11:14:03 +00:00
|
|
|
glyphs=`$srcdir/hb-unicode-encode "$unicodes" | $hb_shape $options "$srcdir/$fontfile"`
|
|
|
|
if test $? != 0; then
|
|
|
|
echo "hb-shape failed." >&2
|
|
|
|
fails=$((fails+1))
|
|
|
|
continue
|
|
|
|
fi
|
2015-12-25 17:18:02 +00:00
|
|
|
if $reference; then
|
|
|
|
echo "$fontfile:$options:$unicodes:$glyphs"
|
|
|
|
continue
|
|
|
|
fi
|
2013-10-14 16:47:51 +00:00
|
|
|
if ! test "x$glyphs" = "x$glyphs_expected"; then
|
|
|
|
echo "Actual: $glyphs" >&2
|
|
|
|
echo "Expected: $glyphs_expected" >&2
|
2014-07-09 21:07:06 +00:00
|
|
|
fails=$((fails+1))
|
2013-10-14 16:47:51 +00:00
|
|
|
fi
|
|
|
|
done < "$f"
|
|
|
|
done
|
|
|
|
|
|
|
|
if test $fails != 0; then
|
2015-12-25 17:18:02 +00:00
|
|
|
$reference || echo "$fails tests failed."
|
2013-10-14 16:47:51 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2015-12-25 17:18:02 +00:00
|
|
|
$reference || echo "All tests passed."
|
2013-10-14 16:47:51 +00:00
|
|
|
fi
|