[Intel-gfx] [PATCH igt 2/2] igt/core_suspend: Exercise igt_system_suspend_autoresume()

Chris Wilson chris at chris-wilson.co.uk
Mon Oct 16 11:02:32 UTC 2017


We have various basic suspend and debug modes, so iterate over them to
check they each work without test interference. This help work out the
cause of any suspend bugs.

v2: Smelling fixes.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/Makefile.sources |  1 +
 tests/core_suspend.c   | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 tests/core_suspend.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 9c9fb316..b3f094b0 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -26,6 +26,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..91526095
--- /dev/null
+++ b/tests/core_suspend.c
@@ -0,0 +1,60 @@
+/*
+ * 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"
+
+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? */
+
+	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);
+		}
+	}
+
+	/* again with drivers loaded? */
+}
-- 
2.15.0.rc0



More information about the Intel-gfx mailing list