[Intel-gfx] [i-g-t PATCH 2/3] tests: add facility to enable/disable hda dynamic debug in script based tests

Jani Nikula jani.nikula at intel.com
Thu Oct 13 12:59:56 UTC 2016


Test scripts can call hda_dynamic_debug_enable and
hda_dynamic_debug_disable to enable/disable snd_hda_intel and
snd_hda_core debug messages. The dynamic debug will be disabled
automatically at test end by the exit handler.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 tests/drm_lib.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh
index 87e3ad0ab547..8738827fc218 100755
--- a/tests/drm_lib.sh
+++ b/tests/drm_lib.sh
@@ -5,6 +5,22 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 
 NAME=$(basename "$0")
 
+dynamic_debug=
+
+hda_dynamic_debug_enable() {
+	if [ -e "$dynamic_debug" ]; then
+		echo -n "module snd_hda_intel +pf" > $dynamic_debug
+		echo -n "module snd_hda_core +pf" > $dynamic_debug
+	fi
+}
+
+hda_dynamic_debug_disable() {
+	if [ -e "$dynamic_debug" ]; then
+		echo -n "module snd_hda_core =_" > $dynamic_debug
+		echo -n "module snd_hda_intel =_" > $dynamic_debug
+	fi
+}
+
 KERN_EMER="<0>"
 KERN_ALERT="<1>"
 KERN_CRIT="<2>"
@@ -20,6 +36,7 @@ kmsg() {
 
 finish() {
 	exitcode=$?
+	hda_dynamic_debug_disable
 	kmsg "$KERN_INFO$NAME: exiting, ret=$exitcode"
 	exit $exitcode
 }
@@ -49,6 +66,11 @@ else
 	skip "debugfs not found"
 fi
 
+dynamic_debug=$debugfs_path/dynamic_debug/control
+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
-- 
2.1.4



More information about the Intel-gfx mailing list