summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormarius vlad <marius.c.vlad@intel.com>2016-06-21 15:34:07 +0300
committerMarius Vlad <marius.c.vlad@intel.com>2016-06-21 18:59:46 +0300
commit1f4b21ca7d1d5782e532cb7f681bc60cac82ff85 (patch)
tree1b089d5b8eb98d53f268ae00bc004825e71a21b8 /tests
parent1b81253dd0d91191ceccd946961d8c53f4bcbd7d (diff)
tests/drm_lib.sh: Extract fake getopt options so it can sourced into tests that require it.
This should allow tests/vgem_reload_basic to pass check target and it doesn't depend of i915 being present. v2: Do not source drm_lib.sh, only fake getopt parsing option to again access to --list-subtests option (Chris) v3: Forget to place the script in Makefile.sources, otherwise distcheck will not copy it. Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> [Chris: Replace exit 1 with exit $IGT_EXIT_FAILURE] CC: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.sources1
-rw-r--r--tests/drm_getopt.sh38
-rwxr-xr-xtests/drm_lib.sh35
-rwxr-xr-xtests/vgem_reload_basic7
4 files changed, 46 insertions, 35 deletions
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 8d8ede6c..61851e8d 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -284,6 +284,7 @@ scripts = \
ddx_intel_after_fbdev \
debugfs_wedged \
drm_lib.sh \
+ drm_getopt.sh \
$(NULL)
IMAGES = pass.png 1080p-left.png 1080p-right.png
diff --git a/tests/drm_getopt.sh b/tests/drm_getopt.sh
new file mode 100644
index 00000000..a94a7594
--- /dev/null
+++ b/tests/drm_getopt.sh
@@ -0,0 +1,38 @@
+# This is required for check/distcheck target as it has to --list-subtests
+# for each test. Source it if you add a new test in form of a (shell) script.
+
+# See tests/vgem_reload_basic
+
+IGT_EXIT_TIMEOUT=78
+IGT_EXIT_SKIP=77
+IGT_EXIT_SUCCESS=0
+IGT_EXIT_INVALID=79
+IGT_EXIT_FAILURE=99
+
+# hacked-up long option parsing
+for arg in $@ ; do
+ case $arg in
+ --list-subtests)
+ exit $IGT_EXIT_INVALID
+ ;;
+ --run-subtest)
+ exit $IGT_EXIT_INVALID
+ ;;
+ --debug)
+ IGT_LOG_LEVEL=debug
+ ;;
+ --help-description)
+ echo $IGT_TEST_DESCRIPTION
+ exit $IGT_EXIT_SUCCESS
+ ;;
+ --help)
+ echo "Usage: `basename $0` [OPTIONS]"
+ echo " --list-subtests"
+ echo " --run-subtest <pattern>"
+ echo " --debug"
+ echo " --help-description"
+ echo " --help"
+ exit $IGT_EXIT_SUCCESS
+ ;;
+ esac
+done
diff --git a/tests/drm_lib.sh b/tests/drm_lib.sh
index 2ba146ba..c32bc68d 100755
--- a/tests/drm_lib.sh
+++ b/tests/drm_lib.sh
@@ -1,38 +1,7 @@
#!/bin/sh
-IGT_EXIT_TIMEOUT=78
-IGT_EXIT_SKIP=77
-IGT_EXIT_SUCCESS=0
-IGT_EXIT_INVALID=79
-IGT_EXIT_FAILURE=99
-
-# hacked-up long option parsing
-for arg in $@ ; do
- case $arg in
- --list-subtests)
- exit $IGT_EXIT_INVALID
- ;;
- --run-subtest)
- exit $IGT_EXIT_INVALID
- ;;
- --debug)
- IGT_LOG_LEVEL=debug
- ;;
- --help-description)
- echo $IGT_TEST_DESCRIPTION
- exit $IGT_EXIT_SUCCESS
- ;;
- --help)
- echo "Usage: `basename $0` [OPTIONS]"
- echo " --list-subtests"
- echo " --run-subtest <pattern>"
- echo " --debug"
- echo " --help-description"
- echo " --help"
- exit $IGT_EXIT_SUCCESS
- ;;
- esac
-done
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_getopt.sh
skip() {
echo "$@"
diff --git a/tests/vgem_reload_basic b/tests/vgem_reload_basic
index b150b2c8..5e10303d 100755
--- a/tests/vgem_reload_basic
+++ b/tests/vgem_reload_basic
@@ -5,6 +5,9 @@
# ... we've broken this way too often :(
#
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_getopt.sh
+
function unload() {
/sbin/rmmod vgem
# drm may be used by other devices (nouveau, radeon, udl, etc)
@@ -18,5 +21,5 @@ function unload() {
unload &> /dev/null
-/sbin/modprobe vgem $* || exit 1
-unload || exit 1
+/sbin/modprobe vgem $* || exit $IGT_EXIT_FAILURE
+unload || exit $IGT_EXIT_FAILURE