> > int main(int argc, char **argv)
> > {
> > char root[PATH_MAX];
> > - int i;
> > + int i, orig_zswap_state;
> >
> > ksft_print_header();
> > ksft_set_plan(ARRAY_SIZE(tests));
> > if (cg_find_unified_root(root, sizeof(root), NULL))
> > ksft_exit_skip("cgroup v2 isn't mounted\n");
> >
> > - if (!zswap_configured())
> > + orig_zswap_state = zswap_enabled_state();
> > +
> > + if (orig_zswap_state == -1)
> > ksft_exit_skip("zswap isn't configured\n");
> > + else if (orig_zswap_state == 0 && !enable_zswap())
> > + ksft_exit_skip("zswap is disabled and cannot be enabled\n");
>
> I should simply check the enablement state and skip if it's not
> satisfactory (possibly printing an instructive message what to tweak).
> (To keep the test dummy and leave it up to who's reponsible for the
> environment.)
+1