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