File: run-tests.sh

package info (click to toggle)
harfbuzz 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,404 kB
  • ctags: 8,635
  • sloc: cpp: 37,815; sh: 11,976; ansic: 9,840; python: 1,308; xml: 962; makefile: 739
file content (52 lines) | stat: -rwxr-xr-x 1,154 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

test "x$srcdir" = x && srcdir=.
test "x$builddir" = x && builddir=.
test "x$top_builddir" = x && top_builddir=../..

hb_shape=$top_builddir/util/hb-shape$EXEEXT

fails=0

reference=false
if test "x$1" = x--reference; then
	reference=true
	shift
fi

if test $# = 0; then
	set /dev/stdin
fi

for f in "$@"; do
	$reference || echo "Running tests in $f"
	while IFS=: read fontfile options unicodes glyphs_expected; do
		if echo "$fontfile" | grep -q '^#'; then
			$reference || echo "Skipping $fontfile:$unicodes"
			continue
		fi
		$reference || echo "Testing $fontfile:$unicodes"
		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
		if $reference; then
			echo "$fontfile:$options:$unicodes:$glyphs"
			continue
		fi
		if ! test "x$glyphs" = "x$glyphs_expected"; then
			echo "Actual:   $glyphs" >&2
			echo "Expected: $glyphs_expected" >&2
			fails=$((fails+1))
		fi
	done < "$f"
done

if test $fails != 0; then
	$reference || echo "$fails tests failed."
	exit 1
else
	$reference || echo "All tests passed."
fi