From e50ae9596c544c3cca0f32c5eba94c655a1ebcd2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 3 Jul 2013 08:00:13 +0100 Subject: [PATCH] tests/hangman: Be lenient towards a non-existent sysfs error state 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 | 28 ++++++++++++++++------------ tests/drm_lib.sh | 8 ++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/ZZ_hangman b/tests/ZZ_hangman index 73ce131..6b310bc 100755 --- a/tests/ZZ_hangman +++ b/tests/ZZ_hangman @@ -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 diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh index e0e2664..529cc6b 100755 --- a/tests/drm_lib.sh +++ b/tests/drm_lib.sh @@ -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 -- 2.7.4