From: Lyude <lyude@redhat.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lyude <lyude@redhat.com>
Subject: [RFC i-g-t v3 1/5] igt_aux: Add igt_skip_without_suspend_support()
Date: Wed, 30 Nov 2016 20:24:44 -0500 [thread overview]
Message-ID: <20161201012448.16334-2-lyude@redhat.com> (raw)
In-Reply-To: <20161201012448.16334-1-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 b5ae854..ce2f245 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -732,6 +732,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 177bd1d..41903c2 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -181,6 +181,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.9.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-12-01 1:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 1:24 [RFC i-g-t v3 0/5] Add support for the Chamelium Lyude
2016-12-01 1:24 ` Lyude [this message]
2016-12-01 1:24 ` [RFC i-g-t v3 2/5] igt_aux: Add igt_set_autoresume_delay() Lyude
2016-12-01 1:24 ` [RFC i-g-t v3 3/5] igt_kms: Add helpers for watching for sysfs hotplug events Lyude
2016-12-01 1:24 ` [RFC i-g-t v3 4/5] igt_debugfs: Make igt_crc_to_string() work with other CRC types Lyude
2016-12-01 1:24 ` [RFC i-g-t v3 5/5] Add support for hotplug testing with the Chamelium Lyude
2016-12-07 11:27 ` Tomeu Vizoso
2016-12-07 19:56 ` Lyude Paul
2016-12-08 7:51 ` Tomeu Vizoso
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=20161201012448.16334-2-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).