[LTP] [PATCH] resource_files: inline resource file for readable doc

Petr Vorel pvorel@suse.cz
Fri Jul 29 16:52:15 CEST 2022


> Hi Chen, Cyril,

> > Currently from resource_files section of metadata doc, we usually get:

> > .resource_files  TEST_APP

> > or

> > .resource_files  resource_files

> > which do not help much.

> > This patch will inline reource file with its real name.

> > Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> Suggested-by: Petr Vorel <pvorel@suse.cz>

> :).

> > ---
> >  testcases/kernel/containers/userns/userns06.c     |  2 +-
> >  testcases/kernel/syscalls/creat/creat07.c         | 10 ++++------
> >  testcases/kernel/syscalls/execve/execve02.c       | 10 ++++------
> >  testcases/kernel/syscalls/execve/execve04.c       | 10 ++++------
> >  testcases/kernel/syscalls/execve/execve05.c       | 10 ++++------
> >  testcases/kernel/syscalls/execveat/execveat01.c   | 10 ++++------
> >  testcases/kernel/syscalls/execveat/execveat02.c   | 10 ++++------
> >  testcases/kernel/syscalls/execveat/execveat03.c   | 10 ++++------
> >  testcases/kernel/syscalls/fanotify/fanotify03.c   | 10 ++++------
> >  testcases/kernel/syscalls/fanotify/fanotify10.c   | 10 ++++------
> >  testcases/kernel/syscalls/fanotify/fanotify12.c   | 10 ++++------
> >  testcases/kernel/syscalls/getrusage/getrusage03.c | 10 ++++------
> >  testcases/kernel/syscalls/pipe2/pipe2_02.c        | 10 ++++------
> >  testcases/kernel/syscalls/prctl/prctl06.c         | 10 ++++------
> >  14 files changed, 53 insertions(+), 79 deletions(-)

> > diff --git a/testcases/kernel/containers/userns/userns06.c b/testcases/kernel/containers/userns/userns06.c
> > index 002c72907..9e900d94b 100644
> > --- a/testcases/kernel/containers/userns/userns06.c
> > +++ b/testcases/kernel/containers/userns/userns06.c
> > @@ -122,7 +122,7 @@ static struct tst_test test = {
> >  	.needs_root = 1,
> >  	.needs_checkpoints = 1,
> >  	.resource_files = (const char *[]) {
> > -		TEST_APP,
> > +		"userns06_capcheck",
> >  		NULL,
> Hardcode binary name when there is TESTBIN is no-go => I'd be for rejecting
> this.

> @metan: what bothers me is that even adding a test directory as include does not
> help (yes, path relative to src root is correct):

> $ ./metaparse -Iinclude -Itestcases/kernel/syscalls/utils/ -Itestcases/kernel/containers/userns/ ../testcases/kernel/containers/userns/userns06.c

OK, running with -v shows only "common.h" is included, because there is no
header in testcases/kernel/containers/userns/ and TEST_APP is defined in the
file.

Also TEST_APP is correctly detected via parse_macro(f):
...
INCLUDE ../testcases/kernel/containers/userns/common.h
 MACRO UID_MAP=0
 MACRO GID_MAP=1
INCLUDE END
 MACRO TEST_APP=userns06_capcheck
 MACRO CHILD1UID=0
 MACRO CHILD1GID=0
 MACRO CHILD2UID=200
 MACRO CHILD2GID=200

I'll have look why it's not replaced.

Kind regards,
Petr

> I'd expect 36d6d745c ("docparse: Implement #define and #include") would fix
> this. What am I missing?

> Kind regards,
> Petr


More information about the ltp mailing list