Skip to contentSkip to conversation

tests: rename debugfs base path to be more specific

PATCH In review Mika Kuoppala 2 participants 6 messages Jun 27, 2013 – Jul 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tests: rename debugfs base path to be more specific

In preparation to have sysfs entries used in scripts rename to more specific name.

---
 tests/ZZ_hangman         |    2 +-
 tests/debugfs_emon_crash |    2 +-
 tests/debugfs_reader     |    2 +-
 tests/debugfs_wedged     |    4 ++--
 tests/drm_lib.sh         |    8 ++++----
 5 files changed, 9 insertions(+), 9 deletions(-)
tests/ZZ_hangman +1 -1
index cf71972..08c5514 100755
@@ -11,7 +11,7 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 
 oldpath=`pwd`
 
-cd $i915_path
+cd $i915_dfs_path
 
 if [ ! -f i915_ring_stop ] ; then
 	echo "kernel doesn't support ring stopping"
tests/debugfs_emon_crash +1 -1
index 6e139a4..809bfab 100755
@@ -8,7 +8,7 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 . $SOURCE_DIR/drm_lib.sh
 
 for z in $(seq 1 1000); do
-	cat $i915_path/i915_emon_status > /dev/null 2&>1
+	cat $i915_dfs_path/i915_emon_status > /dev/null 2&>1
 done
 
 # If we got here, we haven't crashed
tests/debugfs_reader +1 -1
index 80d5998..9e2845e 100755
@@ -4,6 +4,6 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 . $SOURCE_DIR/drm_lib.sh
 
 # read everything we can
-cat $i915_path/* > /dev/null 2>&1 
+cat $i915_dfs_path/* > /dev/null 2>&1
 
 exit 0
tests/debugfs_wedged +2 -2
index 80a32f6..903a0a2 100755
@@ -6,5 +6,5 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 # Testcase: wedge the hw to check the error_state reading
 # 
 # Unfortunately wedged is permanent, so this test is not run by default
-echo 1 > ${i915_path}/i915_wedged
-cat $i915_path/i915_error_state > /dev/null 2>&1
+echo 1 > ${i915_dfs_path}/i915_wedged
+cat $i915_dfs_path/i915_error_state > /dev/null 2>&1
tests/drm_lib.sh +4 -4
index a76fd47..7eaf34e 100755
@@ -12,20 +12,20 @@ if [ -d /sys/kernel/debug/dri ] ; then
 	debugfs_path=/sys/kernel/debug/dri
 fi
 
-i915_path=x
+i915_dfs_path=x
 for dir in `ls $debugfs_path` ; do
 	if [ -f $debugfs_path/$dir/i915_error_state ] ; then
-		i915_path=$debugfs_path/$dir
+		i915_dfs_path=$debugfs_path/$dir
 		break
 	fi
 done
 
-if [ $i915_path = "x" ] ; then
+if [ $i915_dfs_path = "x" ] ; then
 	die " i915 debugfs path not found."
 fi
 
 # read everything we can
-if [ `cat $i915_path/clients | wc -l` -gt "2" ] ; then
+if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then
 	die "ERROR: other drm clients running"
 fi
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 tests: add i915_sfs_path

To access 'error_state' through sysfs.

---
 tests/drm_lib.sh |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
tests/drm_lib.sh +15 -0
index 7eaf34e..72da4ad 100755
@@ -29,4 +29,19 @@ if [ `cat $i915_dfs_path/clients | wc -l` -gt "2" ] ; then
 	die "ERROR: other drm clients running"
 fi
 
+if [ -d /sys/class/drm ] ; then
+    sysfs_path=/sys/class/drm
+fi
+
+i915_sfs_path=x
+for dir in `ls $sysfs_path` ; do
+    if [ -f $sysfs_path/$dir/error_state ] ; then
+	i915_sfs_path=$sysfs_path/$dir
+	break
+    fi
+done
+
+if [ $i915_sfs_path = "x" ] ; then
+    die " i915 sysfs path not found."
+fi
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 3/3 tests/ZZ_hangman: Test both error_state interfaces

In reply to Mika Kuoppala

Test both debugfs and sysfs error_state interfaces.

---
 tests/ZZ_hangman |   34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
tests/ZZ_hangman +21 -13
index 08c5514..303dbc7 100755
@@ -18,25 +18,33 @@ 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"
+for estate_fname in $i915_dfs_path/i915_error_state $i915_sfs_path/error_state ; do
+    echo checking ${estate_fname}
+
+    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+	echo "gpu hang detected"
 	exit 1
-fi
+    fi
 
-# stop rings
-echo 0xf > i915_ring_stop
-echo "rings stopped"
+    echo 0xf > i915_ring_stop
+    echo "rings stopped"
 
-(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+    (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
 
-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 correctly detected"
+    else
+	echo "gpu hang not detected"
 	exit 2
-fi
+    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 3
+    fi
+done
 
 exit 0
Signature · 1 line
1.7.9.5
#3 lore raw

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

Quoted 12 lines · Mika Kuoppala

Test both debugfs and sysfs error_state interfaces.

---
 tests/ZZ_hangman |   34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
tests/ZZ_hangman +0 -0
index 08c5514..303dbc7 100755

tests/ZZ_hangman if [ ! -f i915_ring_stop ] ; then · line 22

Quoted 7 lines
tests/ZZ_hangman +2 -2
@@ -18,25 +18,33 @@ 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"
+for estate_fname in $i915_dfs_path/i915_error_state $i915_sfs_path/error_state ; do
+    echo checking ${estate_fname}

On second thought I think we need to auto-skip the sysfs error_state here if it's not there. Can you please patch this up?

Thanks, Daniel

Quoted 46 lines
tests/ZZ_hangman +19 -11
+
+    if cat $estate_fname | grep -v "no error state collected" > /dev/null ; then
+	echo "gpu hang detected"
 	exit 1
-fi
+    fi
 
-# stop rings
-echo 0xf > i915_ring_stop
-echo "rings stopped"
+    echo 0xf > i915_ring_stop
+    echo "rings stopped"
 
-(cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
+    (cd $oldpath; $SOURCE_DIR/gem_exec_big) > /dev/null
 
-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 correctly detected"
+    else
+	echo "gpu hang not detected"
 	exit 2
-fi
+    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 3
+    fi
+done
 
 exit 0
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw

PATCH 3/3 tests/ZZ_hangman: Test both error_state interfaces

Test both debugfs and sysfs error_state interfaces.

v2: sysfs error_state not mandatory

---
 tests/ZZ_hangman |   52 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 38 insertions(+), 14 deletions(-)
tests/ZZ_hangman +38 -14
index 08c5514..4db3823 100755
@@ -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
Signature · 1 line
1.7.9.5
#5 lore raw

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

Quoted 5 lines · Mika Kuoppala

Test both debugfs and sysfs error_state interfaces.

v2: sysfs error_state not mandatory

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

Quoted 79 lines
---
 tests/ZZ_hangman |   52 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 38 insertions(+), 14 deletions(-)
tests/ZZ_hangman +38 -14
index 08c5514..4db3823 100755
@@ -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
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch