From: Lyude <lyude@redhat.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lyude <lyude@redhat.com>
Subject: [RFC i-g-t 1/4] igt_aux: Add igt_skip_without_suspend_support()
Date: Mon, 7 Nov 2016 19:05:13 -0500 [thread overview]
Message-ID: <1478563516-23568-2-git-send-email-lyude@redhat.com> (raw)
In-Reply-To: <1478563516-23568-1-git-send-email-lyude@redhat.com>
Since all of the chamelium calls are blocking, we need to be able to
make suspend/resume tests with it multi-threaded. As such, it's not the
best idea to rely on igt_system_suspend_autoresume() for skipping tests
on systems without suspend/resume support since we could accidentally
leave the thread controlling the chamelium running after the test gets
skipped.
Signed-off-by: Lyude <lyude@redhat.com>
---
lib/igt_aux.c | 21 +++++++++++++++++++++
lib/igt_aux.h | 2 ++
2 files changed, 23 insertions(+)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 421f6d4..9754148 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -743,6 +743,27 @@ static uint32_t get_supported_suspend_states(int power_dir)
}
/**
+ * igt_skip_without_suspend_state:
+ * @state: an #igt_suspend_state to check for
+ *
+ * Check whether or not the system supports the given @state, and skip the
+ * current test if it doesn't. Useful for tests we want to skip before
+ * attempting to call #igt_system_suspend_autoresume.
+ */
+void igt_skip_without_suspend_support(enum igt_suspend_state state,
+ enum igt_suspend_test test)
+{
+ int power_dir;
+
+ igt_require((power_dir = open("/sys/power", O_RDONLY)) >= 0);
+ igt_require(get_supported_suspend_states(power_dir) & (1 << state));
+ igt_require(test == SUSPEND_TEST_NONE ||
+ faccessat(power_dir, "pm_test", R_OK | W_OK, 0) == 0);
+
+ close(power_dir);
+}
+
+/**
* igt_system_suspend_autoresume:
* @state: an #igt_suspend_state, the target suspend state
* @test: an #igt_suspend_test, test point at which to complete the suspend
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index d30196b..973a9cd 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -170,6 +170,8 @@ enum igt_suspend_test {
SUSPEND_TEST_NUM,
};
+void igt_skip_without_suspend_support(enum igt_suspend_state state,
+ enum igt_suspend_test test);
void igt_system_suspend_autoresume(enum igt_suspend_state state,
enum igt_suspend_test test);
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-11-08 0:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 0:05 [RFC i-g-t 0/4] intel-gpu-tools: Add support for the Chamelium Lyude
2016-11-08 0:05 ` Lyude [this message]
2016-11-08 0:05 ` [RFC i-g-t 2/4] igt_aux: Add igt_set_autoresume_delay() Lyude
2016-11-08 9:39 ` Chris Wilson
2016-11-08 0:05 ` [RFC i-g-t 3/4] igt_aux: Add some list helpers from wayland Lyude
2016-11-08 9:37 ` Chris Wilson
2016-11-08 0:05 ` [RFC i-g-t 4/4] Add support for hotplug testing with the Chamelium Lyude
2016-11-09 15:18 ` Tomeu Vizoso
2016-11-14 7:05 ` Daniel Vetter
2016-11-14 16:46 ` Lyude Paul
2016-11-09 15:09 ` [RFC i-g-t 0/4] intel-gpu-tools: Add support for " Tomeu Vizoso
2016-11-11 17:53 ` Lyude Paul
2016-11-15 11:44 ` Tomeu Vizoso
2016-11-15 21:44 ` Lyude Paul
2016-11-16 11:52 ` Tomeu Vizoso
2016-11-28 20:10 ` Lyude Paul
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=1478563516-23568-2-git-send-email-lyude@redhat.com \
--to=lyude@redhat.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;
as well as URLs for NNTP newsgroup(s).