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

Jagadeesh Krishnanjanappa jkrishnanjanappa at mvista.com
Mon Oct 24 18:15:15 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. Some of the libunwind test cases such as run-check-namespace,
   run-coredump-unwind require debug symbols to be present in
   libunwind library. So set INHIBIT_PACKAGE_STRIP to "1".

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)

Test result obtained with qemux86-64:
-- snip --
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
FAIL: 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
PASS: run-coredump-unwind
============================================================================
Testsuite summary for libunwind 1.1
============================================================================
# TOTAL: 33
# PASS:  30
# SKIP:  0
# XFAIL: 2
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
-- snip --

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa at mvista.com>
---
 meta/recipes-support/libunwind/libunwind/run-ptest |  2 ++
 meta/recipes-support/libunwind/libunwind_git.bb    | 32 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 meta/recipes-support/libunwind/libunwind/run-ptest

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..078d3a9 100644
--- a/meta/recipes-support/libunwind/libunwind_git.bb
+++ b/meta/recipes-support/libunwind/libunwind_git.bb
@@ -11,6 +11,7 @@ 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://run-ptest \
            "
 
 SRC_URI_append_libc-musl = " file://musl-header-conflict.patch"
@@ -27,3 +28,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=${libdir}/libunwind.so|g" \
+    -e "s|^LIBUNWIND_GENERIC=.*|LIBUNWIND_GENERIC=${libdir}/libunwind-\${plat}.so|g" ${D}${PTEST_PATH}/tests/check-namespace.sh
+}
+
+INHIBIT_PACKAGE_STRIP = "1"
+
+RDEPENDS_${PN}-ptest += "make bash gawk binutils"
-- 
2.7.4




More information about the Openembedded-core mailing list