Re: [PATCH i-g-t] tests: add exit value constants for shell script tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 03, 2015 at 11:30:53AM +0000, Thomas Wood wrote:
> Signed-off-by: Thomas Wood <thomas.wood@xxxxxxxxx>

Yeah that's nicer. I fixed up patch 2 to use the correct exit code and
push the entire series. Thanks for the feedback!

Cheers, Daniel
> ---
>  tests/check_drm_clients       |  2 +-
>  tests/debugfs_emon_crash      |  2 +-
>  tests/drm_lib.sh              | 22 ++++++++++++++--------
>  tests/drv_debugfs_reader      |  2 +-
>  tests/drv_missed_irq_hang     | 14 +++++++-------
>  tests/drv_module_reload_basic |  8 ++++----
>  tests/kms_sysfs_edid_timing   |  4 ++--
>  tests/sysfs_l3_parity         |  6 +++---
>  tests/test_rte_check          |  2 +-
>  tests/tools_test              |  2 +-
>  10 files changed, 35 insertions(+), 29 deletions(-)
> 
> diff --git a/tests/check_drm_clients b/tests/check_drm_clients
> index eb12416..2a891b8 100755
> --- a/tests/check_drm_clients
> +++ b/tests/check_drm_clients
> @@ -3,4 +3,4 @@
>  SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
>  . $SOURCE_DIR/drm_lib.sh
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/debugfs_emon_crash b/tests/debugfs_emon_crash
> index 809bfab..1dbfcb2 100755
> --- a/tests/debugfs_emon_crash
> +++ b/tests/debugfs_emon_crash
> @@ -13,4 +13,4 @@ done
>  
>  # If we got here, we haven't crashed
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh
> index c50664c..d2c6420 100755
> --- a/tests/drm_lib.sh
> +++ b/tests/drm_lib.sh
> @@ -1,20 +1,26 @@
>  #!/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
>  for arg in $@ ; do
>  	case $arg in
>  		--list-subtests)
> -			exit 79
> +			exit $IGT_EXIT_INVALID
>  			;;
>  		--run-subtest)
> -			exit 79
> +			exit $IGT_EXIT_INVALID
>  			;;
>  		--debug)
>  			IGT_LOG_LEVEL=debug
>  			;;
>  		--help-description)
>  			echo $IGT_TEST_DESCRIPTION
> -			exit 0
> +			exit $IGT_EXIT_SUCCESS
>  			;;
>  		--help)
>  			echo "Usage: `basename $0` [OPTIONS]"
> @@ -23,18 +29,18 @@ for arg in $@ ; do
>  			echo "  --debug"
>  			echo "  --help-description"
>  			echo "  --help"
> -			exit 0
> +			exit $IGT_EXIT_SUCCESS
>  			;;
>  	esac
>  done
>  
>  die() {
>  	echo "$@"
> -	exit 1
> +	exit $IGT_EXIT_FAILURE
>  }
>  
>  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
> @@ -63,7 +69,7 @@ if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then
>  		die "ERROR: other drm clients running"
>  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=
>  if [ -d /sys/class/drm ] ; then
> @@ -76,7 +82,7 @@ fi
>  
>  function drmtest_skip_on_simulation()
>  {
> -	[ -n "$INTEL_SIMULATION" ] && exit 77
> +	[ -n "$INTEL_SIMULATION" ] && exit $IGT_EXIT_SKIP
>  }
>  
>  drmtest_skip_on_simulation
> diff --git a/tests/drv_debugfs_reader b/tests/drv_debugfs_reader
> index 9e2845e..6ea4e64 100755
> --- a/tests/drv_debugfs_reader
> +++ b/tests/drv_debugfs_reader
> @@ -6,4 +6,4 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
>  # read everything we can
>  cat $i915_dfs_path/* > /dev/null 2>&1
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/drv_missed_irq_hang b/tests/drv_missed_irq_hang
> index 6e8cfc2..8083fe5 100755
> --- a/tests/drv_missed_irq_hang
> +++ b/tests/drv_missed_irq_hang
> @@ -19,20 +19,20 @@ function blt_wait {
>  function check_for_missed_irq {
>  	if test `cat i915_ring_missed_irq` = 0x00000000; then
>  		echo "missed interrupts undetected"
> -		exit 1
> +		exit $IGT_EXIT_FAILURE
>  	fi
>  }
>  
>  function check_for_hang {
>  	if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
>  		echo "gpu hang reported"
> -		exit 2
> +		exit $IGT_EXIT_FAILURE
>  	fi
>  }
>  
>  if [ ! -f i915_ring_missed_irq ] ; then
>  	echo "kernel doesn't support interrupt masking"
> -	exit 77
> +	exit $IGT_EXIT_SKIP
>  fi
>  
>  # clear error state first
> @@ -43,7 +43,7 @@ echo 0xf > i915_ring_test_irq
>  echo "Interrupts masked"
>  if test `cat i915_ring_test_irq` != 0x0000000f; then
>  	echo "Failed to set interrupt mask"
> -	exit 3
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
>  blt_wait
> @@ -57,7 +57,7 @@ echo 0 > i915_ring_test_irq
>  echo "Interrupts unmasked"
>  if test `cat i915_ring_test_irq` != 0x00000000; then
>  	echo "Failed to clear interrupt mask"
> -	exit 3
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
>  blt_wait
> @@ -67,7 +67,7 @@ echo 0 > i915_ring_missed_irq
>  echo "Cleared missed interrupts"
>  if test `cat i915_ring_missed_irq` != 0x00000000; then
>  	echo "Failed to clear missed interrupts"
> -	exit 3
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic
> index ec1bae8..43c511b 100755
> --- a/tests/drv_module_reload_basic
> +++ b/tests/drv_module_reload_basic
> @@ -33,7 +33,7 @@ rmmod drm &> /dev/null
>  
>  if lsmod | grep i915 &> /dev/null ; then
>  	echo WARNING: i915.ko still loaded!
> -	exit 1
> +	exit $IGT_EXIT_FAILURE
>  else
>  	echo module successfully unloaded
>  fi
> @@ -48,13 +48,13 @@ if $SOURCE_DIR/gem_alive > /dev/null ; then
>  	echo "module successfully loaded again"
>  else
>  	echo "failed to reload module successfully"
> -	exit 2
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
>  # then try to run something
>  if ! $SOURCE_DIR/gem_linear_blits --run-subtest basic > /dev/null ; then
>  	echo "failed to execute a simple batch after reload"
> -	exit 3
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/kms_sysfs_edid_timing b/tests/kms_sysfs_edid_timing
> index ec704f6..46ea540 100755
> --- a/tests/kms_sysfs_edid_timing
> +++ b/tests/kms_sysfs_edid_timing
> @@ -19,7 +19,7 @@ RES=$(((TIME2 - TIME1) / 1000000))
>  
>  if [ $RES -gt 600 ]; then
>  	echo "Talking to outputs took ${RES}ms, something is wrong"
> -	exit 1
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/sysfs_l3_parity b/tests/sysfs_l3_parity
> index 9bd1724..6f14b84 100755
> --- a/tests/sysfs_l3_parity
> +++ b/tests/sysfs_l3_parity
> @@ -5,7 +5,7 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
>  
>  if ! find /sys/class/drm/card*/ | grep l3_parity > /dev/null ; then
>  	echo "no l3_parity interface, skipping test"
> -	exit 77
> +	exit $IGT_EXIT_SKIP
>  fi
>  
>  $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'`
>  if [ "$disabled" != "1" ] ; then
>  	echo "Fail"
> -	exit 1
> +	exit $IGT_EXIT_FAILURE
>  fi
>  
>  $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
>  if [ `$SOURCE_DIR/../tools/intel_l3_parity -l | wc -l` != 1 ] ; then
>  	echo "Fail 2"
> -	exit 1
> +	exit $IGT_EXIT_FAILURE
>  fi
> diff --git a/tests/test_rte_check b/tests/test_rte_check
> index eb12416..2a891b8 100755
> --- a/tests/test_rte_check
> +++ b/tests/test_rte_check
> @@ -3,4 +3,4 @@
>  SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
>  . $SOURCE_DIR/drm_lib.sh
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
> diff --git a/tests/tools_test b/tests/tools_test
> index a6178e1..0487827 100755
> --- a/tests/tools_test
> +++ b/tests/tools_test
> @@ -12,5 +12,5 @@ do_or_die "intel_reg_dumper"
>  
>  # TODO: Add more tests
>  
> -exit 0
> +exit $IGT_EXIT_SUCCESS
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux