Re: [i-g-t PATCH 1/3] tests: add more checks for finding the debugfs in script based tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 14 Oct 2016, Jani Nikula <jani.nikula@xxxxxxxxx> wrote:
> On Fri, 14 Oct 2016, Petri Latvala <petri.latvala@xxxxxxxxx> wrote:
>> On Thu, Oct 13, 2016 at 03:59:55PM +0300, Jani Nikula wrote:
>>> While at it, make debugfs_path point at the debugfs root, not
>>> dri. This'll be handy in future work.
>>> 
>>> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
>>> ---
>>>  tests/drm_lib.sh | 16 ++++++++++------
>>>  1 file changed, 10 insertions(+), 6 deletions(-)
>>> 
>>> diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh
>>> index 113da4c7d645..87e3ad0ab547 100755
>>> --- a/tests/drm_lib.sh
>>> +++ b/tests/drm_lib.sh
>>> @@ -41,18 +41,22 @@ do_or_die() {
>>>  	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
>>>  }
>>>  
>>> -if [ -d /debug/dri ] ; then
>>> -	debugfs_path=/debug/dri
>>> +if [ -d /sys/kernel/debug ]; then
>>> +	debugfs_path=/sys/kernel/debug
>>> +elif [ -d /debug ]; then
>>> +	debugfs_path=/debug
>>> +else
>>> +	skip "debugfs not found"
>>>  fi
>>
>> Would parsing the output of  `mount -t debugfs`  be an option?
>
> I contemplated that, but decided that should be a separate change later
> on. I can send a patch on top if you like.

Something like this (untested):

diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh
index af104ad791b7..6db604e22abf 100755
--- a/tests/drm_lib.sh
+++ b/tests/drm_lib.sh
@@ -58,11 +58,15 @@ do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit $IGT_EXIT_FAILURE)
 }
 
-if [ -d /sys/kernel/debug ]; then
-	debugfs_path=/sys/kernel/debug
-elif [ -d /debug ]; then
-	debugfs_path=/debug
-else
+debugfs_path=
+for path in $(mount -t debugfs | cut -d " " -f 3) /sys/kernel/debug /debug; do
+	if [ -d "$path" -a -d "$path/dri" ]; then
+		debugfs_path=$path
+		break
+	fi
+done
+
+if [ -z "$debugfs_path" ]; then
 	skip "debugfs not found"
 fi
 
@@ -71,10 +75,6 @@ if [ ! -e "$dynamic_debug" ]; then
 	echo "WARNING: dynamic debug control not available"
 fi
 
-if [ ! -d $debugfs_path/dri ]; then
-	skip "dri debugfs not found"
-fi
-
 i915_dfs_path=x
 for minor in `seq 0 16`; do
 	if [ -f $debugfs_path/dri/$minor/i915_error_state ] ; then



-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux