blob: eccfc05a6ea133698f4c02011be24194b1272654 (
plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
#!/usr/bin/env bash
if test -z "$G_DEBUG"; then
G_DEBUG=fatal-warnings
else
G_DEBUG="$G_DEBUG,fatal-warnings"
fi
export G_DEBUG
ENVIRONMENT_CONFIG=$1
shift
TEST_BINARY=$1
shift
UNIT_TESTS=$1
shift
. "$ENVIRONMENT_CONFIG"
set +m
LOG=$(mktemp)
trap "" ERR
trap "" SIGABRT
trap "" SIGFPE
trap "" SIGSEGV
EXIT=0
MISSING_FEATURE="WARNING: Missing required feature";
KNOWN_FAILURE="WARNING: Test is known to fail";
echo "Key:"
echo "ok = Test passed"
echo "n/a = Driver is missing a feature required for the test"
echo "FAIL = Unexpected failure"
echo "FIXME = Test failed, but it was an expected failure"
echo "PASS! = Unexpected pass"
echo ""
get_status()
{
case $1 in
# Special value we use to indicate that the test failed
# but it was an expected failure so don't fail the
# overall test run as a result...
300)
echo -n "FIXME";;
# Special value we use to indicate that the test passed
# but we weren't expecting it to pass‽
400)
echo -n 'PASS!';;
# Special value to indicate the test is missing a required feature
500)
echo -n "n/a";;
0)
echo -n "ok";;
*)
echo -n "FAIL";;
esac
}
run_test()
{
$("$TEST_BINARY" "$1" &> "$LOG")
TMP=$?
var_name=$2_result
eval "$var_name=$TMP"
if grep -q "$MISSING_FEATURE" "$LOG"; then
if test "$TMP" -ne 0; then
eval "$var_name=500"
else
eval "$var_name=400"
fi
elif grep -q "$KNOWN_FAILURE" "$LOG"; then
if test $TMP -ne 0; then
eval "$var_name=300"
else
eval "$var_name=400"
fi
else
if test "$TMP" -ne 0; then EXIT=$TMP; fi
fi
}
TITLE_FORMAT="%35s"
printf "$TITLE_FORMAT" "Test"
if test "$HAVE_GL" -eq 1; then
GL_FORMAT=" %6s %8s %7s %6s"
printf "$GL_FORMAT" "GL+GLSL" "GL3"
fi
if test "$HAVE_GLES2" -eq 1; then
GLES2_FORMAT=" %6s"
printf "$GLES2_FORMAT" "ES2"
fi
echo ""
echo ""
if [ -z "$UNIT_TESTS" ]; then
echo Missing unit-tests file or names
exit 1
fi
if [ -f "$UNIT_TESTS" ]; then
UNIT_TESTS="$(cat $UNIT_TESTS)"
fi
for test in $UNIT_TESTS
do
export COGL_DEBUG=
if test "$HAVE_GL" -eq 1; then
export COGL_DRIVER=gl
# NB: we can't explicitly disable fixed + glsl in this case since
# the arbfp code only supports fragment processing so we need either
# the fixed or glsl vertends
export COGL_DEBUG=
run_test "$test" gl_arbfp
export COGL_DRIVER=gl
export COGL_DEBUG=disable-fixed,disable-arbfp
run_test "$test" gl_glsl
export COGL_DRIVER=gl3
export COGL_DEBUG=
run_test "$test" gl3
fi
if test "$HAVE_GLES2" -eq 1; then
export COGL_DRIVER=gles2
export COGL_DEBUG=
run_test "$test" gles2
fi
printf $TITLE_FORMAT "$test:"
if test "$HAVE_GL" -eq 1; then
printf "$GL_FORMAT" \
"$(get_status "$gl_glsl_result")" \
"$(get_status "$gl3_result")"
fi
if test "$HAVE_GLES2" -eq 1; then
printf "$GLES2_FORMAT" \
"$(get_status "$gles2_result")"
fi
echo ""
done
rm "$LOG"
exit "$EXIT"
|