]> code.ossystems Code Review - openembedded-core.git/commitdiff
valgrind: Fix ptest swapcontext.vgtest
authorYi Fan Yu <yifan.yu@windriver.com>
Mon, 12 Apr 2021 20:48:18 +0000 (13:48 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 18 Apr 2021 10:29:04 +0000 (11:29 +0100)
Backport an upstream patch.
to limit the amount of stackstrace present.

Revert "valgrind: Disable ptest swapcontext.vgtest"
Effectively reverts commit 9dff5766f5795bb02677050045f24365f68bbc1a.

[YOCTO #14324]

Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/valgrind/valgrind/0001-Disable-temporarily-drd-tests-swapcontext.vgtest.patch [deleted file]
meta/recipes-devtools/valgrind/valgrind/0001-drd-tests-swapcontext-Add-SIGALRM-handler-to-avoid-s.patch [new file with mode: 0644]
meta/recipes-devtools/valgrind/valgrind_3.17.0.bb

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-Disable-temporarily-drd-tests-swapcontext.vgtest.patch b/meta/recipes-devtools/valgrind/valgrind/0001-Disable-temporarily-drd-tests-swapcontext.vgtest.patch
deleted file mode 100644 (file)
index 10ec06c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-From 0f1814a618eff4233e9e8379a8cb2dededdc5a8b Mon Sep 17 00:00:00 2001
-From: Yi Fan Yu <yifan.yu@windriver.com>
-Date: Tue, 23 Mar 2021 11:09:20 -0700
-Subject: [PATCH] Disable temporarily drd/tests/swapcontext.vgtest
-
-New test introduced in valgrind 3.17.0.
-Test fails on both qemuarm64 and qemux64.
-
-Upstream-Status: Pending [Needs more Investigation]
-[YOCTO #14324]
-
-Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
----
- drd/tests/swapcontext.vgtest | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drd/tests/swapcontext.vgtest b/drd/tests/swapcontext.vgtest
-index 98e3712c4..5492da31d 100644
---- a/drd/tests/swapcontext.vgtest
-+++ b/drd/tests/swapcontext.vgtest
-@@ -1,4 +1,4 @@
--prereq: test -e swapcontext && ./supported_libpthread
-+prereq: false
- vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2
- prog: swapcontext
- stderr_filter: filter_stderr
--- 
-2.17.1
-
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-drd-tests-swapcontext-Add-SIGALRM-handler-to-avoid-s.patch b/meta/recipes-devtools/valgrind/valgrind/0001-drd-tests-swapcontext-Add-SIGALRM-handler-to-avoid-s.patch
new file mode 100644 (file)
index 0000000..371c170
--- /dev/null
@@ -0,0 +1,65 @@
+From 4c8c4a9c3a92300e3e6500e5a278ca37514a1fdb Mon Sep 17 00:00:00 2001
+From: Yi Fan Yu <yifan.yu@windriver.com>
+Date: Thu, 1 Apr 2021 15:31:47 -0400
+Subject: [PATCH] drd/tests/swapcontext: Add SIGALRM handler to avoid
+ stacktrace
+
+During testing for oe-core build on QEMU,
+SIGALRM can trigger during nanosleep.
+This results a different stderr output than expected.
+
+```
+==277== Process terminating with default action of signal 14 (SIGALRM)
+==277==    at 0x36C74C3943: clock_nanosleep@@GLIBC_2.17 (clock_nanosleep.c:43)
+==277==    by 0x36C74C8726: nanosleep (nanosleep.c:25)
+```
+
+This stacktrace printing will not occur
+if we add a handler that simply exits.
+
+https://bugs.kde.org/show_bug.cgi?id=435160
+
+Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
+---
+ drd/tests/swapcontext.c          | 5 +++++
+ drd/tests/swapcontext.stderr.exp | 4 ----
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c
+index 622c70bc5..2cb969a5e 100644
+--- a/drd/tests/swapcontext.c
++++ b/drd/tests/swapcontext.c
+@@ -25,6 +25,10 @@ typedef struct thread_local {
+   size_t nrsw;
+ } thread_local_t;
++static void sig_alrm_handler(int signo) {
++    _exit(1);
++}
++
+ static void f(void *data, int n)
+ {
+   enum { NR_SWITCHES = 200000 };
+@@ -76,6 +80,7 @@ int main(int argc, char *argv[])
+   pthread_attr_t attr;
+   int i, res;
++  signal(SIGALRM, sig_alrm_handler);
+   memset(tlocal, 0, sizeof(tlocal));
+   pthread_attr_init(&attr);
+diff --git a/drd/tests/swapcontext.stderr.exp b/drd/tests/swapcontext.stderr.exp
+index fcb5d5ed4..d18786f80 100644
+--- a/drd/tests/swapcontext.stderr.exp
++++ b/drd/tests/swapcontext.stderr.exp
+@@ -1,7 +1,3 @@
+-Process terminating with default action of signal 14 (SIGALRM)
+-   at 0x........: swapcontext (in /...libc...)
+-   by 0x........: f (swapcontext.c:?)
+-
+ ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+-- 
+2.17.1
+
index 7a6b76612181fff94fb8f4a4ccc467171e706c1c..2eea84c229706e379d34b71d9b2e4f938a3ae6a7 100644 (file)
@@ -43,7 +43,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
            file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
            file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
            file://0001-Add-missing-musl.supp.patch \
-           file://0001-Disable-temporarily-drd-tests-swapcontext.vgtest.patch \
+           file://0001-drd-tests-swapcontext-Add-SIGALRM-handler-to-avoid-s.patch \
            "
 SRC_URI[md5sum] = "afe11b5572c3121a781433b7c0ab741b"
 SRC_URI[sha256sum] = "ad3aec668e813e40f238995f60796d9590eee64a16dff88421430630e69285a2"