diff mbox series

[v2] autodetect fts support and tests depending on it

Message ID 1552938764-15101-1-git-send-email-vgupta@synopsys.com
State Rejected
Delegated to: Petr Vorel
Headers show
Series [v2] autodetect fts support and tests depending on it | expand

Commit Message

Vineet Gupta March 18, 2019, 7:52 p.m. UTC
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 configure.ac                          | 1 +
 testcases/kernel/controllers/Makefile | 6 ++++++
 2 files changed, 7 insertions(+)

Comments

Petr Vorel March 20, 2019, 10:37 p.m. UTC | #1
Hi Vineet,

> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> ---
>  configure.ac                          | 1 +
>  testcases/kernel/controllers/Makefile | 6 ++++++
>  2 files changed, 7 insertions(+)

> diff --git a/configure.ac b/configure.ac
> index e002c248eab2..10b2f6b1e43b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -33,6 +33,7 @@ AC_PROG_YACC
>  AC_PREFIX_DEFAULT(/opt/ltp)

>  AC_CHECK_HEADERS([ \
> +    fts.h \
>      ifaddrs.h \
>      keyutils.h \
>      linux/can.h \
> diff --git a/testcases/kernel/controllers/Makefile b/testcases/kernel/controllers/Makefile
> index 404073947904..a1626ae03695 100644
> --- a/testcases/kernel/controllers/Makefile
> +++ b/testcases/kernel/controllers/Makefile
> @@ -29,6 +29,12 @@ LIBDIR			:= libcontrollers
>  LIB			:= $(LIBDIR)/libcontrollers.a
>  FILTER_OUT_DIRS		:= $(LIBDIR)

> +# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
> +# which may not be available/configured in the libc build
> +ifndef HAVE_FTS_H
> +FILTER_OUT_DIRS	+= cpuset
> +endif
Have you tested it? This will not work as HAVE_LIBAIO_H is in include/config.h,
thus only for C. For Makefile it must be done via autotools (search for AC_SUBST
in m4/). I thought TST_TEST_TCONF usage, but you're right, that problematic
source is part of libcontrollers.a (i.e. part of a library, not normal C
binary).


Kind regards,
Petr
Petr Vorel March 20, 2019, 10:47 p.m. UTC | #2
Hi Vineet,

> > Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> > ---
> >  configure.ac                          | 1 +
> >  testcases/kernel/controllers/Makefile | 6 ++++++
> >  2 files changed, 7 insertions(+)

> > diff --git a/configure.ac b/configure.ac
> > index e002c248eab2..10b2f6b1e43b 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -33,6 +33,7 @@ AC_PROG_YACC
> >  AC_PREFIX_DEFAULT(/opt/ltp)

> >  AC_CHECK_HEADERS([ \
> > +    fts.h \
> >      ifaddrs.h \
> >      keyutils.h \
> >      linux/can.h \
> > diff --git a/testcases/kernel/controllers/Makefile b/testcases/kernel/controllers/Makefile
> > index 404073947904..a1626ae03695 100644
> > --- a/testcases/kernel/controllers/Makefile
> > +++ b/testcases/kernel/controllers/Makefile
> > @@ -29,6 +29,12 @@ LIBDIR			:= libcontrollers
> >  LIB			:= $(LIBDIR)/libcontrollers.a
> >  FILTER_OUT_DIRS		:= $(LIBDIR)

> > +# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
> > +# which may not be available/configured in the libc build
> > +ifndef HAVE_FTS_H
> > +FILTER_OUT_DIRS	+= cpuset
> > +endif
> Have you tested it? This will not work as HAVE_LIBAIO_H is in include/config.h,
> thus only for C. For Makefile it must be done via autotools (search for AC_SUBST
> in m4/). I thought TST_TEST_TCONF usage, but you're right, that problematic
> source is part of libcontrollers.a (i.e. part of a library, not normal C
> binary).

But when files aren't compiled, they're missing in runtest/controllers (there
are commands expected, that's why we use TST_TEST_TCONF, so file is there but
exits with warning). There is not an elegant solution, maybe adding these missing
binaries into TST_NEEDS_CMDS (one enough to any *.sh).

Kind regards,
Petr
Vineet Gupta March 20, 2019, 11:11 p.m. UTC | #3
Hi Petr,

On 3/20/19 3:37 PM, Petr Vorel wrote:
> 
>> +# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
>> +# which may not be available/configured in the libc build
>> +ifndef HAVE_FTS_H
>> +FILTER_OUT_DIRS	+= cpuset
>> +endif
> Have you tested it? 

Absolutely. I verified again. With this patch reverted locally I see errors due to
it trying to build the file

|
| make[5]: Leaving directory
'~/ltp/testcases/kernel/controllers/cpuset/cpuset_exclusive_test'
| make[5]: Entering directory
'~/ltp/testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test'
| make -C ../cpuset_lib -f
"~/ltp/testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/../cpuset_lib/Makefile"
all
| make[6]: Entering directory '~/ltp/testcases/kernel/controllers/cpuset/cpuset_lib'
| arc-linux-uclibc-gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
-Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../../include
-I../../../../../include -I../../../../../include/old/  -c -o meminfo.o meminfo.c
| arc-linux-uclibc-gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
-Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../../include
-I../../../../../include -I../../../../../include/old/  -c -o libbitmask.o
libbitmask.c
| arc-linux-uclibc-gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
-Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../../include
-I../../../../../include -I../../../../../include/old/  -c -o libcpuset.o libcpuset.c
| libcpuset.c:32:10: fatal error: fts.h: No such file or directory
|

With my patch the build runs to completion.

This will not work as HAVE_LIBAIO_H is in include/config.h,

You mean HAVE_FTS_H (LIBAIO stuff is for different patch)

> thus only for C. For Makefile it must be done via autotools (search for AC_SUBST
> in m4/). I thought TST_TEST_TCONF usage, but you're right, that problematic
> source is part of libcontrollers.a (i.e. part of a library, not normal C
> binary).
Umm not sure what u mean. Going to read the next msg in thread.
Petr Vorel March 21, 2019, 12:06 p.m. UTC | #4
Hi Vineet,

> On 3/20/19 3:37 PM, Petr Vorel wrote:
> >> +# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
> >> +# which may not be available/configured in the libc build
> >> +ifndef HAVE_FTS_H
> >> +FILTER_OUT_DIRS	+= cpuset
> >> +endif
> > Have you tested it? 

> Absolutely. I verified again. With this patch reverted locally I see errors due to
> it trying to build the file
I meant testing with glibc :). Because your patch would bring a regression:
ifndef HAVE_FTS_H is always true because HAVE_FTS_H as an autotools check is not
visible to make in this form, no matter what it's set to HAVE_FTS_H in
include/config.h :(.

We could solve previous problem to make HAVE_FTS_H visible with AC_SUBST, while
creating proper autotools function check in m4/. Planning to do that? (if not
I'll do).
My thoughts about dependency problem in shell scripts (TST_TEST_TCONF) was wrong
as these tests are also under cpuset directory.

> With my patch the build runs to completion.

> This will not work as HAVE_LIBAIO_H is in include/config.h,

> You mean HAVE_FTS_H (LIBAIO stuff is for different patch)

> > thus only for C. For Makefile it must be done via autotools (search for AC_SUBST
> > in m4/). I thought TST_TEST_TCONF usage, but you're right, that problematic
> > source is part of libcontrollers.a (i.e. part of a library, not normal C
> > binary).
> Umm not sure what u mean. Going to read the next msg in thread.
See up.

Kind regards,
Petr
Vineet Gupta March 21, 2019, 3:48 p.m. UTC | #5
On 3/21/19 5:06 AM, Petr Vorel wrote:
> Hi Vineet,
>
>> On 3/20/19 3:37 PM, Petr Vorel wrote:
>>>> +# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
>>>> +# which may not be available/configured in the libc build
>>>> +ifndef HAVE_FTS_H
>>>> +FILTER_OUT_DIRS	+= cpuset
>>>> +endif
>>> Have you tested it? 
>> Absolutely. I verified again. With this patch reverted locally I see errors due to
>> it trying to build the file
> I meant testing with glibc :). 

No I didn't. Sorry missed that aspect of testing.

> Because your patch would bring a regression:
> ifndef HAVE_FTS_H is always true because HAVE_FTS_H as an autotools check is not
> visible to make in this form, no matter what it's set to HAVE_FTS_H in
> include/config.h :(.

OK makes sense.

> We could solve previous problem to make HAVE_FTS_H visible with AC_SUBST, while
> creating proper autotools function check in m4/. Planning to do that? (if not
> I'll do).

It seems you already have a good grasp of both the problem I was trying to solve
and the solution, latter I'll have to dig into myself - not necessarily rocket
science but still. So please go ahead and do that if you have spare cycles.

> My thoughts about dependency problem in shell scripts (TST_TEST_TCONF) was wrong
> as these tests are also under cpuset directory.

OK !

Thx,
-Vineet
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index e002c248eab2..10b2f6b1e43b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,7 @@  AC_PROG_YACC
 AC_PREFIX_DEFAULT(/opt/ltp)
 
 AC_CHECK_HEADERS([ \
+    fts.h \
     ifaddrs.h \
     keyutils.h \
     linux/can.h \
diff --git a/testcases/kernel/controllers/Makefile b/testcases/kernel/controllers/Makefile
index 404073947904..a1626ae03695 100644
--- a/testcases/kernel/controllers/Makefile
+++ b/testcases/kernel/controllers/Makefile
@@ -29,6 +29,12 @@  LIBDIR			:= libcontrollers
 LIB			:= $(LIBDIR)/libcontrollers.a
 FILTER_OUT_DIRS		:= $(LIBDIR)
 
+# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
+# which may not be available/configured in the libc build
+ifndef HAVE_FTS_H
+FILTER_OUT_DIRS	+= cpuset
+endif
+
 $(LIBDIR):
 	mkdir -p "$@"