Re: [PATCH v3 1/7] selftests/cgroup: skip test_zswap if zswap is globally disabled

From: Yosry Ahmed

Date: Fri Mar 13 2026 - 13:35:31 EST


On Fri, Mar 13, 2026 at 1:00 AM Li Wang <liwang@xxxxxxxxxx> wrote:
>
> On Thu, Mar 12, 2026 at 11:34:41PM -0700, Yosry Ahmed wrote:
> > > diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c
> > > index 64ebc3f3f203..e69d845d3592 100644
> > > --- a/tools/testing/selftests/cgroup/test_zswap.c
> > > +++ b/tools/testing/selftests/cgroup/test_zswap.c
> > > @@ -589,9 +589,21 @@ struct zswap_test {
> > > };
> > > #undef T
> > >
> > > -static bool zswap_configured(void)
> > > +static void check_zswap_enabled(void)
> > > {
> > > - return access("/sys/module/zswap", F_OK) == 0;
> > > + char value[2];
> >
> > Please wait for discussions on the previous version to conclude and
> > give people a little bit of time to respond before sending the next
> > version.
>
> Sorry for the rush. I thought that I had clarified the issue there.
>
> > I think this can just be be:
> >
> > char value;
> > ...
> >
> > if (read_text(.., &value, sizeof(value)) < 0)
>
> This actuall introduce a problem to the code, as in read_text()
> that achivement is:
>
> len = read(fd, buf, max_len - 1);
>
> When 'sizeof(value) == 1' pass in that makes read(fd, &value, 0);
> read zero, after that, the value is set to '\0'.

I see, I missed that, thanks for clarifying. If you do send a new
version, put the path of the module parameter in a macro or variable
to make the lines in check_zswap_enabled() shorter and hopefully have
everything fit in one line. Anyway:

Acked-by: Yosry Ahmed <yosry@xxxxxxxxxx>