summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-10-15 14:53:29 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-03-15 10:52:37 +0000
commit30269b9d0fbe9a776be5e506bafffe57ccd411ed (patch)
treeb6c11ecc48c00ad36db971e110d813bf4fd4f783
parenta18bc94243d54618e74326e5b32c9ce0d8b3875c (diff)
igt/core_suspend: Exercise igt_system_suspend_autoresume()
We have various basic suspend and debug modes, so iterate over them to check they each work without test interference. This should help work out the cause of any suspend bugs by isolating those that are independent of the drivers. v2: Smelling fixes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/Makefile.sources1
-rw-r--r--tests/core_suspend.c62
2 files changed, 63 insertions, 0 deletions
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 28313594..4bbd277b 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -29,6 +29,7 @@ TESTS_progs = \
core_getversion \
core_prop_blob \
core_setmaster_vs_auth \
+ core_suspend \
debugfs_test \
drm_import_export \
drm_mm \
diff --git a/tests/core_suspend.c b/tests/core_suspend.c
new file mode 100644
index 00000000..2f5a3b7f
--- /dev/null
+++ b/tests/core_suspend.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt.h"
+#include "igt_kmod.h"
+
+igt_main
+{
+ const struct mode {
+ const char *name;
+ unsigned int mode;
+ } suspend[] = {
+ { "freeze", SUSPEND_STATE_FREEZE },
+ { "standby", SUSPEND_STATE_STANDBY },
+ { "mem", SUSPEND_STATE_MEM },
+ { "disk", SUSPEND_STATE_DISK },
+ {}
+ }, debug[] = {
+ { "freezer", SUSPEND_TEST_FREEZER },
+ { "devices", SUSPEND_TEST_DEVICES },
+ { "platform", SUSPEND_TEST_PLATFORM },
+ { "processors", SUSPEND_TEST_PROCESSORS },
+ { "core", SUSPEND_TEST_CORE },
+ { "full", SUSPEND_TEST_NONE },
+ {}
+ };
+
+ igt_skip_on_simulation();
+
+ /* unload all drivers? */
+ igt_fixture {
+ igt_i915_driver_unload();
+ }
+
+ for (const struct mode *s = suspend; s->name; s++) {
+ for (const struct mode *d = debug; d->name; d++) {
+ igt_subtest_f("suspend-%s-%s", s->name, d->name)
+ igt_system_suspend_autoresume(s->mode, d->mode);
+ }
+ }
+}