[LTP] [PATCH v1] Port getxattr03.c to new test API

Richard Palethorpe rpalethorpe@suse.de
Thu Nov 23 11:46:21 CET 2023


Hello,

Marius Kittler <mkittler@suse.de> writes:

> Am Freitag, 22. September 2023, 14:20:38 CEST schrieb Wei Gao:
>> On Fri, Sep 22, 2023 at 11:23:47AM +0200, Marius Kittler wrote:
>> > Am Freitag, 22. September 2023, 02:00:32 CEST schrieb Wei Gao:
>> > > > #ifdef HAVE_SYS_XATTR_H
>> > > 
>> > > Normally i saw this kind of ifdef in include/lapi/xattr.h
>> > > I suppose we need create include/lapi/xattr.h?
>> > 
>> > No, we don't need that header here. This macro is actually defined in
>> > `config.h` which also makes sense as it is generated at configuration
>> > time. Note that also all builds (including musl) are passing with this
>> > change, see
>> > https://github.com/Martchus/ltp/actions/runs/6259530698.
>> 
>> Maybe some misunderstanding, i mean put ifdef logic into
>> include/lapi/xattr.h instead of define HAVE_SYS_XATTR_H, since i saw ifdef
>> logic for judge exist of xxx.h normally handled in include/lapi/xxx.h.
>
> Ah, so I'd add `include/lapi/xattr.h` and to the `#ifdef HAVE_SYS_XATTR_H` 
> there. But is that really the way to go in that situation? I've just checked a 
> few header files in the `include/lapi` directory and there's no precedence for 
> the case when a header is not supported at all and the corresponding test 
> should thus be disabled. These headers seem more for abstracting differences 
> between different (versions) of C libraries but not for handling the case when 
> a test should be skipped completely.
>
> Note that the way I wrote this test was suggested to me in "Re: [LTP] [PATCH 
> v1] Port `getxattr01.c` to new test API".

lib/safe_macros.c included sys/xattr.h without any guards in 2016.

I have removed the ifdefs and an inline comment and pushed!

-- 
Thank you,
Richard.


More information about the ltp mailing list