diff mbox

[3/3] tests/ZZ_hangman: Test both error_state interfaces

Message ID 1372419341-5858-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala June 28, 2013, 11:35 a.m. UTC
Test both debugfs and sysfs error_state interfaces.

v2: sysfs error_state not mandatory

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 tests/ZZ_hangman |   52 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 38 insertions(+), 14 deletions(-)

Comments

Daniel Vetter July 1, 2013, 4:56 p.m. UTC | #1
On Fri, Jun 28, 2013 at 02:35:41PM +0300, Mika Kuoppala wrote:
> Test both debugfs and sysfs error_state interfaces.
> 
> v2: sysfs error_state not mandatory
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>

Series merged with Chris' s/error_state/error/ bikeshed applied, thanks.
-Daniel

> ---
>  tests/ZZ_hangman |   52 ++++++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 38 insertions(+), 14 deletions(-)
> 
> diff --git a/tests/ZZ_hangman b/tests/ZZ_hangman
> index 08c5514..4db3823 100755
> --- a/tests/ZZ_hangman
> +++ b/tests/ZZ_hangman
> @@ -18,25 +18,49 @@ if [ ! -f i915_ring_stop ] ; then
>  	exit 77
>  fi
>  
> -if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
> -	echo "gpu hang dectected"
> -	exit 1
> -fi
> +function check_iface {
> +    estate_fname=$1
> +    mandatory=$2
>  
> -# stop rings
> -echo 0xf > i915_ring_stop
> -echo "rings stopped"
> +    echo checking ${estate_fname}
>  
> -(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
> +    if [ ! -f $estate_fname ] ; then
> +	if [  $mandatory != 0 ] ; then
> +	    echo "'${estate_fname}' not found";
> +	    exit 1;
> +	else
> +	    echo "${estate_fname} not mandatory";
> +	    return;
> +	fi
> +    fi
>  
> -if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
> -	echo "gpu hang correctly dectected"
> -else
> -	echo "gpu hang not dectected"
> +    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
> +	echo "gpu hang detected"
>  	exit 2
> -fi
> +    fi
> +
> +    echo 0xf > i915_ring_stop
> +    echo "rings stopped"
> +
> +    (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
> +
> +    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
> +	echo "gpu hang correctly detected"
> +    else
> +	echo "gpu hang not detected"
> +	exit 3
> +    fi
>  
>  # clear error state
> -echo > i915_error_state
> +    echo > $estate_fname
> +
> +    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
> +	echo "gpu hang still present"
> +	exit 4
> +    fi
> +}
> +
> +check_iface $i915_dfs_path/i915_error_state 1
> +check_iface $i915_sfs_path/error_state 0
>  
>  exit 0
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/ZZ_hangman b/tests/ZZ_hangman
index 08c5514..4db3823 100755
--- a/tests/ZZ_hangman
+++ b/tests/ZZ_hangman
@@ -18,25 +18,49 @@  if [ ! -f i915_ring_stop ] ; then
 	exit 77
 fi
 
-if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
-	echo "gpu hang dectected"
-	exit 1
-fi
+function check_iface {
+    estate_fname=$1
+    mandatory=$2
 
-# stop rings
-echo 0xf > i915_ring_stop
-echo "rings stopped"
+    echo checking ${estate_fname}
 
-(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+    if [ ! -f $estate_fname ] ; then
+	if [  $mandatory != 0 ] ; then
+	    echo "'${estate_fname}' not found";
+	    exit 1;
+	else
+	    echo "${estate_fname} not mandatory";
+	    return;
+	fi
+    fi
 
-if cat i915_error_state | grep -v "no error state collected" > /dev/null ; then
-	echo "gpu hang correctly dectected"
-else
-	echo "gpu hang not dectected"
+    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+	echo "gpu hang detected"
 	exit 2
-fi
+    fi
+
+    echo 0xf > i915_ring_stop
+    echo "rings stopped"
+
+    (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+
+    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+	echo "gpu hang correctly detected"
+    else
+	echo "gpu hang not detected"
+	exit 3
+    fi
 
 # clear error state
-echo > i915_error_state
+    echo > $estate_fname
+
+    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+	echo "gpu hang still present"
+	exit 4
+    fi
+}
+
+check_iface $i915_dfs_path/i915_error_state 1
+check_iface $i915_sfs_path/error_state 0
 
 exit 0