summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Díaz <daniel.diaz@linaro.org>2019-02-21 12:21:03 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-25 10:56:17 +0000
commit471168b615112e8dee61a9d4722ed032873fcf78 (patch)
tree1de33dd2613e49379fd089d8bd81131aae78b4cf
parentdb3b872493e9d34dd71c552ddcdf678f01a00d95 (diff)
downloadpoky-471168b615112e8dee61a9d4722ed032873fcf78.tar.gz
ltp: Bump to 20190115
This patch has been refreshed: * 0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch These patches have been dropped as they have been merged: * 0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch * 0001-setrlimit05-Use-another-method-to-get-bad-address.patch * 0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch * 0001-statx-fix-compile-errors.patch * 0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch * 0001-getcpu01-Rename-getcpu-to-avoid-conflict-with-glibc-.patch This patch has been added: * define-sigrtmin-and-sigrtmax-for-musl.patch Added these rdependencies: * file: for ld01, file01 and logrotate * quota: for quota_remount_test01 (From OE-Core rev: d198364c1007aab6523787f9e1bb6bb274cc89ad) Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-getcpu01-Rename-getcpu-to-avoid-conflict-with-glibc-.patch57
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch45
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch6
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch61
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch75
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch35
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch184
-rw-r--r--meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch3
-rw-r--r--meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch2
-rw-r--r--meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch190
-rw-r--r--meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch2
-rw-r--r--meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch2
-rw-r--r--meta/recipes-extended/ltp/ltp/define-sigrtmin-and-sigrtmax-for-musl.patch114
-rw-r--r--meta/recipes-extended/ltp/ltp_20190115.bb (renamed from meta/recipes-extended/ltp/ltp_20180926.bb)11
14 files changed, 154 insertions, 633 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-getcpu01-Rename-getcpu-to-avoid-conflict-with-glibc-.patch b/meta/recipes-extended/ltp/ltp/0001-getcpu01-Rename-getcpu-to-avoid-conflict-with-glibc-.patch
deleted file mode 100644
index d0c847774d..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-getcpu01-Rename-getcpu-to-avoid-conflict-with-glibc-.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From c9edb0eaaca83c18ac7b5ea3330faad8d47d3fd1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 14 Dec 2018 06:44:02 -0800
4Subject: [PATCH] getcpu01: Rename getcpu to avoid conflict with glibc >= 2.29
5
6glibc has added getcpu() API starting with glibc 2.29 release, this
7makes the static function in conflict and signatures are not same as
8well.
9
10Renaming helps to keep ltp build going
11
12Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2018-December/010321.html]
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 testcases/kernel/syscalls/getcpu/getcpu01.c | 10 +++++-----
17 1 file changed, 5 insertions(+), 5 deletions(-)
18
19diff --git a/testcases/kernel/syscalls/getcpu/getcpu01.c b/testcases/kernel/syscalls/getcpu/getcpu01.c
20index c927512ca..e850fe844 100644
21--- a/testcases/kernel/syscalls/getcpu/getcpu01.c
22+++ b/testcases/kernel/syscalls/getcpu/getcpu01.c
23@@ -82,7 +82,7 @@ int sys_support = 0;
24
25 void cleanup(void);
26 void setup(void);
27-static inline int getcpu(unsigned int *, unsigned int *, void *);
28+static inline int get_cpu(unsigned int *, unsigned int *, void *);
29 unsigned int set_cpu_affinity(void);
30 unsigned int get_nodeid(unsigned int);
31 unsigned int max_cpuid(size_t, cpu_set_t *);
32@@ -124,7 +124,7 @@ int main(int ac, char **av)
33 #ifdef __i386__
34 node_set = get_nodeid(cpu_set);
35 #endif
36- TEST(getcpu(&cpu_id, &node_id, NULL));
37+ TEST(get_cpu(&cpu_id, &node_id, NULL));
38 if (TEST_RETURN == 0) {
39 if (cpu_id != cpu_set) {
40 tst_resm(TFAIL, "getcpu() returned wrong value"
41@@ -157,10 +157,10 @@ int main(int ac, char **av)
42 }
43
44 /*
45- * getcpu() - calls the system call
46+ * get_cpu() - calls the system call
47 */
48-static inline int getcpu(unsigned *cpu_id, unsigned *node_id,
49- void *cache_struct)
50+static inline int get_cpu(unsigned *cpu_id, unsigned *node_id,
51+ void *cache_struct)
52 {
53 #if defined(__i386__)
54 return syscall(318, cpu_id, node_id, cache_struct);
55--
562.20.0
57
diff --git a/meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch b/meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch
deleted file mode 100644
index 32e7a0eb25..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From 76d8343ad300f6507233abcdf97629290e35848a Mon Sep 17 00:00:00 2001
2From: Lei Yang <Lei.Yang@windriver.com>
3Date: Wed, 29 Aug 2018 11:51:24 +0800
4Subject: [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable
5
6ping6 has been merged into ping since 2015 by using "ping -6"
7in some distributions (e.g. OpenEmbedded) they dropped ping6 completely
8this patch will let both "ping -6" and ping6 work.
9
10[pvorel: change was done in s20150815:
11ebad35f ("ping: merge `ping6` command into `ping`"),
12before that release switch '-6' didn't exist.
13Upstream leaves ping6 symlink to distributions.]
14
15Upstream-Status: Backport
16[https://github.com/linux-test-project/ltp/commit/76d8343ad300f6507233abcdf97629290e35848a]
17
18Signed-off-by: Lei Yang <Lei.Yang@windriver.com>
19Signed-off-by: Petr Vorel <pvorel@suse.cz>
20Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
21---
22 testcases/kernel/containers/netns/netns_helper.sh | 7 ++++++-
23 1 file changed, 6 insertions(+), 1 deletion(-)
24
25diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
26index 6aea10b..a9d0459 100755
27--- a/testcases/kernel/containers/netns/netns_helper.sh
28+++ b/testcases/kernel/containers/netns/netns_helper.sh
29@@ -168,7 +168,12 @@ netns_setup()
30 ipv6)
31 IFCONF_IN6_ARG="inet6 add"
32 IP0=$6; IP1=$7;
33- tping="ping6"; NETMASK=64
34+ if which ping6 >/dev/null 2>&1; then
35+ tping="ping6"
36+ else
37+ tping="ping -6"
38+ fi
39+ NETMASK=64
40 ;;
41 *)
42 tst_brkm TBROK "second argument must be an ip version (ipv4|ipv6)"
43--
442.7.4
45
diff --git a/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
index 4d771c0b9c..84736053bf 100644
--- a/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
+++ b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
@@ -43,8 +43,8 @@ index de51d43..810e5c8 100644
43+ * 3. Should get ENOMEM or EINVAL. 43+ * 3. Should get ENOMEM or EINVAL.
44 */ 44 */
45 45
46 #define _XOPEN_SOURCE 600 46 #include <stdio.h>
47@@ -93,8 +93,8 @@ int main(void) 47@@ -92,8 +92,8 @@ int main(void)
48 (unsigned long)len); 48 (unsigned long)len);
49 pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 49 pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd,
50 0); 50 0);
@@ -55,7 +55,7 @@ index de51d43..810e5c8 100644
55 exit(PTS_PASS); 55 exit(PTS_PASS);
56 } 56 }
57 57
58@@ -103,6 +103,6 @@ int main(void) 58@@ -102,6 +102,6 @@ int main(void)
59 else 59 else
60 munmap(pa, len); 60 munmap(pa, len);
61 close(fd); 61 close(fd);
diff --git a/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
deleted file mode 100644
index 4bfe2767d8..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
+++ /dev/null
@@ -1,61 +0,0 @@
1From c4d02b23d12b7136b5739b3075e817fc037e41d4 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Mon, 19 Nov 2018 23:07:01 -0800
4Subject: [PATCH] setrlimit05: Use another method to get bad address
5
6This testcase fails on mips32. The process is killed by SIGBUS which
7is not as expect.
8
9This is because:
10((void *)-1) is not a legal bad address which causes the process
11killed by SIGBUG on mips.
12
13'tst_get_bad_addr()' returns an address that should works on mips
14and other arches.
15
16Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0]
17
18Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
19---
20 testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +++++++++-
21 1 file changed, 9 insertions(+), 1 deletion(-)
22
23diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
24index e7167229b4..004a149a65 100644
25--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
26+++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
27@@ -26,6 +26,8 @@
28
29 #include "tst_test.h"
30
31+static void *bad_addr;
32+
33 static void verify_setrlimit(void)
34 {
35 int status;
36@@ -33,7 +35,7 @@ static void verify_setrlimit(void)
37
38 pid = SAFE_FORK();
39 if (!pid) {
40- TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
41+ TEST(setrlimit(RLIMIT_NOFILE, bad_addr));
42 if (TST_RET != -1) {
43 tst_res(TFAIL, "setrlimit() succeeded unexpectedly");
44 exit(0);
45@@ -67,7 +69,13 @@ static void verify_setrlimit(void)
46 tst_res(TBROK, "child %s", tst_strstatus(status));
47 }
48
49+static void setup(void)
50+{
51+ bad_addr = tst_get_bad_addr(NULL);
52+}
53+
54 static struct tst_test test = {
55 .test_all = verify_setrlimit,
56 .forks_child = 1,
57+ .setup = setup,
58 };
59--
602.11.0
61
diff --git a/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch b/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
deleted file mode 100644
index c412c89e99..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1From bb977ca0716ae98f10102c7122fe15bc0ddb5356 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Thu, 20 Sep 2018 21:49:02 -0400
4Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
5
6glibc commit
7 8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
8changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
9syscall directly.
10
11So, an invalid pointer no longer crashes child process and test
12reports failure. Fix it by accepting either crash or EFAULT.
13
14Signed-off-by: Jan Stancek <jstancek@redhat.com>
15
16Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
17
18Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
19---
20 .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 30 +++++++++++++++++++---
21 1 file changed, 26 insertions(+), 4 deletions(-)
22
23diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
24index 95a9436a4..8fa8ac34b 100644
25--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
26+++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
27@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
28 tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
29 case 0:
30 signal(SIGSEGV, SIG_DFL);
31+
32+ /*
33+ * depending on glibc implementation we should
34+ * either crash or get EFAULT
35+ */
36 TEST(sigwaitinfo((void *)1, NULL, NULL));
37
38- _exit(0);
39+ if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
40+ _exit(0);
41+
42+ tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
43+ TEST_RETURN, TEST_ERRNO);
44+ _exit(1);
45+
46 break;
47 default:
48 break;
49 }
50
51 SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, &status, 0);
52- if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
53+
54+ if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
55+ || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
56 tst_resm(TPASS, "Test passed");
57- else
58- tst_resm(TFAIL, "Unrecognised child exit code");
59+ return;
60+ }
61+
62+ if (WIFEXITED(status)) {
63+ tst_resm(TFAIL, "Unrecognised child exit code: %d",
64+ WEXITSTATUS(status));
65+ }
66+ if (WIFSIGNALED(status)) {
67+ tst_resm(TFAIL, "Unrecognised child termsig: %d",
68+ WTERMSIG(status));
69+ }
70 }
71
72 void test_bad_address3(swi_func sigwaitinfo, int signo)
73--
742.11.0
75
diff --git a/meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch b/meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch
deleted file mode 100644
index 140bfeb879..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From a945304b6a2286d0665c70250cc5475eb07fd21e Mon Sep 17 00:00:00 2001
2From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
3Date: Wed, 26 Sep 2018 11:15:45 -0300
4Subject: [PATCH] statx: fix compile errors
5
6struct statx is only defined in sys/stat.h when _GNU_SOURCE is defined.
7The testcases do define _GNU_SOURCE, but not the m4 struct check.
8
9Upstream-Status: Backport
10Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
11Acked-by: Cyril Hrubis <chrubis@suse.cz>
12---
13 m4/ltp-statx.m4 | 9 +++++++--
14 1 file changed, 7 insertions(+), 2 deletions(-)
15
16diff --git a/m4/ltp-statx.m4 b/m4/ltp-statx.m4
17index 44303d30c..5f79a94cd 100644
18--- a/m4/ltp-statx.m4
19+++ b/m4/ltp-statx.m4
20@@ -23,6 +23,11 @@ dnl
21 AC_DEFUN([LTP_CHECK_STATX],[
22 AC_CHECK_FUNCS(statx,,,[[#include <sys/stat.h>]])
23 AC_CHECK_HEADER(linux/fs.h,,,)
24-AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]])
25-AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]])
26+AC_CHECK_TYPES([struct statx],,,[[
27+ #define _GNU_SOURCE
28+ #include <sys/stat.h>
29+]])
30+AC_CHECK_TYPES([struct statx_timestamp],,,[[
31+ #define _GNU_SOURCE
32+ #include <sys/stat.h>]])
33 ])
34--
352.19.1
diff --git a/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch b/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
deleted file mode 100644
index 2755596d03..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
+++ /dev/null
@@ -1,184 +0,0 @@
1From 8de03ea1200480b922d5ba05b69dc94db60496f5 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Sat, 15 Sep 2018 22:39:32 -0400
4Subject: [PATCH] syscalls/fcntl: make OFD command use fcntl64() syscall on
5 32-bit
6
7To cope with glibc commit:
8 06ab719d30b0 ("Fix Linux fcntl OFD locks for non-LFS architectures
9(BZ#20251)")
10
11WIP: Still need to test this with new glibc.
12 Test with old glibc look OK so far.
13
14Signed-off-by: Jan Stancek <jstancek@redhat.com>
15
16Upstream-Status: Backport
17 Backported from upstream maillist
18 https://lists.linux.it/pipermail/ltp/2018-September/009370.html
19
20Signed-off-by: Hongzhi Song <hongzhi.song@windriver.com>
21---
22 testcases/kernel/syscalls/fcntl/fcntl34.c | 12 +++++++---
23 testcases/kernel/syscalls/fcntl/fcntl36.c | 23 +++++++++++++-----
24 testcases/kernel/syscalls/fcntl/fcntl_common.h | 32 ++++++++++++++++++++++++++
25 3 files changed, 58 insertions(+), 9 deletions(-)
26 create mode 100644 testcases/kernel/syscalls/fcntl/fcntl_common.h
27
28diff --git a/testcases/kernel/syscalls/fcntl/fcntl34.c b/testcases/kernel/syscalls/fcntl/fcntl34.c
29index aa29cf9..109f834 100644
30--- a/testcases/kernel/syscalls/fcntl/fcntl34.c
31+++ b/testcases/kernel/syscalls/fcntl/fcntl34.c
32@@ -28,6 +28,7 @@
33 #include "lapi/fcntl.h"
34 #include "tst_safe_pthread.h"
35 #include "tst_test.h"
36+#include "fcntl_common.h"
37
38 static int thread_cnt;
39 static const int max_thread_cnt = 32;
40@@ -68,7 +69,12 @@ void *thread_fn_01(void *arg)
41
42 memset(buf, (intptr_t)arg, write_size);
43
44- struct flock64 lck = {
45+ /* see explanation in fcntl_common.h */
46+ #ifdef USE_STRUCT_FLOCK
47+ struct flock lck = {
48+ #else
49+ struct flock64 lck = {
50+ #endif
51 .l_whence = SEEK_SET,
52 .l_start = 0,
53 .l_len = 1,
54@@ -76,13 +82,13 @@ void *thread_fn_01(void *arg)
55
56 for (i = 0; i < writes_num; ++i) {
57 lck.l_type = F_WRLCK;
58- SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
59+ my_fcntl(fd, F_OFD_SETLKW, &lck);
60
61 SAFE_LSEEK(fd, 0, SEEK_END);
62 SAFE_WRITE(1, fd, buf, write_size);
63
64 lck.l_type = F_UNLCK;
65- SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
66+ my_fcntl(fd, F_OFD_SETLKW, &lck);
67
68 sched_yield();
69 }
70diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c
71index 3246d13..f263b6b 100644
72--- a/testcases/kernel/syscalls/fcntl/fcntl36.c
73+++ b/testcases/kernel/syscalls/fcntl/fcntl36.c
74@@ -57,6 +57,7 @@
75 #include "lapi/fcntl.h"
76 #include "tst_safe_pthread.h"
77 #include "tst_test.h"
78+#include "fcntl_common.h"
79
80 static int thread_cnt;
81 static int fail_flag = 0;
82@@ -87,7 +88,12 @@ static void *fn_ofd_w(void *arg)
83 int fd = SAFE_OPEN(fname, O_RDWR);
84 long wt = pa->cnt;
85
86- struct flock64 lck = {
87+ /* see explanation in fcntl_common.h */
88+ #ifdef USE_STRUCT_FLOCK
89+ struct flock lck = {
90+ #else
91+ struct flock64 lck = {
92+ #endif
93 .l_whence = SEEK_SET,
94 .l_start = pa->offset,
95 .l_len = pa->length,
96@@ -99,13 +105,13 @@ static void *fn_ofd_w(void *arg)
97 memset(buf, wt, pa->length);
98
99 lck.l_type = F_WRLCK;
100- SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
101+ my_fcntl(fd, F_OFD_SETLKW, &lck);
102
103 SAFE_LSEEK(fd, pa->offset, SEEK_SET);
104 SAFE_WRITE(1, fd, buf, pa->length);
105
106 lck.l_type = F_UNLCK;
107- SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
108+ my_fcntl(fd, F_OFD_SETLKW, &lck);
109
110 wt++;
111 if (wt >= 255)
112@@ -166,7 +172,12 @@ static void *fn_ofd_r(void *arg)
113 int i;
114 int fd = SAFE_OPEN(fname, O_RDWR);
115
116- struct flock64 lck = {
117+ /* see explanation in fcntl_common.h */
118+ #ifdef USE_STRUCT_FLOCK
119+ struct flock lck = {
120+ #else
121+ struct flock64 lck = {
122+ #endif
123 .l_whence = SEEK_SET,
124 .l_start = pa->offset,
125 .l_len = pa->length,
126@@ -178,7 +189,7 @@ static void *fn_ofd_r(void *arg)
127 memset(buf, 0, pa->length);
128
129 lck.l_type = F_RDLCK;
130- SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
131+ my_fcntl(fd, F_OFD_SETLKW, &lck);
132
133 /* rlock acquired */
134 SAFE_LSEEK(fd, pa->offset, SEEK_SET);
135@@ -209,7 +220,7 @@ static void *fn_ofd_r(void *arg)
136 }
137
138 lck.l_type = F_UNLCK;
139- SAFE_FCNTL(fd, F_OFD_SETLK, &lck);
140+ my_fcntl(fd, F_OFD_SETLK, &lck);
141
142 sched_yield();
143 }
144diff --git a/testcases/kernel/syscalls/fcntl/fcntl_common.h b/testcases/kernel/syscalls/fcntl/fcntl_common.h
145new file mode 100644
146index 0000000..3fe399b
147--- /dev/null
148+++ b/testcases/kernel/syscalls/fcntl/fcntl_common.h
149@@ -0,0 +1,32 @@
150+#include "lapi/syscalls.h"
151+
152+/*
153+ * glibc commit:
154+ * 06ab719d30b0 ("Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)")
155+ * changed behavior of arg parameter for OFD commands. It is no
156+ * longer passing arg directly to syscall, but expects it to be
157+ * 'struct flock'.
158+ *
159+ * On 64-bit or _FILE_OFFSET_BITS == 64 we can use fcntl() and
160+ * struct flock with any glibc version. struct flock and flock64
161+ * should be identical.
162+ *
163+ * On 32-bit, older glibc would pass arg directly, recent one treats
164+ * it as 'struct flock' and converts it to 'struct flock64'.
165+ * So, for 32-bit we use fcntl64 syscall directly with struct flock64.
166+ */
167+#if __WORDSIZE == 64 || _FILE_OFFSET_BITS == 64
168+#define USE_STRUCT_FLOCK
169+static int my_fcntl(int fd, int cmd, void *lck)
170+{
171+ return SAFE_FCNTL(fd, cmd, lck);
172+}
173+#else
174+static int my_fcntl(int fd, int cmd, void *lck)
175+{
176+ int ret = tst_syscall(__NR_fcntl64, fd, cmd, lck);
177+ if (ret == -1)
178+ tst_brk(TBROK|TERRNO, "fcntl64");
179+ return ret;
180+}
181+#endif
182--
1832.8.1
184
diff --git a/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch b/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch
index 2df385591b..3c66c9436f 100644
--- a/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch
+++ b/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch
@@ -42,7 +42,7 @@ diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
42index 50a12fa..4f1987f 100644 42index 50a12fa..4f1987f 100644
43--- a/testcases/kernel/Makefile 43--- a/testcases/kernel/Makefile
44+++ b/testcases/kernel/Makefile 44+++ b/testcases/kernel/Makefile
45@@ -48,13 +48,16 @@ SUBDIRS += connectors \ 45@@ -49,12 +49,15 @@ SUBDIRS += connectors \
46 logging \ 46 logging \
47 mem \ 47 mem \
48 numa \ 48 numa \
@@ -51,7 +51,6 @@ index 50a12fa..4f1987f 100644
51 security \ 51 security \
52 timers \ 52 timers \
53 tracing \ 53 tracing \
54 module \
55 54
56+ifneq ($(LIBC),musl) 55+ifneq ($(LIBC),musl)
57+SUBDIRS += pty 56+SUBDIRS += pty
diff --git a/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch b/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch
index 2f4ca63750..6e6dbf398b 100644
--- a/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch
+++ b/meta/recipes-extended/ltp/ltp/0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch
@@ -16,7 +16,7 @@ diff --git a/include/old/test.h b/include/old/test.h
16index b36764d83..cc6f1b551 100644 16index b36764d83..cc6f1b551 100644
17--- a/include/old/test.h 17--- a/include/old/test.h
18+++ b/include/old/test.h 18+++ b/include/old/test.h
19@@ -44,6 +44,9 @@ 19@@ -17,6 +17,9 @@
20 #include <string.h> 20 #include <string.h>
21 #include <stdlib.h> 21 #include <stdlib.h>
22 #include <stdint.h> 22 #include <stdint.h>
diff --git a/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch b/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
index 428ac30049..7311ee2e41 100644
--- a/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
+++ b/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
@@ -1,7 +1,7 @@
1From a3cbee31daae2466bc8dcac36b33a01352693346 Mon Sep 17 00:00:00 2001 1From fc2b47ad979a87bfbd11aeea3f67c26e7fb39e30 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 7 Jan 2016 19:40:08 +0000 3Date: Thu, 7 Jan 2016 19:40:08 +0000
4Subject: [PATCH 01/26] Check if __GLIBC_PREREQ is defined before using it 4Subject: [PATCH] Check if __GLIBC_PREREQ is defined before using it
5 5
6__GLIBC_PREREQ is specific to glibc so it should be checked if it is 6__GLIBC_PREREQ is specific to glibc so it should be checked if it is
7defined or not. 7defined or not.
@@ -10,13 +10,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 10
11Upstream-Status: Pending 11Upstream-Status: Pending
12--- 12---
13 testcases/kernel/syscalls/accept4/accept4_01.c | 9 ++++- 13 .../kernel/syscalls/accept4/accept4_01.c | 9 ++++++-
14 testcases/kernel/syscalls/getcpu/getcpu01.c | 39 +++++++++++++++++++++- 14 .../sched_getaffinity/sched_getaffinity01.c | 26 +++++++++++++++++++
15 .../sched_getaffinity/sched_getaffinity01.c | 26 +++++++++++++++ 15 2 files changed, 34 insertions(+), 1 deletion(-)
16 3 files changed, 72 insertions(+), 2 deletions(-)
17 16
18diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c 17diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c
19index 6072bfa..2b090cb 100644 18index dec4ef93b..c5d74b07f 100644
20--- a/testcases/kernel/syscalls/accept4/accept4_01.c 19--- a/testcases/kernel/syscalls/accept4/accept4_01.c
21+++ b/testcases/kernel/syscalls/accept4/accept4_01.c 20+++ b/testcases/kernel/syscalls/accept4/accept4_01.c
22@@ -64,6 +64,7 @@ static void cleanup(void) 21@@ -64,6 +64,7 @@ static void cleanup(void)
@@ -59,131 +58,8 @@ index 6072bfa..2b090cb 100644
59 #else 58 #else
60 acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen, 59 acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen,
61 closeonexec_flag | nonblock_flag); 60 closeonexec_flag | nonblock_flag);
62diff --git a/testcases/kernel/syscalls/getcpu/getcpu01.c b/testcases/kernel/syscalls/getcpu/getcpu01.c
63index c927512..921b107 100644
64--- a/testcases/kernel/syscalls/getcpu/getcpu01.c
65+++ b/testcases/kernel/syscalls/getcpu/getcpu01.c
66@@ -62,6 +62,7 @@
67 #include <dirent.h>
68
69 #if defined(__i386__) || defined(__x86_64__)
70+#if defined(__GLIBC__)
71 #if __GLIBC_PREREQ(2,6)
72 #if defined(__x86_64__)
73 #include <utmpx.h>
74@@ -75,10 +76,17 @@ int sys_support = 0;
75 #else
76 int sys_support = 0;
77 #endif
78+#else
79+int sys_support = 0;
80+#endif
81
82+#if defined(__GLIBC__)
83 #if !(__GLIBC_PREREQ(2, 7))
84 #define CPU_FREE(ptr) free(ptr)
85 #endif
86+#else
87+#define CPU_FREE(ptr) free(ptr)
88+#endif
89
90 void cleanup(void);
91 void setup(void);
92@@ -164,7 +172,11 @@ static inline int getcpu(unsigned *cpu_id, unsigned *node_id,
93 {
94 #if defined(__i386__)
95 return syscall(318, cpu_id, node_id, cache_struct);
96-#elif __GLIBC_PREREQ(2,6)
97+#elif defined(__GLIBC__)
98+#if __GLIBC_PREREQ(2,6)
99+ *cpu_id = sched_getcpu();
100+#endif
101+#else
102 *cpu_id = sched_getcpu();
103 #endif
104 return 0;
105@@ -191,15 +203,20 @@ unsigned int set_cpu_affinity(void)
106 cpu_set_t *set;
107 size_t size;
108 int nrcpus = 1024;
109+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
110 #if __GLIBC_PREREQ(2, 7)
111 realloc:
112 set = CPU_ALLOC(nrcpus);
113 #else
114 set = malloc(sizeof(cpu_set_t));
115 #endif
116+#else
117+ set = malloc(sizeof(cpu_set_t));
118+#endif
119 if (set == NULL) {
120 tst_brkm(TFAIL, NULL, "CPU_ALLOC:errno:%d", errno);
121 }
122+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
123 #if __GLIBC_PREREQ(2, 7)
124 size = CPU_ALLOC_SIZE(nrcpus);
125 CPU_ZERO_S(size, set);
126@@ -207,8 +224,13 @@ realloc:
127 size = sizeof(cpu_set_t);
128 CPU_ZERO(set);
129 #endif
130+#else
131+ size = sizeof(cpu_set_t);
132+ CPU_ZERO(set);
133+#endif
134 if (sched_getaffinity(0, size, set) < 0) {
135 CPU_FREE(set);
136+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
137 #if __GLIBC_PREREQ(2, 7)
138 if (errno == EINVAL && nrcpus < (1024 << 8)) {
139 nrcpus = nrcpus << 2;
140@@ -220,10 +242,17 @@ realloc:
141 "NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)");
142 else
143 #endif
144+#else
145+ if (errno == EINVAL)
146+ tst_resm(TFAIL,
147+ "NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)");
148+ else
149+#endif
150 tst_resm(TFAIL, "sched_getaffinity:errno:%d", errno);
151 tst_exit();
152 }
153 cpu_max = max_cpuid(size, set);
154+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
155 #if __GLIBC_PREREQ(2, 7)
156 CPU_ZERO_S(size, set);
157 CPU_SET_S(cpu_max, size, set);
158@@ -231,6 +260,10 @@ realloc:
159 CPU_ZERO(set);
160 CPU_SET(cpu_max, set);
161 #endif
162+#else
163+ CPU_ZERO(set);
164+ CPU_SET(cpu_max, set);
165+#endif
166 if (sched_setaffinity(0, size, set) < 0) {
167 CPU_FREE(set);
168 tst_brkm(TFAIL, NULL, "sched_setaffinity:errno:%d", errno);
169@@ -247,11 +280,15 @@ unsigned int max_cpuid(size_t size, cpu_set_t * set)
170 {
171 unsigned int index, max = 0;
172 for (index = 0; index < size * BITS_PER_BYTE; index++)
173+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
174 #if __GLIBC_PREREQ(2, 7)
175 if (CPU_ISSET_S(index, size, set))
176 #else
177 if (CPU_ISSET(index, set))
178 #endif
179+#else
180+ if (CPU_ISSET(index, set))
181+#endif
182 max = index;
183 return max;
184 }
185diff --git a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c 61diff --git a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
186index 9d6a81a..4ed13b2 100644 62index 02f04b909..d906d7e09 100644
187--- a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c 63--- a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
188+++ b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c 64+++ b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
189@@ -67,9 +67,11 @@ do { \ 65@@ -67,9 +67,11 @@ do { \
@@ -198,7 +74,7 @@ index 9d6a81a..4ed13b2 100644
198 74
199 int main(int ac, char **av) 75 int main(int ac, char **av)
200 { 76 {
201@@ -96,14 +98,19 @@ static void do_test(void) 77@@ -96,17 +98,26 @@ static void do_test(void)
202 pid_t unused_pid; 78 pid_t unused_pid;
203 unsigned len; 79 unsigned len;
204 80
@@ -206,27 +82,26 @@ index 9d6a81a..4ed13b2 100644
206 #if __GLIBC_PREREQ(2, 7) 82 #if __GLIBC_PREREQ(2, 7)
207 realloc: 83 realloc:
208 mask = CPU_ALLOC(nrcpus); 84 mask = CPU_ALLOC(nrcpus);
209 #else
210 mask = malloc(sizeof(cpu_set_t));
211 #endif
212+#else 85+#else
213+ mask = malloc(sizeof(cpu_set_t)); 86+ mask = malloc(sizeof(cpu_set_t));
214+#endif 87+#endif
88 #else
89 mask = malloc(sizeof(cpu_set_t));
90 #endif
215 if (mask == NULL) 91 if (mask == NULL)
216 tst_brkm(TFAIL | TTERRNO, cleanup, "fail to get enough memory"); 92 tst_brkm(TFAIL | TTERRNO, cleanup, "fail to get enough memory");
217+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) 93+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
218 #if __GLIBC_PREREQ(2, 7) 94 #if __GLIBC_PREREQ(2, 7)
219 len = CPU_ALLOC_SIZE(nrcpus); 95 len = CPU_ALLOC_SIZE(nrcpus);
220 CPU_ZERO_S(len, mask); 96 CPU_ZERO_S(len, mask);
221@@ -111,10 +118,15 @@ realloc:
222 len = sizeof(cpu_set_t);
223 CPU_ZERO(mask);
224 #endif
225+#else 97+#else
226+ len = sizeof(cpu_set_t); 98+ len = sizeof(cpu_set_t);
227+ CPU_ZERO(mask); 99+ CPU_ZERO(mask);
228+#endif 100+#endif
229 /* positive test */ 101 #else
102 len = sizeof(cpu_set_t);
103 CPU_ZERO(mask);
104@@ -115,11 +126,18 @@ realloc:
230 TEST(sched_getaffinity(0, len, mask)); 105 TEST(sched_getaffinity(0, len, mask));
231 if (TEST_RETURN == -1) { 106 if (TEST_RETURN == -1) {
232 CPU_FREE(mask); 107 CPU_FREE(mask);
@@ -234,50 +109,43 @@ index 9d6a81a..4ed13b2 100644
234 #if __GLIBC_PREREQ(2, 7) 109 #if __GLIBC_PREREQ(2, 7)
235 if (errno == EINVAL && nrcpus < (1024 << 8)) { 110 if (errno == EINVAL && nrcpus < (1024 << 8)) {
236 nrcpus = nrcpus << 2; 111 nrcpus = nrcpus << 2;
237@@ -126,17 +138,27 @@ realloc: 112 goto realloc;
238 "newer glibc(>= 2.7)"); 113 }
239 else
240 #endif
241+#else 114+#else
242+ if (errno == EINVAL) 115+ if (errno == EINVAL)
243+ tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a " 116+ tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a "
244+ "newer glibc(>= 2.7)"); 117+ "newer glibc(>= 2.7)");
245+ else 118+ else
246+#endif 119+#endif
247 tst_resm(TFAIL | TTERRNO, "fail to get cpu affinity"); 120 #else
248 cleanup(); 121 if (errno == EINVAL)
249 } else { 122 tst_resm(TFAIL, "NR_CPUS > 1024, we'd better use a "
123@@ -132,8 +150,12 @@ realloc:
250 tst_resm(TINFO, "cpusetsize is %d", len); 124 tst_resm(TINFO, "cpusetsize is %d", len);
251 tst_resm(TINFO, "mask.__bits[0] = %lu ", mask->__bits[0]); 125 tst_resm(TINFO, "mask.__bits[0] = %lu ", mask->__bits[0]);
252 for (i = 0; i < num; i++) { 126 for (i = 0; i < num; i++) {
253+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) 127+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
254 #if __GLIBC_PREREQ(2, 7) 128 #if __GLIBC_PREREQ(2, 7)
255 TEST(CPU_ISSET_S(i, len, mask)); 129 TEST(CPU_ISSET_S(i, len, mask));
256 #else
257 TEST(CPU_ISSET(i, mask));
258 #endif
259+#else 130+#else
260+ TEST(CPU_ISSET(i, mask)); 131+ TEST(CPU_ISSET(i, mask));
261+#endif 132+#endif
262 if (TEST_RETURN != -1) 133 #else
263 tst_resm(TPASS, "sched_getaffinity() succeed, " 134 TEST(CPU_ISSET(i, mask));
264 "this process %d is running " 135 #endif
265@@ -144,11 +166,15 @@ realloc: 136@@ -144,8 +166,12 @@ realloc:
266 } 137 }
267 } 138 }
268 139
269+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) 140+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
270 #if __GLIBC_PREREQ(2, 7) 141 #if __GLIBC_PREREQ(2, 7)
271 CPU_ZERO_S(len, mask); 142 CPU_ZERO_S(len, mask);
272 #else
273 CPU_ZERO(mask);
274 #endif
275+#else 143+#else
276+ CPU_ZERO(mask); 144+ CPU_ZERO(mask);
277+#endif 145+#endif
278 /* negative tests */ 146 #else
279 QUICK_TEST(sched_getaffinity(0, len, (cpu_set_t *) - 1)); 147 CPU_ZERO(mask);
280 QUICK_TEST(sched_getaffinity(0, 0, mask)); 148 #endif
281-- 149--
2821.9.1 1502.17.1
283 151
diff --git a/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch b/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch
index 71e32a5e51..665da3bef3 100644
--- a/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch
+++ b/meta/recipes-extended/ltp/ltp/0035-fix-test_proc_kill-hang.patch
@@ -19,7 +19,7 @@ diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testca
19index b785fe3..2918cc5 100755 19index b785fe3..2918cc5 100755
20--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh 20--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
21+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh 21+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
22@@ -283,6 +283,7 @@ test_proc_kill() 22@@ -291,6 +291,7 @@ test_proc_kill()
23 pid=$! 23 pid=$!
24 TST_CHECKPOINT_WAIT 0 24 TST_CHECKPOINT_WAIT 0
25 echo $pid > tasks 25 echo $pid > tasks
diff --git a/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch b/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch
index 9244a06b44..ec5e2ef95a 100644
--- a/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch
+++ b/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch
@@ -32,7 +32,7 @@ index be105f6da..813a51d9c 100644
32 TST_TESTFUNC=test 32 TST_TESTFUNC=test
33 TST_NEEDS_TMPDIR=1 33 TST_NEEDS_TMPDIR=1
34 TST_NEEDS_CMDS="$AR" 34 TST_NEEDS_CMDS="$AR"
35 35
36 . tst_test.sh 36 . tst_test.sh
37 37
38+setup() 38+setup()
diff --git a/meta/recipes-extended/ltp/ltp/define-sigrtmin-and-sigrtmax-for-musl.patch b/meta/recipes-extended/ltp/ltp/define-sigrtmin-and-sigrtmax-for-musl.patch
new file mode 100644
index 0000000000..c324463e62
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/define-sigrtmin-and-sigrtmax-for-musl.patch
@@ -0,0 +1,114 @@
1From 34b91edc70709f32b44f6b3a32c8f18db393e36c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
3Date: Wed, 20 Feb 2019 08:07:27 -0600
4Subject: [PATCH] Define __SIGRTMIN and __SIGRTMAX for MUSL
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Some libc implementations might differ in the definitions they
10include. Exempli gratia: MUSL does not define __SIGRTMAX nor
11__SIGRTMIN.
12
13These two tests fail to build because of the missing
14definitions:
15 testcases/kernel/syscalls/ptrace/ptrace05.c
16 testcases/kernel/syscalls/sighold/sighold02.c
17
18Out of precaution, these two also include this header:
19 lib/tst_sig.c
20 testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
21
22Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2019-February/010916.html]
23
24Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
25---
26 include/lapi/signal.h | 24 +++++++++++++++++++
27 lib/tst_sig.c | 1 +
28 testcases/kernel/syscalls/ptrace/ptrace05.c | 1 +
29 .../syscalls/rt_sigsuspend/rt_sigsuspend01.c | 1 +
30 testcases/kernel/syscalls/sighold/sighold02.c | 1 +
31 5 files changed, 28 insertions(+)
32 create mode 100644 include/lapi/signal.h
33
34diff --git a/include/lapi/signal.h b/include/lapi/signal.h
35new file mode 100644
36index 000000000..d22965a94
37--- /dev/null
38+++ b/include/lapi/signal.h
39@@ -0,0 +1,24 @@
40+// SPDX-License-Identifier: GPL-2.0-or-later
41+/*
42+ * Copyright (c) 2019 Linaro Limited. All rights reserved.
43+ * Author: Daniel Díaz <daniel.diaz@linaro.org>
44+ */
45+
46+#ifndef LAPI_SIGNAL_H
47+#define LAPI_SIGNAL_H
48+
49+#include <signal.h>
50+
51+/*
52+ * Some libc implementations might differ in the definitions they include. This
53+ * covers those differences for all tests to successfully build.
54+ */
55+
56+#ifndef __SIGRTMIN
57+# define __SIGRTMIN 32
58+#endif
59+#ifndef __SIGRTMAX
60+# define __SIGRTMAX (_NSIG - 1)
61+#endif
62+
63+#endif
64diff --git a/lib/tst_sig.c b/lib/tst_sig.c
65index 36565e13d..6d77aeafd 100644
66--- a/lib/tst_sig.c
67+++ b/lib/tst_sig.c
68@@ -72,6 +72,7 @@
69 #include <signal.h>
70 #include <unistd.h>
71 #include "test.h"
72+#include "lapi/signal.h"
73
74 #define MAXMESG 150 /* size of mesg string sent to tst_res */
75
76diff --git a/testcases/kernel/syscalls/ptrace/ptrace05.c b/testcases/kernel/syscalls/ptrace/ptrace05.c
77index 420330029..54cfa4d7b 100644
78--- a/testcases/kernel/syscalls/ptrace/ptrace05.c
79+++ b/testcases/kernel/syscalls/ptrace/ptrace05.c
80@@ -38,6 +38,7 @@
81 #include "ptrace.h"
82
83 #include "test.h"
84+#include "lapi/signal.h"
85
86 char *TCID = "ptrace05";
87 int TST_TOTAL = 0;
88diff --git a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
89index f17a9aae6..e577cf227 100644
90--- a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
91+++ b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
92@@ -18,6 +18,7 @@
93 #include "tst_test.h"
94 #include "lapi/syscalls.h"
95 #include "lapi/safe_rt_signal.h"
96+#include "lapi/signal.h"
97
98 static void sig_handler(int sig)
99 {
100diff --git a/testcases/kernel/syscalls/sighold/sighold02.c b/testcases/kernel/syscalls/sighold/sighold02.c
101index d1d4b0b06..b763142df 100644
102--- a/testcases/kernel/syscalls/sighold/sighold02.c
103+++ b/testcases/kernel/syscalls/sighold/sighold02.c
104@@ -49,6 +49,7 @@
105 #include <sys/wait.h>
106 #include "test.h"
107 #include "safe_macros.h"
108+#include "lapi/signal.h"
109
110 /* _XOPEN_SOURCE disables NSIG */
111 #ifndef NSIG
112--
1132.17.1
114
diff --git a/meta/recipes-extended/ltp/ltp_20180926.bb b/meta/recipes-extended/ltp/ltp_20190115.bb
index 99e7023b25..4bc9224a1d 100644
--- a/meta/recipes-extended/ltp/ltp_20180926.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -27,7 +27,7 @@ CFLAGS_append_x86-64 = " -fomit-frame-pointer"
27 27
28CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__" 28CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
29CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__" 29CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
30SRCREV = "f424769b1ad9fca477118763f88a6cec98ea2c0a" 30SRCREV = "a6a5caef13632e669dda27b0461726eba546a2f3"
31 31
32SRC_URI = "git://github.com/linux-test-project/ltp.git \ 32SRC_URI = "git://github.com/linux-test-project/ltp.git \
33 file://0004-build-Add-option-to-select-libc-implementation.patch \ 33 file://0004-build-Add-option-to-select-libc-implementation.patch \
@@ -46,13 +46,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
46 file://0035-fix-test_proc_kill-hang.patch \ 46 file://0035-fix-test_proc_kill-hang.patch \
47 file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ 47 file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \
48 file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \ 48 file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \
49 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
50 file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
51 file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \
52 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \ 49 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
53 file://0001-statx-fix-compile-errors.patch \ 50 file://define-sigrtmin-and-sigrtmax-for-musl.patch \
54 file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \
55 file://0001-getcpu01-Rename-getcpu-to-avoid-conflict-with-glibc-.patch \
56 " 51 "
57 52
58S = "${WORKDIR}/git" 53S = "${WORKDIR}/git"
@@ -96,6 +91,7 @@ RDEPENDS_${PN} = "\
96 curl \ 91 curl \
97 e2fsprogs-mke2fs \ 92 e2fsprogs-mke2fs \
98 expect \ 93 expect \
94 file \
99 gawk \ 95 gawk \
100 gzip \ 96 gzip \
101 iproute2 \ 97 iproute2 \
@@ -105,6 +101,7 @@ RDEPENDS_${PN} = "\
105 perl \ 101 perl \
106 python-core \ 102 python-core \
107 procps \ 103 procps \
104 quota \
108 unzip \ 105 unzip \
109 util-linux \ 106 util-linux \
110 which \ 107 which \