Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2] drv_module_reload_basic: Add inject-fault-* subtests
Date: Sat, 12 Mar 2016 16:40:17 +0200	[thread overview]
Message-ID: <1457793617-9952-1-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1457738295-4430-1-git-send-email-imre.deak@intel.com>

Add subtests for loading the module with fault injection enabled.

Requested by Chris.

v2:
- add proper IGT subtests instead of the --inject-fault option

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/drm_lib.sh              | 47 ++++++++++++++++++++++++++++++++++---------
 tests/drv_module_reload_basic | 37 +++++++++++++++++++++++++++++++++-
 2 files changed, 74 insertions(+), 10 deletions(-)

diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh
index c50664c..0d502df 100755
--- a/tests/drm_lib.sh
+++ b/tests/drm_lib.sh
@@ -1,13 +1,46 @@
 #!/bin/sh
 
 # hacked-up long option parsing
-for arg in $@ ; do
+
+die() {
+	echo "$@"
+	exit 1
+}
+
+arg_idx=1
+
+while [ $arg_idx -le $# ] ; do
+	arg=$(eval echo \$$arg_idx)
 	case $arg in
 		--list-subtests)
-			exit 79
+			if [ -z "IGT_SUBTEST_LIST" ]; then
+				exit 79
+			fi
+
+			for subtest in $IGT_SUBTEST_LIST; do
+				echo $subtest
+			done
+
+			exit 0
 			;;
-		--run-subtest)
-			exit 79
+		--run-subtest | --run-subtest=*)
+			if [ -z "$IGT_SUBTEST_LIST" ]; then
+				exit 79
+			fi
+
+			if [ x"${arg#--run-subtest=}" != x"$arg" ]; then
+				IGT_SUBTEST=${arg#--run-subtest=}
+			elif [ $arg_idx -lt $# ]; then
+				arg_idx=$(expr $arg_idx + 1)
+				IGT_SUBTEST=$(eval echo \$$arg_idx)
+			else
+				die "missing argument to $arg"
+			fi
+
+			if ! echo "$IGT_SUBTEST_LIST" | \
+			     grep -q "\<$IGT_SUBTEST\>"; then
+				die "unknown subtest $IGT_SUBTEST"
+			fi
 			;;
 		--debug)
 			IGT_LOG_LEVEL=debug
@@ -26,13 +59,9 @@ for arg in $@ ; do
 			exit 0
 			;;
 	esac
+	arg_idx=$(expr $arg_idx + 1)
 done
 
-die() {
-	echo "$@"
-	exit 1
-}
-
 do_or_die() {
 	$@ > /dev/null 2>&1 || (echo "FAIL: $@ ($?)" && exit -1)
 }
diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic
index ec1bae8..37d4bbc 100755
--- a/tests/drv_module_reload_basic
+++ b/tests/drv_module_reload_basic
@@ -5,9 +5,38 @@
 # ... we've broken this way too often :(
 #
 
+IGT_SUBTEST_LIST="
+basic
+basic-fault-init-early
+basic-fault-init-mmio
+basic-fault-init-hw
+"
+
 SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 . $SOURCE_DIR/drm_lib.sh
 
+if [ -z "$IGT_SUBTEST" ]; then
+	IGT_SUBTEST="basic"
+fi
+
+inject_fault_mask=
+
+case $IGT_SUBTEST in
+basic)
+	;;
+basic-fault-init-early)
+	inject_fault_mask=0x1
+	;;
+basic-fault-init-mmio)
+	inject_fault_mask=0x2
+	;;
+basic-fault-init-hw)
+	inject_fault_mask=0x4
+	;;
+*)
+	die "unknown subtest $IGT_SUBTEST"
+esac
+
 # no other drm service should be running, so we can just unbind
 
 # we must kick away fbcon (but only fbcon)
@@ -38,7 +67,13 @@ else
 	echo module successfully unloaded
 fi
 
-modprobe i915
+if [ -z "$inject_fault_mask" ]; then
+	modprobe i915
+else
+	modprobe i915 inject_fault=$inject_fault_mask
+	rmmod i915
+	modprobe i915
+fi
 echo 1 > /sys/class/vtconsole/vtcon1/bind
 
 modprobe snd_hda_intel
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2016-03-12 14:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 23:18 [PATCH igt] drv_module_reload_basic: Add inject-fault option Imre Deak
2016-03-12 14:40 ` Imre Deak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457793617-9952-1-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox