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=../..
|
|
|
|
|
2017-08-31 01:45:06 +02:00
|
|
|
hb_shape="$top_builddir/util/hb-shape$EXEEXT --verify"
|
|
|
|
#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
|
2017-09-02 03:28:47 +02:00
|
|
|
$reference || echo "# hb-shape $fontfile --unicodes $unicodes"
|
2016-02-24 07:50:33 +01:00
|
|
|
continue
|
|
|
|
fi
|
2017-09-05 04:48:52 +02:00
|
|
|
$reference || echo "hb-shape $fontfile $options --unicodes $unicodes"
|
|
|
|
glyphs=`$hb_shape "$srcdir/$fontfile" $options --unicodes "$unicodes"`
|
2015-07-23 13:14:03 +02:00
|
|
|
if test $? != 0; then
|
|
|
|
echo "hb-shape failed." >&2
|
|
|
|
fails=$((fails+1))
|
2017-09-05 04:48:52 +02:00
|
|
|
#continue
|
2015-07-23 13:14:03 +02:00
|
|
|
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
|