[Intel-gfx] [PATCH igt] igt/core_suspend: Exercise igt_system_suspend_autoresume()
Chris Wilson
chris at chris-wilson.co.uk
Fri Dec 8 19:39:33 UTC 2017
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 at chris-wilson.co.uk>
---
tests/Makefile.sources | 1 +
tests/core_suspend.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
create mode 100644 tests/core_suspend.c
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index d6d176596..36077a132 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -28,6 +28,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 000000000..2f5a3b7ff
--- /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);
+ }
+ }
+}
--
2.15.1
More information about the Intel-gfx
mailing list