ltp-testsuite: Enable build under musl
RFC PATCH 1/1 ltp-testsuite: Enable build under musl
This requires to remove a lot of broken code until it's fixed in upstream.
+ backport upstream patch 6511fcf26 ("Define __SIGRTMIN and __SIGRTMAX for MUSL") and add 8 upstreamed patches (to be included in a next release after 20190115) and 1 (10th) not yet upstreamed.
8th patch requires to rerun autotools and also solve the need of removing cpuset for uClibc.
---
Hi,
I guess this patch is not acceptable due deleting quite a lot of the code from LTP. Slowly working on fixing MUSL in upstream.
Kind regards,
Petr
--- ...e-__SIGRTMIN-and-__SIGRTMAX-for-MUSL.patch | 112 ++++ ...fine-_GNU_SOURCE-to-get-SA_NOMASK-on.patch | 82 +++ ...eplace-libc-specific-sighandler_t-by.patch | 37 ++ ...int-instead-of-enum-__ptrace_request.patch | 55 ++ ...NU_SOURCE-to-get-MREMAP_MAYMOVE-on-M.patch | 90 +++ .../0007-mallopt-Test-only-on-glibc.patch | 39 ++ .../0008-cpuset-Detect-missing-fts.h.patch | 72 +++ ...msgrcv-msgrcv08-Rename-struct-msgbuf.patch | 41 ++ ...-TST_ABI-32-64-to-detect-target-type.patch | 604 ++++++++++++++++++ package/ltp-testsuite/Config.in | 3 +- package/ltp-testsuite/ltp-testsuite.mk | 42 +- 11 files changed, 1172 insertions(+), 5 deletions(-) create mode 100644 package/ltp-testsuite/0002-Define-__SIGRTMIN-and-__SIGRTMAX-for-MUSL.patch create mode 100644 package/ltp-testsuite/0003-rt_-sigaction-Define-_GNU_SOURCE-to-get-SA_NOMASK-on.patch create mode 100644 package/ltp-testsuite/0004-rt_sigaction.h-Replace-libc-specific-sighandler_t-by.patch create mode 100644 package/ltp-testsuite/0005-ptrace-Use-int-instead-of-enum-__ptrace_request.patch create mode 100644 package/ltp-testsuite/0006-mremap-Define-_GNU_SOURCE-to-get-MREMAP_MAYMOVE-on-M.patch create mode 100644 package/ltp-testsuite/0007-mallopt-Test-only-on-glibc.patch create mode 100644 package/ltp-testsuite/0008-cpuset-Detect-missing-fts.h.patch create mode 100644 package/ltp-testsuite/0009-msgrcv-msgrcv08-Rename-struct-msgbuf.patch create mode 100644 package/ltp-testsuite/0010-lapi-Define-TST_ABI-32-64-to-detect-target-type.patch
package/ltp-testsuite/0002-Define-__SIGRTMIN-and-__SIGRTMAX-for-MUSL.patch new file +112 -0
@@ -0,0 +1,112 @@ +rom 6511fcf26dc251c0b4eb6ec7bb4325b6a1bbcd6b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <[email protected]> +Date: Thu, 21 Feb 2019 10:42:13 -0600 +Subject: [PATCH] Define __SIGRTMIN and __SIGRTMAX for MUSL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some libc implementations might differ in the definitions they +include. Exempli gratia: MUSL does not define __SIGRTMAX nor +__SIGRTMIN. + +These two tests fail to build because of the missing +definitions: + testcases/kernel/syscalls/ptrace/ptrace05.c + testcases/kernel/syscalls/sighold/sighold02.c + +Out of precaution, these two also include this header: + lib/tst_sig.c + testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c + +Signed-off-by: Daniel Díaz <[email protected]> +Signed-off-by: Petr Vorel <[email protected]> +--- + include/lapi/signal.h | 24 +++++++++++++++++++ + lib/tst_sig.c | 1 + + testcases/kernel/syscalls/ptrace/ptrace05.c | 1 + + .../syscalls/rt_sigsuspend/rt_sigsuspend01.c | 1 + + testcases/kernel/syscalls/sighold/sighold02.c | 1 + + 5 files changed, 28 insertions(+) + create mode 100644 include/lapi/signal.h + +diff --git a/include/lapi/signal.h b/include/lapi/signal.h +new file mode 100644 +index 000000000..d22965a94 +--- /dev/null ++++ b/include/lapi/signal.h +@@ -0,0 +1,24 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Copyright (c) 2019 Linaro Limited. All rights reserved. ++ * Author: Daniel Díaz <[email protected]> ++ */ ++ ++#ifndef LAPI_SIGNAL_H ++#define LAPI_SIGNAL_H ++ ++#include <signal.h> ++ ++/* ++ * Some libc implementations might differ in the definitions they include. This ++ * covers those differences for all tests to successfully build. ++ */ ++ ++#ifndef __SIGRTMIN ++# define __SIGRTMIN 32 ++#endif ++#ifndef __SIGRTMAX ++# define __SIGRTMAX (_NSIG - 1) ++#endif ++ ++#endif +diff --git a/lib/tst_sig.c b/lib/tst_sig.c +index 36565e13d..6d77aeafd 100644 +--- a/lib/tst_sig.c ++++ b/lib/tst_sig.c +@@ -72,6 +72,7 @@ + #include <signal.h> + #include <unistd.h> + #include "test.h" ++#include "lapi/signal.h" + + #define MAXMESG 150 /* size of mesg string sent to tst_res */ + +diff --git a/testcases/kernel/syscalls/ptrace/ptrace05.c b/testcases/kernel/syscalls/ptrace/ptrace05.c +index 420330029..54cfa4d7b 100644 +--- a/testcases/kernel/syscalls/ptrace/ptrace05.c ++++ b/testcases/kernel/syscalls/ptrace/ptrace05.c +@@ -38,6 +38,7 @@ + #include "ptrace.h" + + #include "test.h" ++#include "lapi/signal.h" + + char *TCID = "ptrace05"; + int TST_TOTAL = 0; +diff --git a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c +index f17a9aae6..e577cf227 100644 +--- a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c ++++ b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c +@@ -18,6 +18,7 @@ + #include "tst_test.h" + #include "lapi/syscalls.h" + #include "lapi/safe_rt_signal.h" ++#include "lapi/signal.h" + + static void sig_handler(int sig) + { +diff --git a/testcases/kernel/syscalls/sighold/sighold02.c b/testcases/kernel/syscalls/sighold/sighold02.c +index d1d4b0b06..b763142df 100644 +--- a/testcases/kernel/syscalls/sighold/sighold02.c ++++ b/testcases/kernel/syscalls/sighold/sighold02.c +@@ -49,6 +49,7 @@ + #include <sys/wait.h> + #include "test.h" + #include "safe_macros.h" ++#include "lapi/signal.h" + + /* _XOPEN_SOURCE disables NSIG */ + #ifndef NSIG +-- +2.21.0
package/ltp-testsuite/0003-rt_-sigaction-Define-_GNU_SOURCE-to-get-SA_NOMASK-on.patch new file +82 -0
82 lines not on this page · raw message
package/ltp-testsuite/0004-rt_sigaction.h-Replace-libc-specific-sighandler_t-by.patch new file +37 -0
@@ -0,0 +1,37 @@ +From 14494baf9a148eb5ca7ec4cfb98f95a5d82c3ec7 Mon Sep 17 00:00:00 2001 +From: Petr Vorel <[email protected]> +Date: Mon, 18 Mar 2019 19:01:11 +0100 +Subject: [PATCH] rt_sigaction.h: Replace libc specific sighandler_t by POSIX + +__sighandler_t is libc implementation specific and should not be relied +upon. Thus use (*)(int), as specified by POSIX. + +This fixes MUSL build. + +Suggested-by: Cyril Hrubis <[email protected]> +Signed-off-by: Petr Vorel <[email protected]> +--- + include/lapi/rt_sigaction.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h +index 2dbbc7672..29068eb67 100644 +--- a/include/lapi/rt_sigaction.h ++++ b/include/lapi/rt_sigaction.h +@@ -36,12 +36,12 @@ + #if defined(__mips__) + struct kernel_sigaction { + unsigned int sa_flags; +- __sighandler_t k_sa_handler; ++ void (* k_sa_handler)(int); + sigset_t sa_mask; + }; + #else + struct kernel_sigaction { +- __sighandler_t k_sa_handler; ++ void (* k_sa_handler)(int); + unsigned long sa_flags; + void (*sa_restorer) (void); + sigset_t sa_mask; +-- +2.21.0
package/ltp-testsuite/0005-ptrace-Use-int-instead-of-enum-__ptrace_request.patch new file +55 -0
55 lines not on this page · raw message
package/ltp-testsuite/0006-mremap-Define-_GNU_SOURCE-to-get-MREMAP_MAYMOVE-on-M.patch new file +90 -0
90 lines not on this page · raw message
package/ltp-testsuite/0007-mallopt-Test-only-on-glibc.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 642f56cd21f5e5d3bc7cad7a8ffd998c006eb910 Mon Sep 17 00:00:00 2001 +From: Petr Vorel <[email protected]> +Date: Mon, 18 Mar 2019 02:49:06 +0100 +Subject: [PATCH] mallopt: Test only on glibc + +Test works with is glibc specific definitions M_MXFAST , M_NLBLKS, which +aren't supported on other libc (uClibc, MUSL, Bionic), probably no other +libc will ever define. +uClibc also defines them in headers, that's we explicitly check glibc. + +Signed-off-by: Petr Vorel <[email protected]> +--- + testcases/kernel/syscalls/mallopt/mallopt01.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/testcases/kernel/syscalls/mallopt/mallopt01.c b/testcases/kernel/syscalls/mallopt/mallopt01.c +index 416fc48be..14e26dd81 100644 +--- a/testcases/kernel/syscalls/mallopt/mallopt01.c ++++ b/testcases/kernel/syscalls/mallopt/mallopt01.c +@@ -63,7 +63,7 @@ extern int tst_COUNT; /* Test Case counter for tst_routines */ + + void printinfo(); + +-#if !defined(UCLINUX) ++#if defined(__GLIBC__) + struct mallinfo info; + + int main(int argc, char *argv[]) +@@ -150,6 +150,6 @@ void printinfo(void) + #else + int main(void) + { +- tst_brkm(TCONF, NULL, "test is not available on uClinux"); ++ tst_brkm(TCONF, NULL, "mallopt defined only for glibc"); + } +-#endif /* if !defined(UCLINUX) */ ++#endif +-- +2.21.0
package/ltp-testsuite/0008-cpuset-Detect-missing-fts.h.patch new file +72 -0
72 lines not on this page · raw message
package/ltp-testsuite/0009-msgrcv-msgrcv08-Rename-struct-msgbuf.patch new file +41 -0
41 lines not on this page · raw message
package/ltp-testsuite/0010-lapi-Define-TST_ABI-32-64-to-detect-target-type.patch new file +604 -0
604 lines not on this page · raw message
package/ltp-testsuite/Config.in +1 -2
@@ -12,7 +12,6 @@ config BR2_PACKAGE_LTP_TESTSUITE bool "ltp-testsuite" depends on BR2_USE_MMU # fork() depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL - depends on !BR2_TOOLCHAIN_USES_MUSL depends on BR2_PACKAGE_LTP_TESTSUITE_ARCH_SUPPORTS select BR2_PACKAGE_LIBTIRPC if !BR2_TOOLCHAIN_HAS_NATIVE_RPC help
@@ -23,4 +22,4 @@ config BR2_PACKAGE_LTP_TESTSUITE comment "ltp-testsuite needs a glibc or uClibc toolchain w/ NPTL" depends on BR2_PACKAGE_LTP_TESTSUITE_ARCH_SUPPORTS depends on BR2_USE_MMU - depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_TOOLCHAIN_USES_MUSL + depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL
package/ltp-testsuite/ltp-testsuite.mk +39 -3
55 lines not on this page · raw message
Signature · 1 line
2.21.0
RFC PATCH 1/1 ltp-testsuite: Enable build under musl
Hi,
oops, wrong list, I'm sorry.
Kind regards,
Petr