Debian Codegraph @

test/scripts/run-piglit.sh

raw
1 #!/bin/sh
2
3 set -e
4
5 if test "x$XTEST_DIR" = "x"; then
6 echo "XTEST_DIR must be set to the directory of the xtest repository."
7 # Exit as a "skip" so make check works even without piglit.
8 exit 77
9 fi
10
11 if test "x$PIGLIT_DIR" = "x"; then
12 echo "PIGLIT_DIR must be set to the directory of the piglit repository."
13 # Exit as a "skip" so make check works even without piglit.
14 exit 77
15 fi
16
17 if test "x$PIGLIT_RESULTS_DIR" = "x"; then
18 echo "PIGLIT_RESULTS_DIR must be set to where to output piglit results."
19 # Exit as a real failure because it should always be set.
20 exit 1
21 fi
22
23 if test "x$XSERVER_DIR" = "x"; then
24 echo "XSERVER_DIR must be set to the directory of the xserver repository."
25 # Exit as a real failure because it should always be set.
26 exit 1
27 fi
28
29 if test "x$XSERVER_BUILDDIR" = "x"; then
30 echo "XSERVER_BUILDDIR must be set to the build directory of the xserver repository."
31 # Exit as a real failure because it should always be set.
32 exit 1
33 fi
34
35 if test "x$SERVER_COMMAND" = "x"; then
36 echo "SERVER_COMMAND must be set to the server to be spawned."
37 # Exit as a real failure because it should always be set.
38 exit 1
39 fi
40
41 $XSERVER_BUILDDIR/test/simple-xinit \
42 $XSERVER_DIR/test/scripts/xinit-piglit-session.sh \
43 -- \
44 $SERVER_COMMAND
45
46 # Write out piglit-summaries.
47 SHORT_SUMMARY=$PIGLIT_RESULTS_DIR/summary
48 LONG_SUMMARY=$PIGLIT_RESULTS_DIR/long-summary
49 $PIGLIT_DIR/piglit summary console -s $PIGLIT_RESULTS_DIR > $SHORT_SUMMARY
50 $PIGLIT_DIR/piglit summary console $PIGLIT_RESULTS_DIR > $LONG_SUMMARY
51
52 # Write the short summary to make check's log file.
53 cat $SHORT_SUMMARY
54
55 # Parse the piglit summary to decide on our exit status.
56 status=0
57 # "pass: 0" would mean no tests actually ran.
58 if grep "^ *pass: *0$" $SHORT_SUMMARY > /dev/null; then
59 status=1
60 fi
61 # Fails or crashes should be failures from make check's perspective.
62 if ! grep "^ *fail: *0$" $SHORT_SUMMARY > /dev/null; then
63 status=1
64 fi
65 if ! grep "^ *crash: *0$" $SHORT_SUMMARY > /dev/null; then
66 status=1
67 fi
68
69 $PIGLIT_DIR/piglit summary html \
70 --overwrite \
71 $PIGLIT_RESULTS_DIR/html \
72 $PIGLIT_RESULTS_DIR
73
74 if test $status != 0; then
75 echo "Some piglit tests failed."
76 echo "The list of failing tests can be found in $LONG_SUMMARY."
77 fi
78 echo "An html page of the test status can be found at $PIGLIT_RESULTS_DIR/html/index.html"
79
80 exit $status