ltp-testsuite: Fix uClibc build with disabled fts.h support
PATCH 1/1 ltp-testsuite: Fix uClibc build with disabled fts.h support
Add patch, that fixes build on uClibc with disabled fts.h support and MUSL, which does not have fts.h at all.
Original patch [1] will be a part of the next LTP release and current patch should be removed from Buildroot when LTP version is bumped.
[1] https://github.com/linux-test-project/ltp/commit/b24f3d32c54006af5499da5a7ac418eafcf6e459
--- .../0002-cpuset-Detect-missing-fts.h.patch | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 package/ltp-testsuite/0002-cpuset-Detect-missing-fts.h.patch
package/ltp-testsuite/0002-cpuset-Detect-missing-fts.h.patch new file +76 -0
@@ -0,0 +1,76 @@ +From b24f3d32c54006af5499da5a7ac418eafcf6e459 Mon Sep 17 00:00:00 2001 +From: Petr Vorel <[email protected]> +Date: Thu, 21 Mar 2019 22:08:31 +0100 +Subject: [PATCH] cpuset: Detect missing fts.h + +This fixes build on uClibc with disabled fts.h support and MUSL, which +does not have fts.h at all. + +Reported-by: Vineet Gupta <[email protected]> +Signed-off-by: Petr Vorel <[email protected]> +[Nikita: + - back-ported to ltp-full-20190115 release] +Signed-off-by: Nikita Sobolev <[email protected]> +--- + configure.ac | 1 + + include/mk/config.mk.in | 1 + + m4/ltp-fts.m4 | 7 +++++++ + testcases/kernel/controllers/Makefile | 4 ++++ + 4 files changed, 13 insertions(+) + create mode 100644 m4/ltp-fts.m4 + +diff --git a/configure.ac b/configure.ac +index e002c248e..f05db9d2e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -231,6 +231,7 @@ LTP_CHECK_TPACKET_V3 + LTP_CHECK_RLIMIT64 + LTP_DETECT_HOST_CPU + LTP_CHECK_PERF_EVENT ++LTP_CHECK_FTS_H + + if test "x$with_numa" = xyes; then + LTP_CHECK_SYSCALL_NUMA +diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in +index 01f178bff..d55fe9602 100644 +--- a/include/mk/config.mk.in ++++ b/include/mk/config.mk.in +@@ -46,6 +46,7 @@ SELINUX_LIBS := @SELINUX_LIBS@ + TIRPC_CPPFLAGS := @TIRPC_CPPFLAGS@ + TIRPC_LIBS := @TIRPC_LIBS@ + KEYUTILS_LIBS := @KEYUTILS_LIBS@ ++HAVE_FTS_H := @HAVE_FTS_H@ + + prefix := @prefix@ + +diff --git a/m4/ltp-fts.m4 b/m4/ltp-fts.m4 +new file mode 100644 +index 000000000..0da692f23 +--- /dev/null ++++ b/m4/ltp-fts.m4 +@@ -0,0 +1,7 @@ ++dnl SPDX-License-Identifier: GPL-2.0-or-later ++dnl Copyright (c) 2019 Petr Vorel <[email protected]> ++ ++AC_DEFUN([LTP_CHECK_FTS_H],[ ++ AC_CHECK_HEADERS(fts.h, [have_fts=1]) ++ AC_SUBST(HAVE_FTS_H, $have_fts) ++]) +diff --git a/testcases/kernel/controllers/Makefile b/testcases/kernel/controllers/Makefile +index 404073947..548692cb8 100644 +--- a/testcases/kernel/controllers/Makefile ++++ b/testcases/kernel/controllers/Makefile +@@ -29,6 +29,10 @@ LIBDIR := libcontrollers + LIB := $(LIBDIR)/libcontrollers.a + FILTER_OUT_DIRS := $(LIBDIR) + ++ifneq ($(HAVE_FTS_H),1) ++ FILTER_OUT_DIRS += cpuset ++endif ++ + $(LIBDIR): + mkdir -p "$@" + +-- +2.17.1 +
Signature · 1 line
2.16.2
PATCH 1/1 ltp-testsuite: Fix uClibc build with disabled fts.h support
Hello Nikita,
Quoted 2 lines · On Wed, 17 Apr 2019 16:54:58 +0300 Nikita Sobolev…
Add patch, that fixes build on uClibc with disabled
fts.hsupport and MUSL, which does not havefts.hat all.
Then shouldn't the patch also remove the:
depends on !BR2_TOOLCHAIN_USES_MUSL
from package/ltp-testsuite/Config.in ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 ltp-testsuite: Fix uClibc build with disabled fts.h support
In reply to Nikita SobolevHi Nikita,
Quoted 2 lines
Add patch, that fixes build on uClibc with disabled
fts.hsupport and MUSL, which does not havefts.hat all.
Due autotools macros changes, which requires running autoreconf you need to add into package/ltp-testsuite/ltp-testsuite.mk:
# Required by patch 0002-cpuset-Detect-missing-fts.h.patch LTP_TESTSUITE_AUTORECONF = YES
FYI: while my patch in LTP upstream fixes uClibc with disabled fts.h, it's not enough for MUSL build, which is disabled. I've sent some experimental support to buildroot ML last month [2] (backported some fixes + simply delete the rest of problematic tests), but due either my problems with patchwork or outdated patchwork instance on ozlabs it didn't arrive to buildroot patchwork.
And I don't know whether buildroot uses (or allows user) to disable UCLIBC_HAS_FTS (whether this patch is actually useful).
Quoted 3 lines
Original patch [1] will be a part of the next LTP release and current patch should be removed from Buildroot when LTP version is bumped.
NOTE: we're planning next release in about 2 weeks, I usually update package the same day.
Quoted 3 lines
[1] https://github.com/linux-test-project/ltp/commit/b24f3d32c54006af5499da5a7ac418eafcf6e459
Signed-off-by Nikita Sobolev <[email protected]>
(with LTP_TESTSUITE_AUTORECONF = yes)
Kind regards,
Petr
[2] http://lists.busybox.net/pipermail/buildroot/2019-March/thread.html
PATCH 1/1 ltp-testsuite: Fix uClibc build with disabled fts.h support
In reply to Nikita SobolevQuoted 7 lines · On Wed, 17 Apr 2019 16:54:58 +0300 Nikita Sobolev…
Add patch, that fixes build on uClibc with disabled
fts.hsupport and MUSL, which does not havefts.hat all.Original patch [1] will be a part of the next LTP release and current patch should be removed from Buildroot when LTP version is bumped.
Quoted 7 lines
[1] https://github.com/linux-test-project/ltp/commit/b24f3d32c54006af5499da5a7ac418eafcf6e459
Signed-off-by Nikita Sobolev <[email protected]>--- .../0002-cpuset-Detect-missing-fts.h.patch | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 package/ltp-testsuite/0002-cpuset-Detect-missing-fts.h.patch
I am confused, because the current ltp-testsuite package seems to build properly with uClibc that doesn't have FTS support enabled. I just built the following configuration:
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2019.02-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_LTP_TESTSUITE=y
# BR2_TARGET_ROOTFS_TAR is not set
It has FTS disabled:
$ grep FTS output/staging/usr/include/bits/uClibc_config.h #undef __UCLIBC_HAS_FTS__
And it builds perfectly fine.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 ltp-testsuite: Fix uClibc build with disabled fts.h support
Hi Thomas,
Quoted 20 lines
I am confused, because the current ltp-testsuite package seems to build properly with uClibc that doesn't have FTS support enabled. I just built the following configuration:
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2019.02-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
#BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUGis not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
#BR2_PACKAGE_BUSYBOXis not set
BR2_PACKAGE_LTP_TESTSUITE=y
#BR2_TARGET_ROOTFS_TARis not set
Quoted 6 lines
It has FTS disabled:
$ grep FTS output/staging/usr/include/bits/uClibc_config.h #undef __UCLIBC_HAS_FTS__And it builds perfectly fine.
Thanks for a research (I'll do more testing next time, not just reviewing)! Actually testing it, it's really ok, due these lines in package/ltp-testsuite/ltp-testsuite.mk:
# Requires uClibc fts and bessel support, normally not enabled ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
define LTP_TESTSUITE_REMOVE_UNSUPPORTED
rm -rf $(@D)/testcases/kernel/controllers/cpuset/ rm -rf $(@D)/testcases/misc/math/float/bessel/ rm -f $(@D)/testcases/misc/math/float/float_bessel.c
endefLTP_TESTSUITE_POST_PATCH_HOOKS += LTP_TESTSUITE_REMOVE_UNSUPPORTED endif
We can either remove deleting testcases/kernel/controllers/cpuset/ as part of this patchset, or simply wait for next update (planning for the start of the second week in the May [1]), I'd remove it during the update.
Kind regards,
Petr
[1] http://lists.linux.it/pipermail/ltp/2019-April/011729.html
PATCH 1/1 ltp-testsuite: Fix uClibc build with disabled fts.h support
Quoted 11 lines · On Mon, 22 Apr 2019 19:20:51 +0200 Petr Vorel <[email protected]> wrote:
Quoted 1 line
And it builds perfectly fine.
Thanks for a research (I'll do more testing next time, not just reviewing)! Actually testing it, it's really ok, due these lines in
package/ltp-testsuite/ltp-testsuite.mk:# Requires uClibc fts and bessel support, normally not enabled ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
defineLTP_TESTSUITE_REMOVE_UNSUPPORTEDrm -rf $(@D)/testcases/kernel/controllers/cpuset/ rm -rf $(@D)/testcases/misc/math/float/bessel/ rm -f $(@D)/testcases/misc/math/float/float_bessel.c
Quoted 7 lines
endef
LTP_TESTSUITE_POST_PATCH_HOOKS+=LTP_TESTSUITE_REMOVE_UNSUPPORTEDendifWe can either remove deleting testcases/kernel/controllers/cpuset/ as part of this patchset, or simply wait for next update (planning for the start of the second week in the May [1]), I'd remove it during the update.
Yes, let's wait for the new version of ltp-testsuite. The current Buildroot package builds just fine with uClibc, I don't really see the point of adding another ltp-testsuite patch at this point.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com