tests: add exit value constants for shell script tests

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2015-12-03 11:36:02 +00:00
parent 8a58734c11
commit 02cdd9899d
10 changed files with 35 additions and 29 deletions

View File

@ -3,4 +3,4 @@
SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
. $SOURCE_DIR/drm_lib.sh . $SOURCE_DIR/drm_lib.sh
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -13,4 +13,4 @@ done
# If we got here, we haven't crashed # If we got here, we haven't crashed
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -1,20 +1,26 @@
#!/bin/sh #!/bin/sh
IGT_EXIT_TIMEOUT=78
IGT_EXIT_SKIP=77
IGT_EXIT_SUCCESS=0
IGT_EXIT_INVALID=79
IGT_EXIT_FAILURE=99
# hacked-up long option parsing # hacked-up long option parsing
for arg in $@ ; do for arg in $@ ; do
case $arg in case $arg in
--list-subtests) --list-subtests)
exit 79 exit $IGT_EXIT_INVALID
;; ;;
--run-subtest) --run-subtest)
exit 79 exit $IGT_EXIT_INVALID
;; ;;
--debug) --debug)
IGT_LOG_LEVEL=debug IGT_LOG_LEVEL=debug
;; ;;
--help-description) --help-description)
echo $IGT_TEST_DESCRIPTION echo $IGT_TEST_DESCRIPTION
exit 0 exit $IGT_EXIT_SUCCESS
;; ;;
--help) --help)
echo "Usage: `basename $0` [OPTIONS]" echo "Usage: `basename $0` [OPTIONS]"
@ -23,18 +29,18 @@ for arg in $@ ; do
echo " --debug" echo " --debug"
echo " --help-description" echo " --help-description"
echo " --help" echo " --help"
exit 0 exit $IGT_EXIT_SUCCESS
;; ;;
esac esac
done done
die() { die() {
echo "$@" echo "$@"
exit 1 exit $IGT_EXIT_FAILURE
} }
do_or_die() { do_or_die() {
$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit -1) $@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
} }
if [ -d /debug/dri ] ; then if [ -d /debug/dri ] ; then
@ -63,7 +69,7 @@ if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then
die "ERROR: other drm clients running" die "ERROR: other drm clients running"
fi fi
whoami | grep -q root || ( echo ERROR: not running as root; exit 1 ) whoami | grep -q root || ( echo ERROR: not running as root; exit $IGT_EXIT_FAILURE )
i915_sfs_path= i915_sfs_path=
if [ -d /sys/class/drm ] ; then if [ -d /sys/class/drm ] ; then
@ -76,7 +82,7 @@ fi
function drmtest_skip_on_simulation() function drmtest_skip_on_simulation()
{ {
[ -n "$INTEL_SIMULATION" ] && exit 77 [ -n "$INTEL_SIMULATION" ] && exit $IGT_EXIT_SKIP
} }
drmtest_skip_on_simulation drmtest_skip_on_simulation

View File

