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
This commit is contained in:
Chris Wilson 2013-07-03 08:00:13 +01:00
parent ae452e327a
commit e50ae9596c
2 changed files with 18 additions and 18 deletions

View File

@ -19,22 +19,26 @@ if [ ! -f i915_ring_stop ] ; then
fi fi
function check_iface { function check_iface {
estate_fname=$1 dir="$1"
mandatory=$2 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 if [ $mandatory != 0 ] ; then
echo "'${estate_fname}' not found"; echo "'${path}' not found";
exit 1; exit 1;
else else
echo "${estate_fname} not mandatory"; echo "${path} not mandatory";
return; return;
fi fi
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" echo "gpu hang detected"
exit 2 exit 2
fi fi
@ -44,7 +48,7 @@ function check_iface {
(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null (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" echo "gpu hang correctly detected"
else else
echo "gpu hang not detected" echo "gpu hang not detected"
@ -52,15 +56,15 @@ function check_iface {
fi fi
# clear error state # 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" echo "gpu hang still present"
exit 4 exit 4
fi fi
} }
check_iface $i915_dfs_path/i915_error_state 1 check_iface "$i915_dfs_path" i915_error_state 1
check_iface $i915_sfs_path/error 0 check_iface "$i915_sfs_path" error 0
exit 0 exit 0

View File

@ -33,15 +33,11 @@ if [ -d /sys/class/drm ] ; then
sysfs_path=/sys/class/drm sysfs_path=/sys/class/drm
fi fi
i915_sfs_path=x i915_sfs_path=
for dir in `ls $sysfs_path` ; do for dir in `ls $sysfs_path` ; do
if [ -f $sysfs_path/$dir/error ] ; then if [ -f $sysfs_path/$dir/error ] ; then
i915_sfs_path=$sysfs_path/$dir i915_sfs_path=$sysfs_path/$dir
break break
fi fi
done done
# sysfs may not exist as the 'error' is a new interface in 3.11
if [ $i915_sfs_path = "x" ] ; then
echo " i915 sysfs path not found."
fi