Skip to contentSkip to conversation

cpuset: disable for UCLIBC

PATCH New Vineet Gupta 2 participants 13 messages Mar 12, 2019 – Mar 21, 2019 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuset: disable for UCLIBC

libcpuset.c relies on FTS which is not enabled by default on uClibc. Instead of needing to reconfigure, rebuild uClibc lets disable this test for uClibc

Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 testcases/kernel/controllers/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
testcases/kernel/controllers/Makefile +5 -0
index 404073947904..9f4abe28bfcf 100644
@@ -29,6 +29,11 @@ LIBDIR			:= libcontrollers
 LIB			:= $(LIBDIR)/libcontrollers.a
 FILTER_OUT_DIRS		:= $(LIBDIR)
 
+# controllers/cpuset/cpuset_lib/libcpuset.c uses fts
+ifeq ($(UCLIBC),1)
+FILTER_OUT_DIRS	+= cpuset
+endif
+
 $(LIBDIR):
 	mkdir -p "$@"
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 cpuset: disable for UCLIBC

Hi Vineet,

Quoted 3 lines

libcpuset.c relies on FTS which is not enabled by default on uClibc. Instead of needing to reconfigure, rebuild uClibc lets disable this test for uClibc

Which uClibc version are you using?
Both uClibc and uclibc-ng has it [1] since 2011, version v0.9.32, in commit a4aa01c12 ("Added fts support for traversing UNIX file hierarchies.")

It's actually MUSL, what is missing it [2]. Although there is some implementation [3], we should skip it for musl. But the clearest way is really to check presence of <fts.h>, that's fix it for all libc.

Kind regards,
Petr

[1] https://cgit.openadk.org/cgi/cgit/uclibc-ng.git/tree/include/fts.h
[2] https://wiki.musl-libc.org/faq.html#Q:-Why-is-%3Ccode%3Efts.h%3C/code%3E-not-included?
[3] https://github.com/pullmoll/musl-fts

#2 lore raw

PATCH 1/1 cpuset: disable for UCLIBC

Quoted 8 lines · Petr Vorel

Hi Vineet,

Quoted 3 lines

libcpuset.c relies on FTS which is not enabled by default on uClibc. Instead of needing to reconfigure, rebuild uClibc lets disable this test for uClibc

Which uClibc version are you using?
Both uClibc and uclibc-ng has it [1] since 2011, version v0.9.32, in commit a4aa01c12 ("Added fts support for traversing UNIX file hierarchies.")

Right I'm using bleeding edge as well, and do have the header in sources, its just not configured/enabled by default hence not available in installation.

Quoted 3 lines

It's actually MUSL, what is missing it [2]. Although there is some implementation [3], we should skip it for musl. But the clearest way is really to check presence of <fts.h>, that's fix it for all libc.

Spot on, that is indeed the best/ideal way of doing it. Do you know if such a mechanism already exists in LTP. If you point me to an example I can respin the patch accordingly.

Thx,
-Vineet

#3 lore raw

PATCH 1/1 cpuset: disable for UCLIBC

Hi Vineet,

Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

libcpuset.c relies on FTS which is not enabled by default on uClibc. Instead of needing to reconfigure, rebuild uClibc lets disable this test for uClibc

Which uClibc version are you using?
Both uClibc and uclibc-ng has it [1] since 2011, version v0.9.32, in commit a4aa01c12 ("Added fts support for traversing UNIX file hierarchies.")

Right I'm using bleeding edge as well, and do have the header in sources, its just not configured/enabled by default hence not available in installation.

Quoted 7 lines
Quoted 3 lines

It's actually MUSL, what is missing it [2]. Although there is some implementation [3], we should skip it for musl. But the clearest way is really to check presence of <fts.h>, that's fix it for all libc.

Spot on, that is indeed the best/ideal way of doing it. Do you know if such a mechanism already exists in LTP. If you point me to an example I can respin the patch accordingly.

Simple adding fts.h in AC_CHECK_HEADERS + guards in a file #ifdef HAVE_FTS_H should do the magic :).

Kind regards,
Petr

#4 lore raw

PATCH v2 1/1 autodetect fts support and tests depending on it

Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 configure.ac                          | 1 +
 testcases/kernel/controllers/Makefile | 6 ++++++
 2 files changed, 7 insertions(+)
configure.ac +1 -0
index e002c248eab2..10b2f6b1e43b 100644
@@ -33,6 +33,7 @@ AC_PROG_YACC
 AC_PREFIX_DEFAULT(/opt/ltp)
 
 AC_CHECK_HEADERS([ \
+    fts.h \
     ifaddrs.h \
     keyutils.h \
     linux/can.h \
testcases/kernel/controllers/Makefile +6 -0
index 404073947904..a1626ae03695 100644
@@ -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 "$@"
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 1/1 autodetect fts support and tests depending on it

Hi Vineet,

Quoted 23 lines
Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 configure.ac                          | 1 +
 testcases/kernel/controllers/Makefile | 6 ++++++
 2 files changed, 7 insertions(+)
configure.ac +1 -0
index e002c248eab2..10b2f6b1e43b 100644
@@ -33,6 +33,7 @@ AC_PROG_YACC
 AC_PREFIX_DEFAULT(/opt/ltp)
 
 AC_CHECK_HEADERS([ \
+    fts.h \
     ifaddrs.h \
     keyutils.h \
     linux/can.h \
testcases/kernel/controllers/Makefile +0 -0
index 404073947904..a1626ae03695 100644

testcases/kernel/controllers/Makefile LIBDIR := libcontrollers · line 36

Quoted 8 lines
testcases/kernel/controllers/Makefile +5 -0
@@ -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

#6 lore raw

PATCH v2 1/1 autodetect fts support and tests depending on it

Hi Vineet,

Quoted 26 lines
Quoted 25 lines
Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 configure.ac                          | 1 +
 testcases/kernel/controllers/Makefile | 6 ++++++
 2 files changed, 7 insertions(+)
configure.ac +1 -0
index e002c248eab2..10b2f6b1e43b 100644
@@ -33,6 +33,7 @@ AC_PROG_YACC
 AC_PREFIX_DEFAULT(/opt/ltp)
 
 AC_CHECK_HEADERS([ \
+    fts.h \
     ifaddrs.h \
     keyutils.h \
     linux/can.h \
testcases/kernel/controllers/Makefile +0 -0
index 404073947904..a1626ae03695 100644
@@ -29,6 +29,12 @@ LIBDIR			:= libcontrollers
 LIB			:= $(LIBDIR)/libcontrollers.a
 FILTER_OUT_DIRS		:= $(LIBDIR)
Quoted 10 lines

testcases/kernel/controllers/Makefile LIBDIR := libcontrollers · line 36

Quoted 5 lines
testcases/kernel/controllers/Makefile +5 -0
+# 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

#7 lore raw

PATCH v2 1/1 autodetect fts support and tests depending on it

In reply to Petr Vorel

Hi Petr,

Quoted 7 lines · Petr Vorel

testcases/kernel/controllers/Makefile LIBDIR := libcontrollers · line 36

Quoted 6 lines
testcases/kernel/controllers/Makefile +5 -0
+# 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)

Quoted 4 lines

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.

#8 lore raw

PATCH v2 1/1 autodetect fts support and tests depending on it

Hi Vineet,

Quoted 10 lines · Petr Vorel
Quoted 6 lines

testcases/kernel/controllers/Makefile LIBDIR := libcontrollers · line 36

Quoted 5 lines
testcases/kernel/controllers/Makefile +5 -0
+# 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.

Quoted 11 lines

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)

Quoted 4 lines

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

#9 lore raw

PATCH v2 1/1 autodetect fts support and tests depending on it

Quoted 9 lines · Petr Vorel

Hi Vineet,

Quoted 7 lines · Petr Vorel
Quoted 6 lines

testcases/kernel/controllers/Makefile LIBDIR := libcontrollers · line 36

Quoted 5 lines
testcases/kernel/controllers/Makefile +5 -0
+# 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?

Quoted 3 lines
Quoted 2 lines

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.

Quoted 4 lines

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.

Quoted 3 lines

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.

Quoted 2 lines

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

OK !

Thx,
-Vineet

#10 lore raw

PATCH 1/1 auto filter aio tests of libc can't support aio

In reply to Petr Vorel

uClibc-ng lacks libaio.h and thus LTP UCLIBC=1 builds need to filter out aio tests which it currently doesn't.

FWIW the tests sources themselves use a slightly different guard HAVE_LIBAIO (while autotool generate HAVE_LIBAIO_H).
Anyhow that seems pointless as aio tests should not even build of libc doesn't support the prerequsute header.

Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 testcases/kernel/io/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/io/Makefile +4 -0
index 7db02882a530..3afae3888f63 100644
@@ -24,4 +24,8 @@ top_srcdir		?= ../../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
+ifndef HAVE_LIBAIO_H
+FILTER_OUT_DIRS	+= aio
+endif
+
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
Signature · 1 line
2.7.4
#11 lore raw

PATCH 1/1 auto filter aio tests of libc can't support aio

Hi Vineet,

Quoted 18 lines

uClibc-ng lacks libaio.h and thus LTP UCLIBC=1 builds need to filter out aio tests which it currently doesn't.

FWIW the tests sources themselves use a slightly different guard HAVE_LIBAIO (while autotool generate HAVE_LIBAIO_H).
Anyhow that seems pointless as aio tests should not even build of libc doesn't support the prerequsute header.

Signed-off-by Vineet Gupta <vgupta at synopsys.com>
---
 testcases/kernel/io/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/io/Makefile +0 -0
index 7db02882a530..3afae3888f63 100644

testcases/kernel/io/Makefile top_srcdir ?= ../../.. · line 29

Quoted 6 lines
testcases/kernel/io/Makefile +3 -0
@@ -24,4 +24,8 @@ top_srcdir		?= ../../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
+ifndef HAVE_LIBAIO_H
+FILTER_OUT_DIRS	+= aio
+endif

This is IMHO wrong, as all files using libaio.h are guarded with TST_TEST_TCONF().

Kind regards,
Petr

#12 lore raw

PATCH 1/1 auto filter aio tests of libc can't support aio

Quoted 5 lines · Petr Vorel

testcases/kernel/io/Makefile top_srcdir ?= ../../.. · line 29

Quoted 3 lines
testcases/kernel/io/Makefile +3 -0
+ifndef HAVE_LIBAIO_H
+FILTER_OUT_DIRS	+= aio
+endif

This is IMHO wrong, as all files using libaio.h are guarded with TST_TEST_TCONF().

You're right. It seems this ltp tree of mine had stray aio1 and aio2 dir in the io/aio which was actually tripping the build. With a pristine tree that is indeed not needed.

Thx,
-Vineet