@ -6,4 +6,4 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
# read everything we can # read everything we can
cat $i915_dfs_path/* > /dev/null 2>&1 cat $i915_dfs_path/* > /dev/null 2>&1
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -19,20 +19,20 @@ function blt_wait {
function check_for_missed_irq { function check_for_missed_irq {
if test `cat i915_ring_missed_irq` = 0x00000000; then if test `cat i915_ring_missed_irq` = 0x00000000; then
echo "missed interrupts undetected" echo "missed interrupts undetected"
exit 1 exit $IGT_EXIT_FAILURE
fi fi
} }
function check_for_hang { function check_for_hang {
if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
echo "gpu hang reported" echo "gpu hang reported"
exit 2 exit $IGT_EXIT_FAILURE
fi fi
} }
if [ ! -f i915_ring_missed_irq ] ; then if [ ! -f i915_ring_missed_irq ] ; then
echo "kernel doesn't support interrupt masking" echo "kernel doesn't support interrupt masking"
exit 77 exit $IGT_EXIT_SKIP
fi fi
# clear error state first # clear error state first
@ -43,7 +43,7 @@ echo 0xf > i915_ring_test_irq
echo "Interrupts masked" echo "Interrupts masked"
if test `cat i915_ring_test_irq` != 0x0000000f; then if test `cat i915_ring_test_irq` != 0x0000000f; then
echo "Failed to set interrupt mask" echo "Failed to set interrupt mask"
exit 3 exit $IGT_EXIT_FAILURE
fi fi
blt_wait blt_wait
@ -57,7 +57,7 @@ echo 0 > i915_ring_test_irq
echo "Interrupts unmasked" echo "Interrupts unmasked"
if test `cat i915_ring_test_irq` != 0x00000000; then if test `cat i915_ring_test_irq` != 0x00000000; then
echo "Failed to clear interrupt mask" echo "Failed to clear interrupt mask"
exit 3 exit $IGT_EXIT_FAILURE
fi fi
blt_wait blt_wait
@ -67,7 +67,7 @@ echo 0 > i915_ring_missed_irq
echo "Cleared missed interrupts" echo "Cleared missed interrupts"
if test `cat i915_ring_missed_irq` != 0x00000000; then if test `cat i915_ring_missed_irq` != 0x00000000; then
echo "Failed to clear missed interrupts" echo "Failed to clear missed interrupts"
exit 3 exit $IGT_EXIT_FAILURE
fi fi
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -33,7 +33,7 @@ rmmod drm &> /dev/null
if lsmod | grep i915 &> /dev/null ; then if lsmod | grep i915 &> /dev/null ; then
echo WARNING: i915.ko still loaded! echo WARNING: i915.ko still loaded!
exit 1 exit $IGT_EXIT_FAILURE
else else
echo module successfully unloaded echo module successfully unloaded
fi fi
@ -48,13 +48,13 @@ if $SOURCE_DIR/gem_alive > /dev/null ; then
echo "module successfully loaded again" echo "module successfully loaded again"
else else
echo "failed to reload module successfully" echo "failed to reload module successfully"
exit 2 exit $IGT_EXIT_FAILURE
fi fi
# then try to run something # then try to run something
if ! $SOURCE_DIR/gem_linear_blits --run-subtest basic > /dev/null ; then if ! $SOURCE_DIR/gem_linear_blits --run-subtest basic > /dev/null ; then
echo "failed to execute a simple batch after reload" echo "failed to execute a simple batch after reload"
exit 3 exit $IGT_EXIT_FAILURE
fi fi
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -19,7 +19,7 @@ RES=$(((TIME2 - TIME1) / 1000000))
if [ $RES -gt 600 ]; then if [ $RES -gt 600 ]; then
echo "Talking to outputs took ${RES}ms, something is wrong" echo "Talking to outputs took ${RES}ms, something is wrong"
exit 1 exit $IGT_EXIT_FAILURE
fi fi
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -5,7 +5,7 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
if ! find /sys/class/drm/card*/ | grep l3_parity > /dev/null ; then if ! find /sys/class/drm/card*/ | grep l3_parity > /dev/null ; then
echo "no l3_parity interface, skipping test" echo "no l3_parity interface, skipping test"
exit 77 exit $IGT_EXIT_SKIP
fi fi
$SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e
@ -15,7 +15,7 @@ $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -d
disabled=`$SOURCE_DIR/../tools/intel_l3_parity -l | grep -c 'Row 0, Bank 0, Subbank 0 is disabled'` disabled=`$SOURCE_DIR/../tools/intel_l3_parity -l | grep -c 'Row 0, Bank 0, Subbank 0 is disabled'`
if [ "$disabled" != "1" ] ; then if [ "$disabled" != "1" ] ; then
echo "Fail" echo "Fail"
exit 1 exit $IGT_EXIT_FAILURE
fi fi
$SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e
@ -23,5 +23,5 @@ $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e
#Check that we can clear remaps #Check that we can clear remaps
if [ `$SOURCE_DIR/../tools/intel_l3_parity -l | wc -l` != 1 ] ; then if [ `$SOURCE_DIR/../tools/intel_l3_parity -l | wc -l` != 1 ] ; then
echo "Fail 2" echo "Fail 2"
exit 1 exit $IGT_EXIT_FAILURE
fi fi

View File

@ -3,4 +3,4 @@
SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
. $SOURCE_DIR/drm_lib.sh . $SOURCE_DIR/drm_lib.sh
exit 0 exit $IGT_EXIT_SUCCESS

View File

@ -12,5 +12,5 @@ do_or_die "intel_reg_dumper"
# TODO: Add more tests # TODO: Add more tests
exit 0 exit $IGT_EXIT_SUCCESS