tests/hangman: Be lenient towards a non-existent sysfs error state
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 3 Jul 2013 07:00:13 +0000 (08:00 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 3 Jul 2013 07:17:18 +0000 (08:17 +0100)
As /sys/class/drm/cardX/error is a new interface for 3.11, we need to be
quiet when it does not exist or else we upset the automated tests.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66533

tests/ZZ_hangman
tests/drm_lib.sh

index 73ce131..6b310bc 100755 (executable)
@@ -19,22 +19,26 @@ if [ ! -f i915_ring_stop ] ; then
 fi
 
 function check_iface {
-    estate_fname=$1
-    mandatory=$2
+    dir="$1"
+    file="$2"
+    mandatory="$3"
 
-    echo checking ${estate_fname}
+    [ -z "$dir" ] && return
 
-    if [ ! -f $estate_fname ] ; then
+    path="$dir/$file"
+    echo checking ${path}
+
+    if [ ! -f "$path" ] ; then
        if [  $mandatory != 0 ] ; then
-           echo "'${estate_fname}' not found";
+           echo "'${path}' not found";
            exit 1;
        else
-           echo "${estate_fname} not mandatory";
+           echo "${path} not mandatory";
            return;
        fi
     fi
 
-    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+    if cat "$path" | grep -v "no error state collected" > /dev/null ; then
        echo "gpu hang detected"
        exit 2
     fi
@@ -44,7 +48,7 @@ function check_iface {
 
     (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
 
-    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+    if cat "$path" | grep -v "no error state collected" > /dev/null ; then
        echo "gpu hang correctly detected"
     else
        echo "gpu hang not detected"
@@ -52,15 +56,15 @@ function check_iface {
     fi
 
 # clear error state
-    echo > $estate_fname
+    echo > "$path"
 
-    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+    if cat "$path" | 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 0
+check_iface "$i915_dfs_path" i915_error_state 1
+check_iface "$i915_sfs_path" error 0
 
 exit 0
index e0e2664..529cc6b 100755 (executable)
@@ -33,15 +33,11 @@ if [ -d /sys/class/drm ] ; then
     sysfs_path=/sys/class/drm
 fi
 
-i915_sfs_path=x
+i915_sfs_path=
 for dir in `ls $sysfs_path` ; do
     if [ -f $sysfs_path/$dir/error ] ; then
        i915_sfs_path=$sysfs_path/$dir
        break
     fi
 done
-
-if [ $i915_sfs_path = "x" ] ; then
-    echo " i915 sysfs path not found."
-fi
-
+# sysfs may not exist as the 'error' is a new interface in 3.11