Blame test/shaping/run-tests.sh
|
Packit |
874993 |
#!/bin/sh
|
|
Packit |
874993 |
|
|
Packit |
874993 |
test "x$srcdir" = x && srcdir=.
|
|
Packit |
874993 |
test "x$builddir" = x && builddir=.
|
|
Packit |
874993 |
test "x$top_builddir" = x && top_builddir=../..
|
|
Packit |
874993 |
|
|
Packit |
874993 |
hb_shape=$top_builddir/util/hb-shape$EXEEXT
|
|
Packit |
874993 |
|
|
Packit |
874993 |
fails=0
|
|
Packit |
874993 |
|
|
Packit |
874993 |
reference=false
|
|
Packit |
874993 |
if test "x$1" = x--reference; then
|
|
Packit |
874993 |
reference=true
|
|
Packit |
874993 |
shift
|
|
Packit |
874993 |
fi
|
|
Packit |
874993 |
|
|
Packit |
874993 |
if test $# = 0; then
|
|
Packit |
874993 |
set /dev/stdin
|
|
Packit |
874993 |
fi
|
|
Packit |
874993 |
|
|
Packit |
874993 |
for f in "$@"; do
|
|
Packit |
874993 |
$reference || echo "Running tests in $f"
|
|
Packit |
874993 |
while IFS=: read fontfile options unicodes glyphs_expected; do
|
|
Packit |
874993 |
if echo "$fontfile" | grep -q '^#'; then
|
|
Packit |
874993 |
$reference || echo "Skipping $fontfile:$unicodes"
|
|
Packit |
874993 |
continue
|
|
Packit |
874993 |
fi
|
|
Packit |
874993 |
$reference || echo "Testing $fontfile:$unicodes"
|
|
Packit |
874993 |
glyphs=`$srcdir/hb-unicode-encode "$unicodes" | $hb_shape $options "$srcdir/$fontfile"`
|
|
Packit |
874993 |
if test $? != 0; then
|
|
Packit |
874993 |
echo "hb-shape failed." >&2
|
|
Packit |
874993 |
fails=$((fails+1))
|
|
Packit |
874993 |
continue
|
|
Packit |
874993 |
fi
|
|
Packit |
874993 |
if $reference; then
|
|
Packit |
874993 |
echo "$fontfile:$options:$unicodes:$glyphs"
|
|
Packit |
874993 |
continue
|
|
Packit |
874993 |
fi
|
|
Packit |
874993 |
if ! test "x$glyphs" = "x$glyphs_expected"; then
|
|
Packit |
874993 |
echo "Actual: $glyphs" >&2
|
|
Packit |
874993 |
echo "Expected: $glyphs_expected" >&2
|
|
Packit |
874993 |
fails=$((fails+1))
|
|
Packit |
874993 |
fi
|
|
Packit |
874993 |
done < "$f"
|
|
Packit |
874993 |
done
|
|
Packit |
874993 |
|
|
Packit |
874993 |
if test $fails != 0; then
|
|
Packit |
874993 |
$reference || echo "$fails tests failed."
|
|
Packit |
874993 |
exit 1
|
|
Packit |
874993 |
else
|
|
Packit |
874993 |
$reference || echo "All tests passed."
|
|
Packit |
874993 |
fi
|