run-piglit.sh revision 1b5d61b8
1#!/bin/sh
2
3set -e
4
5if 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
9fi
10
11if 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
15fi
16
17if 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
21fi
22
23if 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
27fi
28
29if 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
33fi
34
35if 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
39fi
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.
47SHORT_SUMMARY=$PIGLIT_RESULTS_DIR/summary
48LONG_SUMMARY=$PIGLIT_RESULTS_DIR/long-summary
49$PIGLIT_DIR/piglit-summary.py -s $PIGLIT_RESULTS_DIR > $SHORT_SUMMARY
50$PIGLIT_DIR/piglit-summary.py $PIGLIT_RESULTS_DIR > $LONG_SUMMARY
51
52# Write the short summary to make check's log file.
53cat $SHORT_SUMMARY
54
55# Parse the piglit summary to decide on our exit status.
56status=0
57# "pass: 0" would mean no tests actually ran.
58if grep "^ *pass: *0$" $SHORT_SUMMARY > /dev/null; then
59    status=1
60fi
61# Fails or crashes should be failures from make check's perspective.
62if ! grep "^ *fail: *0$" $SHORT_SUMMARY > /dev/null; then
63    status=1
64fi
65if ! grep "^ *crash: *0$" $SHORT_SUMMARY > /dev/null; then
66    status=1
67fi
68
69$PIGLIT_DIR/piglit-summary-html.py \
70	--overwrite \
71	$PIGLIT_RESULTS_DIR/html \
72	$PIGLIT_RESULTS_DIR
73
74if test $status != 0; then
75    echo "Some piglit tests failed."
76    echo "The list of failing tests can be found in $LONG_SUMMARY."
77fi
78echo "An html page of the test status can be found at $PIGLIT_RESULTS_DIR/html/index.html"
79
80exit $status
81