Re: [igt-dev] [PATCH i-g-t] lib/aux: Ensure swap space prior to suspend to disk

Sujaritha
2019-11-26T01:14:54Z

On 11/21/19 5:10 PM, don.hiatt@intel.com wrote:
> From: Don Hiatt <don.hiatt@intel.com>
>
> Suspending to disk requires swap space, make sure it exists
> before attempting to suspend to disk.
>
> v2: Use igt_skip() [Thanks, Chris!]
> v3: Use igt_skip_on_f()
>
> Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Don Hiatt <don.hiatt@intel.com>
> ---
> lib/igt_aux.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 578f857933f0..a6b114ed7e65 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -864,6 +864,10 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
> igt_require(test == SUSPEND_TEST_NONE ||
> faccessat(power_dir, "pm_test", R_OK | W_OK, 0) == 0);
>
> + igt_skip_on_f(state == SUSPEND_STATE_DISK &&
> + !intel_get_total_swap_mb(),
> + "Suspend to disk requires swap space.\n");
> +
> orig_test = get_suspend_test(power_dir);
> set_suspend_test(power_dir, test);
>

This should help fix part of the reason for the suspend tests failing on CI.

Reviewed-by : Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>