[OE-core] [master][morty][PATCH v2] libunwind: add ptest support

Jagadeesh Krishnanjanappa jkrishnanjanappa at mvista.com
Wed Oct 26 17:35:53 UTC 2016


The patch include below changes:

1. Add do_compile_ptest task, which compiles and runs builtin
   test cases. The libunwind test scripts has relink commands,
   which needs to be run at host in order to create ELF test
   binaries which can be readily executed at target.
   Hence pass "-i" option to make, to ignore exit status of tests
   executed at host.

2. run-check-namespace test require libunwind library containing
   debug symbols to pass. Hence made ${PN}-ptest to
   RDEPENDS on ${PN}-dbg package, and added "debug-deps" in to
   INSANE_SKIP to avoid packaging error; due to dependency on
   ${PN}-dbg package.

3. Add do_install_ptest task, which copies necessary
   filesb to execute tests.

4. Add run-ptest script to execute tests at target.

5. Add dependent packages neede to execute test cases via RDEPENDS
   (run-check-namespace test requires "nm" tool, which is given by binutils)

6. Made run-coredump-unwind and run-coredump-unwind-mdi testcases as
   expected failures, due to unavailability of unstripped crasher binary.

Test result obtained with qemux86-64:
PASS: test-proc-info
PASS: test-static-link
PASS: test-strerror
PASS: Gtest-bt
PASS: Ltest-bt
PASS: Gtest-exc
PASS: Ltest-exc
PASS: Gtest-init
PASS: Ltest-init
PASS: Gtest-concurrent
PASS: Ltest-concurrent
PASS: Gtest-resume-sig
PASS: Ltest-resume-sig
PASS: Gtest-resume-sig-rt
PASS: Ltest-resume-sig-rt
XFAIL: Gtest-dyn1
XFAIL: Ltest-dyn1
PASS: Gtest-trace
PASS: Ltest-trace
PASS: test-async-sig
PASS: test-flush-cache
PASS: test-init-remote
PASS: test-mem
PASS: Ltest-varargs
PASS: Ltest-nomalloc
PASS: Ltest-nocalloc
PASS: Lrs-race
PASS: test-ptrace
PASS: test-setjmp
PASS: run-check-namespace
PASS: run-ptrace-mapper
PASS: run-ptrace-misc
XFAIL: run-coredump-unwind
============================================================================
Testsuite summary for libunwind 1.1
============================================================================
# TOTAL: 33
# PASS:  30
# SKIP:  0
# XFAIL: 3
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
---
 .../make-coredump-testcases-as-XFAIL.patch         | 21 ++++++++++++++
 meta/recipes-support/libunwind/libunwind/run-ptest |  2 ++
 meta/recipes-support/libunwind/libunwind_git.bb    | 33 ++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 meta/recipes-support/libunwind/libunwind/make-coredump-testcases-as-XFAIL.patch
 create mode 100644 meta/recipes-support/libunwind/libunwind/run-ptest

diff --git a/meta/recipes-support/libunwind/libunwind/make-coredump-testcases-as-XFAIL.patch b/meta/recipes-support/libunwind/libunwind/make-coredump-testcases-as-XFAIL.patch
new file mode 100644
index 0000000..169692e
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/make-coredump-testcases-as-XFAIL.patch
@@ -0,0 +1,21 @@
+Testcases run-coredump-unwind and run-coredump-unwind-mdi require unstripped
+crasher binary to get procedure names via libunwind APIs. But in libunwind 
+recipe of OE-core, we remove debug symbols from crasher binary, this 
+results in failure of run-coredump-unwind and run-coredump-unwind-mdi tests.
+Hence, mark them as expected failures (XFAIL).
+
+Upstream-Status: Inappropriate [embedded-specific]
+
+Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
+
+--- git_org/tests/Makefile.am	2016-10-26 15:52:23.587571091 +0530
++++ git/tests/Makefile.am	2016-10-26 15:51:10.154790372 +0530
+@@ -113,6 +113,8 @@ if ARCH_ARM
+ XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP)
+ endif
+ 
++XFAIL_TESTS += run-coredump-unwind run-coredump-unwind-mdi
++
+ noinst_PROGRAMS = $(noinst_PROGRAMS_common) $(noinst_PROGRAMS_cdep) \
+ 	$(noinst_PROGRAMS_arch)
+ 
diff --git a/meta/recipes-support/libunwind/libunwind/run-ptest b/meta/recipes-support/libunwind/libunwind/run-ptest
new file mode 100644
index 0000000..8bf2e11
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/run-ptest
@@ -0,0 +1,2 @@
+#!/bin/sh
+make -C tests -k LOG_DRIVER="$PWD/tests/test-driver" check-TESTS
diff --git a/meta/recipes-support/libunwind/libunwind_git.bb b/meta/recipes-support/libunwind/libunwind_git.bb
index 4249430..cd747f2 100644
--- a/meta/recipes-support/libunwind/libunwind_git.bb
+++ b/meta/recipes-support/libunwind/libunwind_git.bb
@@ -11,6 +11,8 @@ SRC_URI = "git://git.sv.gnu.org/libunwind.git \
            file://0001-Fix-build-on-mips-musl.patch \
            file://0001-add-knobs-to-disable-enable-tests.patch \
            file://0001-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \
+           file://make-coredump-testcases-as-XFAIL.patch \
+           file://run-ptest \
            "
 
 SRC_URI_append_libc-musl = " file://musl-header-conflict.patch"
@@ -27,3 +29,34 @@ SECURITY_CFLAGS_append_aarch64 = " -fPIE"
 S = "${WORKDIR}/git"
 
 LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
+
+inherit ptest
+
+do_compile_ptest() {
+    # Build tests
+    oe_runmake -C ${B}/tests LOG_DRIVER="${S}/config/test-driver" -i check
+}
+
+do_install_ptest() {
+    # copy binaries excluding "*.o" and "*.log" files
+    install -d ${D}${PTEST_PATH}
+    cp -a ${B}/tests ${D}${PTEST_PATH}
+    rm -f `find ${D}${PTEST_PATH} | egrep "\.o$|\.log$"`
+
+    # copy dependent files for testing
+    [ -f ${S}/config/test-driver ] && cp ${S}/config/test-driver ${D}${PTEST_PATH}/tests/
+    cp ${S}/tests/run-* ${D}${PTEST_PATH}/tests/
+
+    # Use libunwind libraries present in standard path and tweak Makefile
+    # to run only tests at target
+    [ -f ${D}${PTEST_PATH}/tests/Makefile ] && \
+    sed -i -e "s|^\(.*\)\.log: .*(EXEEXT)|\1\.log:|" ${D}${PTEST_PATH}/tests/Makefile
+
+    [ -f ${D}${PTEST_PATH}/tests/check-namespace.sh ] && \
+    sed -i -e "s|^LIBUNWIND=.*|LIBUNWIND=\$(ls -1 \${libdir}/.debug/libunwind.so*)|g" \
+    -e "s|^LIBUNWIND_GENERIC=.*|LIBUNWIND_GENERIC=\$(ls -1 \${libdir}/.debug/libunwind-\${plat}.so*)|g" ${D}${PTEST_PATH}/tests/check-namespace.sh
+}
+
+INSANE_SKIP_${PN}-ptest += "debug-deps"
+
+RDEPENDS_${PN}-ptest += "make bash gawk binutils ${PN}-dbg"
-- 
2.7.4




More information about the Openembedded-core mailing list