2012-02-23 12:30:51 +00:00
|
|
|
#!/bin/bash
|
2011-05-05 22:34:38 +00:00
|
|
|
|
2013-06-20 17:24:58 +00:00
|
|
|
if test -z "$G_DEBUG"; then
|
|
|
|
G_DEBUG=fatal-warnings
|
|
|
|
else
|
|
|
|
G_DEBUG="$G_DEBUG,fatal-warnings"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export G_DEBUG
|
|
|
|
|
2013-05-30 12:22:22 +00:00
|
|
|
ENVIRONMENT_CONFIG=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
TEST_BINARY=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
. $ENVIRONMENT_CONFIG
|
2011-05-05 22:34:38 +00:00
|
|
|
|
2012-02-23 12:30:51 +00:00
|
|
|
set +m
|
|
|
|
|
|
|
|
trap "" ERR
|
|
|
|
trap "" SIGABRT
|
|
|
|
trap "" SIGFPE
|
|
|
|
trap "" SIGSEGV
|
|
|
|
|
|
|
|
EXIT=0
|
2012-11-09 16:47:01 +00:00
|
|
|
MISSING_FEATURE="WARNING: Missing required feature";
|
|
|
|
KNOWN_FAILURE="WARNING: Test is known to fail";
|
2012-02-23 12:30:51 +00:00
|
|
|
|
|
|
|
echo "Key:"
|
|
|
|
echo "ok = Test passed"
|
2012-11-09 16:47:01 +00:00
|
|
|
echo "n/a = Driver is missing a feature required for the test"
|
2012-02-23 12:30:51 +00:00
|
|
|
echo "FAIL = Unexpected failure"
|
2013-09-02 13:26:03 +00:00
|
|
|
echo "FIXME = Test failed, but it was an expected failure"
|
2012-02-23 12:30:51 +00:00
|
|
|
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)
|
2013-09-02 13:26:03 +00:00
|
|
|
echo -n "FIXME";;
|
2012-02-23 12:30:51 +00:00
|
|
|
# Special value we use to indicate that the test passed
|
|
|
|
# but we weren't expecting it to pass‽
|
|
|
|
400)
|
|
|
|
echo -n 'PASS!';;
|
|
|
|
|
2012-11-09 16:47:01 +00:00
|
|
|
# Special value to indicate the test is missing a required feature
|
|
|
|
500)
|
|
|
|
echo -n "n/a";;
|
|
|
|
|
2012-02-23 12:30:51 +00:00
|
|
|
0)
|
|
|
|
echo -n "ok";;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo -n "FAIL";;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
run_test()
|
|
|
|
{
|
2013-05-30 12:22:22 +00:00
|
|
|
$($TEST_BINARY $1 &>.log)
|
2012-02-23 12:30:51 +00:00
|
|
|
TMP=$?
|
|
|
|
var_name=$2_result
|
|
|
|
eval $var_name=$TMP
|
2012-11-09 16:47:01 +00:00
|
|
|
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
|
2012-02-23 12:30:51 +00:00
|
|
|
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
|
2012-09-26 19:32:36 +00:00
|
|
|
GL_FORMAT=" %6s %8s %7s %6s %6s"
|
|
|
|
printf "$GL_FORMAT" "GL+FF" "GL+ARBFP" "GL+GLSL" "GL-NPT" "GL3"
|
2012-02-23 12:30:51 +00:00
|
|
|
fi
|
|
|
|
if test $HAVE_GLES2 -eq 1; then
|
|
|
|
GLES2_FORMAT=" %6s %7s"
|
|
|
|
printf "$GLES2_FORMAT" "ES2" "ES2-NPT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
for test in `cat unit-tests`
|
2011-05-05 22:34:38 +00:00
|
|
|
do
|
2012-02-23 12:30:51 +00:00
|
|
|
export COGL_DEBUG=
|
|
|
|
|
|
|
|
if test $HAVE_GL -eq 1; then
|
|
|
|
export COGL_DRIVER=gl
|
|
|
|
export COGL_DEBUG=disable-glsl,disable-arbfp
|
|
|
|
run_test $test gl_ff
|
|
|
|
|
|
|
|
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=gl
|
|
|
|
export COGL_DEBUG=disable-npot-textures
|
|
|
|
run_test $test gl_npot
|
2012-09-26 19:32:36 +00:00
|
|
|
|
|
|
|
export COGL_DRIVER=gl3
|
|
|
|
export COGL_DEBUG=
|
|
|
|
run_test $test gl3
|
2012-02-23 12:30:51 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test $HAVE_GLES2 -eq 1; then
|
|
|
|
export COGL_DRIVER=gles2
|
|
|
|
export COGL_DEBUG=
|
|
|
|
run_test $test gles2
|
|
|
|
|
|
|
|
export COGL_DRIVER=gles2
|
|
|
|
export COGL_DEBUG=disable-npot-textures
|
|
|
|
run_test $test gles2_npot
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf $TITLE_FORMAT "$test:"
|
|
|
|
if test $HAVE_GL -eq 1; then
|
|
|
|
printf "$GL_FORMAT" \
|
|
|
|
"`get_status $gl_ff_result`" \
|
|
|
|
"`get_status $gl_arbfp_result`" \
|
|
|
|
"`get_status $gl_glsl_result`" \
|
2012-09-26 19:32:36 +00:00
|
|
|
"`get_status $gl_npot_result`" \
|
|
|
|
"`get_status $gl3_result`"
|
2012-02-23 12:30:51 +00:00
|
|
|
fi
|
|
|
|
if test $HAVE_GLES2 -eq 1; then
|
|
|
|
printf "$GLES2_FORMAT" \
|
|
|
|
"`get_status $gles2_result`" \
|
|
|
|
"`get_status $gles2_npot_result`"
|
|
|
|
fi
|
|
|
|
echo ""
|
2011-05-05 22:34:38 +00:00
|
|
|
done
|
|
|
|
|
2012-02-23 12:30:51 +00:00
|
|
|
exit $EXIT
|