run-piglit.sh 2.33 KB
Newer Older
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
#!/bin/sh

set -e

if test "x$XTEST_DIR" = "x"; then
    echo "XTEST_DIR must be set to the directory of the xtest repository."
    # Exit as a "skip" so make check works even without piglit.
    exit 77
fi

if test "x$PIGLIT_DIR" = "x"; then
    echo "PIGLIT_DIR must be set to the directory of the piglit repository."
    # Exit as a "skip" so make check works even without piglit.
    exit 77
fi

if test "x$PIGLIT_RESULTS_DIR" = "x"; then
    echo "PIGLIT_RESULTS_DIR must be set to where to output piglit results."
    # Exit as a real failure because it should always be set.
    exit 1
fi

if test "x$XSERVER_DIR" = "x"; then
    echo "XSERVER_DIR must be set to the directory of the xserver repository."
    # Exit as a real failure because it should always be set.
    exit 1
fi

if test "x$XSERVER_BUILDDIR" = "x"; then
    echo "XSERVER_BUILDDIR must be set to the build directory of the xserver repository."
    # Exit as a real failure because it should always be set.
    exit 1
fi

if test "x$SERVER_COMMAND" = "x"; then
    echo "SERVER_COMMAND must be set to the server to be spawned."
    # Exit as a real failure because it should always be set.
    exit 1
fi

41
$XSERVER_BUILDDIR/test/simple-xinit \
42 43 44 45 46 47 48
    $XSERVER_DIR/test/scripts/xinit-piglit-session.sh \
    -- \
    $SERVER_COMMAND

# Write out piglit-summaries.
SHORT_SUMMARY=$PIGLIT_RESULTS_DIR/summary
LONG_SUMMARY=$PIGLIT_RESULTS_DIR/long-summary
49 50
$PIGLIT_DIR/piglit summary console -s $PIGLIT_RESULTS_DIR > $SHORT_SUMMARY
$PIGLIT_DIR/piglit summary console $PIGLIT_RESULTS_DIR > $LONG_SUMMARY
51 52 53 54 55 56 57

# Write the short summary to make check's log file.
cat $SHORT_SUMMARY

# Parse the piglit summary to decide on our exit status.
status=0
# "pass: 0" would mean no tests actually ran.
58
if grep "^ *pass: *0$" $SHORT_SUMMARY > /dev/null; then
59 60 61
    status=1
fi
# Fails or crashes should be failures from make check's perspective.
62
if ! grep "^ *fail: *0$" $SHORT_SUMMARY > /dev/null; then
63 64
    status=1
fi
65
if ! grep "^ *crash: *0$" $SHORT_SUMMARY > /dev/null; then
66 67 68
    status=1
fi

69
$PIGLIT_DIR/piglit summary html \
70 71 72 73
	--overwrite \
	$PIGLIT_RESULTS_DIR/html \
	$PIGLIT_RESULTS_DIR

74
if test $status != 0; then
75 76 77
    echo "Some piglit tests failed."
    echo "The list of failing tests can be found in $LONG_SUMMARY."
fi
78
echo "An html page of the test status can be found at $PIGLIT_RESULTS_DIR/html/index.html"
79 80

exit $status