diff options
author | Paul Kocialkowski <paul.kocialkowski@linux.intel.com> | 2017-07-04 16:33:19 +0300 |
---|---|---|
committer | Lyude <lyude@redhat.com> | 2017-07-06 11:55:53 -0400 |
commit | ebd6eb69f57b0f36a4bf9978b5c47ba4be86d261 (patch) | |
tree | bf6f229ff0e8e0b149c3fc929d0f7ca79080a6ba /lib/igt_aux.c | |
parent | 80aa69fd675bce77dda751e5e5c5d651e9f08e1e (diff) |
Make igtrc configuration common, with configurable suspend/resume delay
This adds support for configurable suspend/resume delay and takes the
occasion to move igtrc configuation from igt_chamelium to igt_core.
This way, suspend/resume delay configuration can be used for all tests.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r-- | lib/igt_aux.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 882dba06..86a213c2 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -748,10 +748,7 @@ static void suspend_via_rtcwake(enum igt_suspend_state state) igt_assert(state < SUSPEND_STATE_NUM); - if (autoresume_delay) - delay = autoresume_delay; - else - delay = state == SUSPEND_STATE_DISK ? 30 : 15; + delay = igt_get_autoresume_delay(state); /* * Skip if rtcwake would fail for a reason not related to the kernel's @@ -899,6 +896,28 @@ void igt_set_autoresume_delay(int delay_secs) } /** + * igt_get_autoresume_delay: + * @state: an #igt_suspend_state, the target suspend state + * + * Retrieves how long we wait to resume the system after suspending it. + * This can either be set through igt_set_autoresume_delay or be a default + * value that depends on the suspend state. + * + * Returns: The autoresume delay, in seconds. + */ +int igt_get_autoresume_delay(enum igt_suspend_state state) +{ + int delay; + + if (autoresume_delay) + delay = autoresume_delay; + else + delay = state == SUSPEND_STATE_DISK ? 30 : 15; + + return delay; +} + +/** * igt_drop_root: * * Drop root privileges and make sure it actually worked. Useful for tests |