From 74c255a166eebc3273c48ede83075139df2a6b5b Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 7 Sep 2022 14:45:05 +0200 Subject: [PATCH] Run the testsuite during build --- libunwind-no-dl-iterate-phdr.patch | 25 +++++++++++++ libunwind-skip-no-coredump.patch | 20 +++++++++++ libunwind.spec | 57 +++++++++++++++++++++++++----- 3 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 libunwind-no-dl-iterate-phdr.patch create mode 100644 libunwind-skip-no-coredump.patch diff --git a/libunwind-no-dl-iterate-phdr.patch b/libunwind-no-dl-iterate-phdr.patch new file mode 100644 index 0000000..b236065 --- /dev/null +++ b/libunwind-no-dl-iterate-phdr.patch @@ -0,0 +1,25 @@ +This patch disables building of the (effectively empty) +dl-iterate-phdr.c source file. Symbols generated by annobin confuse +the run-check-namespace test because nm -g prints hidden weak symbols +in DSOs (they are considered external): + + ERROR: Extraneous symbols: +000000000000de51 W dl_iterate_phdr.c.a8d8d212 + ERROR: Extraneous symbols: +00000000000120b0 W dl_iterate_phdr.c.a8d8d212 + +This patch is downstream-specific due to annobin. + +diff --git a/src/Makefile.am b/src/Makefile.am +index 2b5b02959e99eb8f..e5ff21515c36d30f 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -147,7 +147,7 @@ libunwind_la_SOURCES_local = \ + $(libunwind_la_SOURCES_local_unwind) + + noinst_HEADERS += os-linux.h +-libunwind_la_SOURCES_os_linux = os-linux.c dl-iterate-phdr.c ++libunwind_la_SOURCES_os_linux = os-linux.c + + libunwind_la_SOURCES_os_hpux = os-hpux.c + diff --git a/libunwind-skip-no-coredump.patch b/libunwind-skip-no-coredump.patch new file mode 100644 index 0000000..747cd33 --- /dev/null +++ b/libunwind-skip-no-coredump.patch @@ -0,0 +1,20 @@ +This is needed because under mock (especially with a systemd-coredump +handler on the system), no core files are created. + +Submitted upstream: https://github.com/libunwind/libunwind/pull/418 + +diff --git a/tests/run-coredump-unwind b/tests/run-coredump-unwind +index 8d07742574602328..0c2b28c942477f7d 100755 +--- a/tests/run-coredump-unwind ++++ b/tests/run-coredump-unwind +@@ -48,6 +48,10 @@ fi + ./crasher backing_files + ) 2>/dev/null + COREFILE=$TEMPDIR/core* ++if ! test -f "$COREFILE"; then ++ echo "crasher process did not produce coredump, test skipped" ++ exit 77 ++fi + + # magic option -testcase enables checking for the specific contents of the stack + ./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files` diff --git a/libunwind.spec b/libunwind.spec index b9f83dc..df8be02 100644 --- a/libunwind.spec +++ b/libunwind.spec @@ -1,10 +1,45 @@ -# rpmbuild parameters: -# --without check: Do not run the testsuite. Default is to run it. +# The testsuite does not pass on all targets. +# +# aarch64 +# Gtest-exc +# Ltest-exc +# Gtest-trace +# Ltest-trace +# Ltest-init-local-signal +# Ltest-mem-validate: https://github.com/libunwind/libunwind/issues/388 +# test-reg-state +# Ltest-varargs +# Lrs-race +# test-ptrace +# run-check-namespace: https://github.com/libunwind/libunwind/issues/389 +# run-ptrace-mapper +# run-ptrace-misc +# i686 +# Ltest-mem-validate: https://github.com/libunwind/libunwind/issues/391 +# test-async-sig +# test-ptrace +# ppc64le +# Gtest-exc +# Ltest-exc +# Gtest-resume-sig +# Ltest-resume-sig +# Gtest-resume-sig-rt +# Ltest-resume-sig-rt +# test-ptrace +# run-check-namespace +# run-ptrace-mapper +# run-ptrace-misc +# +%ifarch aarch64 i686 ppc64le +%global test_failure_override true +%else +%global test_failure_override false +%endif Summary: An unwinding library Name: libunwind Version: 1.6.2 -Release: 4%{?dist} +Release: 5%{?dist} License: BSD URL: http://savannah.nongnu.org/projects/libunwind Source: http://download-mirror.savannah.gnu.org/releases/libunwind/libunwind-%{version}.tar.gz @@ -14,11 +49,14 @@ Patch1: libunwind-arm-default-to-exidx.patch # Make libunwind.h multilib friendly Patch2: libunwind-1.3.1-multilib-fix.patch Patch3: libunwind-1.6.2-dynamic-page-size.patch +Patch4: libunwind-skip-no-coredump.patch +Patch5: libunwind-no-dl-iterate-phdr.patch ExclusiveArch: %{arm} aarch64 hppa ia64 mips ppc %{power64} s390x %{ix86} x86_64 BuildRequires: automake libtool autoconf texlive-latex2man BuildRequires: make +BuildRequires: gcc-c++ # host != target would cause REMOTE_ONLY build even if building i386 on x86_64. %global _host %{_target_platform} @@ -63,13 +101,13 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace*.so* touch -r NEWS $RPM_BUILD_ROOT%{_includedir}/libunwind.h %check -%if 0%{?_with_check:1} || 0%{?_with_testsuite:1} echo ====================TESTING========================= -make check || true +if ! make check ; then + echo ====================FAILED TESTS===================== + cat tests/test-suite.log || true + %{test_failure_override} +fi echo ====================TESTING END===================== -%else -echo ====================TESTSUITE DISABLED========================= -%endif %ldconfig_scriptlets @@ -88,6 +126,9 @@ echo ====================TESTSUITE DISABLED========================= %{_includedir}/libunwind*.h %changelog +* Wed Sep 7 2022 Florian Weimer - 1.6.2-5 +- Run the testsuite during build + * Wed Sep 7 2022 Florian Weimer - 1.6.2-4 - Enable %%autosetup to apply all patches (#2118019)