Compare commits

..

No commits in common. "c8s" and "imports/c10s/dwz-0.15-7.el10" have entirely different histories.

21 changed files with 620 additions and 68 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

17
.gitignore vendored
View File

@ -1,2 +1,17 @@
SOURCES/dwz-0.12.tar.bz2
/dwz
/dwz-0.3.tar.bz2
/dwz-0.4.tar.bz2
/dwz-0.5.tar.bz2
/dwz-0.6.tar.bz2
/dwz-0.7.tar.bz2
/dwz-0.8.tar.bz2
/dwz-0.9.tar.bz2
/dwz-0.10.tar.bz2
/dwz-0.11.tar.bz2
/dwz-0.12.tar.bz2
/dwz-0.13.tar.xz
/dwz-20210118.tar.xz
/dwz-20210121.tar.xz
/dwz-20210122.tar.xz
/dwz-0.14.tar.xz
/dwz-0.15.tar.xz

View File

@ -0,0 +1,80 @@
commit b1f26dc76158e1f3364836d8b540b17a7a1ccb3d
Author: Tom de Vries <tdevries@suse.de>
Date: Sat Mar 20 09:37:31 2021 +0100
[testsuite] Handle readelf following links by default
Since binutils commit c46b706620e "Change the readelf and objdump programs so
that they will automatically follow links to separate debug info files" there
are a few FAILs in the dwz testsuite.
This is just due to changing the default behaviour for readelf.
Fix this by testing whether the new -Wn readelf flag is supported,
and if so, adding it to the readelf call.
2021-03-20 Tom de Vries <tdevries@suse.de>
PR dwz/27592
* testsuite/dwz.tests/odr-struct-multifile.sh: Call readelf with -wN
if supported.
* testsuite/dwz.tests/cycle.sh: Same.
diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh
index cc462c9..20b682b 100644
--- a/testsuite/dwz.tests/odr-struct-multifile.sh
+++ b/testsuite/dwz.tests/odr-struct-multifile.sh
@@ -2,6 +2,11 @@ if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
+readelf_flags=""
+if readelf -h 2>&1 | grep -q "\-wN,"; then
+ readelf_flags=-wN
+fi
+
cp $execs/odr-struct 1
cp 1 2
@@ -41,12 +46,12 @@ done
for name in aaa bbb ccc; do
- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 0 ]
done
for name in member_one member_two member_three member_four; do
- cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+ cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 0 ]
done
commit 2b3711fef3438ca83db8eabed3715b6c45924511
Author: Lv Ying via Dwz <dwz@sourceware.org>
Date: Thu Jan 13 05:29:44 2022 +0800
fix Handle readelf following links by default(b1f26dc76158e)
The two testcases still failed when using newer readelf(binutils commit c46b706620e):
testsuite/dwz.tests/odr-struct-multifile.sh
testsuite/dwz.tests/cycle.sh
fix the new -Wn readelf flag test
Signed-off-by: Lv Ying <lvying6@huawei.com>
diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh
index 20b682b..159cbc3 100644
--- a/testsuite/dwz.tests/odr-struct-multifile.sh
+++ b/testsuite/dwz.tests/odr-struct-multifile.sh
@@ -3,7 +3,7 @@ if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
fi
readelf_flags=""
-if readelf -h 2>&1 | grep -q "\-wN,"; then
+if readelf -h 2>&1 | grep -q "\-wN"; then
readelf_flags=-wN
fi

View File

@ -0,0 +1,16 @@
diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh
old mode 100644
new mode 100755
index 159cbc3..5961abf
--- a/testsuite/dwz.tests/odr-struct-multifile.sh
+++ b/testsuite/dwz.tests/odr-struct-multifile.sh
@@ -44,6 +44,9 @@ for name in member_one member_two member_three member_four; do
[ $cnt -eq 1 ]
done
+# Even with -wN readelf 2.38-15.fc37 follows and prints the contents
+# of the alt file. So make sure it cannot do that by removing it.
+rm 3
for name in aaa bbb ccc; do
cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)

View File

@ -0,0 +1,26 @@
commit 5cb60631fad2827d5d337fce0c1cd03c894d6f8c
Author: Mark Wielaard <mark@klomp.org>
Date: Sat Jul 2 00:57:38 2022 +0200
Redirect stder in gdb-add-index.sh test
gdb-add-index might produce an error message on stderr when trying to
disable debuginfod support. Any message to stderr makes the testcase
fail. This looks like a gdb bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=29316
But it is easy to workaround by redirecting stderr to stdout.
diff --git a/testsuite/dwz.tests/gdb-add-index.sh b/testsuite/dwz.tests/gdb-add-index.sh
index 5a91b23..3095efb 100644
--- a/testsuite/dwz.tests/gdb-add-index.sh
+++ b/testsuite/dwz.tests/gdb-add-index.sh
@@ -1,6 +1,8 @@
cp $execs/hello 1
-gdb-add-index 1
+# Redirect gdb-add-index stderr to stdout.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=29316
+gdb-add-index 1 2>&1
readelf -S 1 | grep -q '\.gdb_index'

34
dwz-0.14-grep-E.patch Normal file
View File

@ -0,0 +1,34 @@
commit a57177980a05f0f84bf290ab7b68f73c0f78053f
Author: Martin Liška <mliska@suse.cz>
Date: Wed Sep 7 21:55:03 2022 +0200
Use grep -E instead of egrep.
egrep is obsoleted starting with GNU Grep 3.8.
diff --git a/contrib/bytes-per-die.sh b/contrib/bytes-per-die.sh
index 969f733..fda8998 100755
--- a/contrib/bytes-per-die.sh
+++ b/contrib/bytes-per-die.sh
@@ -3,7 +3,7 @@
f="$1"
size=$(readelf -WS "$f" \
- | egrep "[ \t]\.debug_info" \
+ | grep -E "[ \t]\.debug_info" \
| sed 's/.*\.debug_info//' \
| awk '{print $4}')
size=$((16#$size))
diff --git a/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
index a3395a7..ee31359 100644
--- a/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
+++ b/testsuite/dwz.tests/two-files-low-mem-die-limit-0.sh
@@ -7,7 +7,7 @@
1 2 \
2> dwz.err
-if egrep -q "Compressing (1|2)$" dwz.err; then
+if grep -Eq "Compressing (1|2)$" dwz.err; then
exit 1
fi

View File

@ -1,44 +0,0 @@
X-Git-Url: https://sourceware.org/git/?p=dwz.git;a=blobdiff_plain;f=dwz.c;h=9e39824d0f1fec950c811357c62e6a0caa1880d7;hp=6f34a0c7f84d00aa74750ea7d60c882967d252c0;hb=4a89e2c78e57b1b05ff71a8e32b2219e02d30425;hpb=815ac613209fa8cbcdda57302a0a1ab0366923ad
diff --git a/dwz.c b/dwz.c
index 6f34a0c..9e39824 100644
--- a/dwz.c
+++ b/dwz.c
@@ -2357,10 +2357,33 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die)
}
if (unlikely (op_multifile) && ref->die_collapsed_child)
ref = ref->die_parent;
- assert (((!op_multifile && !rd_multifile && !fi_multifile)
- || cu != die_cu (ref))
- && (!op_multifile
- || cu->cu_chunk == die_cu (ref)->cu_chunk));
+ if (cu == die_cu (ref))
+ {
+ /* The reference was encoded using a section-relative
+ encoding, while if it could have been encoded using
+ CU-relative encoding. Typically, the latter is used,
+ because:
+ - it's potentially smaller, and
+ - it doesn't require a link-time relocation. */
+
+ /* Assert that the multifile only contains section-relative
+ encoding when necessary. */
+ assert (!op_multifile && !rd_multifile);
+
+ if (fi_multifile)
+ {
+ /* It's possible that the input DWARF contains this
+ sub-optimal reference. We currently don't optimize
+ this during single-file optimization, so it will still
+ be there during finalize_multifile. Bail out to handle
+ this conservatively. */
+ die->die_ck_state = CK_BAD;
+ return 0;
+ }
+ }
+ /* Assert that during op_multifile, die belongs to the same object
+ as ref. */
+ assert (!op_multifile || cu->cu_chunk == die_cu (ref)->cu_chunk);
handled = true;
break;
}

120
dwz.spec
View File

@ -1,16 +1,14 @@
Summary: DWARF optimization and duplicate removal tool
Name: dwz
Version: 0.12
Release: 10%{?dist}
License: GPLv2+ and GPLv3+
Group: Development/Tools
# git archive --format=tar --remote=git://sourceware.org/git/dwz.git \
# --prefix=%%{name}-%%{version}/ %%{name}-%%{version} \
# | bzip2 -9 > %%{name}-%%{version}.tar.bz2
Source: %{name}-%{version}.tar.bz2
BuildRequires: gcc, elfutils-libelf-devel
Version: 0.15
Release: 7%{?dist}
License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND GPL-2.0-or-later AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND LGPL-2.0-or-later
URL: https://sourceware.org/dwz/
Source: https://sourceware.org/ftp/dwz/releases/%{name}-%{version}.tar.xz
BuildRequires: gcc, gcc-c++, gdb, elfutils-libelf-devel, dejagnu
BuildRequires: make elfutils xxhash-devel
Patch1: dwz-rh1949185.patch
# Patches
%description
The dwz package contains a program that attempts to optimize DWARF
@ -22,17 +20,18 @@ DW_TAG_partial_unit compilation units (CUs) for duplicated information
and using DW_TAG_imported_unit to import it into each CU that needs it.
%prep
%setup -q
%patch1 -p1 -b .rh1949185~
%autosetup -p1 -n dwz
%build
make %{?_smp_mflags} CFLAGS='%{optflags}' LDFLAGS='%{build_ldflags}' \
%make_build CFLAGS='%{optflags}' LDFLAGS='%{build_ldflags}' \
prefix=%{_prefix} mandir=%{_mandir} bindir=%{_bindir}
%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} prefix=%{_prefix} mandir=%{_mandir} bindir=%{_bindir} \
install
%make_install prefix=%{_prefix} mandir=%{_mandir} bindir=%{_bindir}
%check
CFLAGS="" LDFLAGS="" make check
%files
%license COPYING COPYING3 COPYING.RUNTIME
@ -40,12 +39,93 @@ make DESTDIR=%{buildroot} prefix=%{_prefix} mandir=%{_mandir} bindir=%{_bindir}
%{_mandir}/man1/dwz.1*
%changelog
* Wed May 5 2021 Marek Polacek <polacek@redhat.com> 0.12-10
- handle intra-CU DW_FORM_ref_addr reference (#1949185)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.15-7
- Bump release for June 2024 mass rebuild
* Tue Aug 7 2018 Marek Polacek <polacek@redhat.com> 0.12-9
- don't use arched BuildRequires (#1545773)
- remove %defattr
* Thu Feb 1 2024 Siddhesh Poyarekar <siddhesh@redhat.com> - 0.15-6
- Bump release for SPDX change.
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.15-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.15-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Nov 3 2022 Mark Wielaard <mjw@fedoraproject.org> 0.15-1
- update to a new upstream release
* Tue Oct 25 2022 Mark Wielaard <mjw@fedoraproject.org> 0.14-9
- Add dwz-0.14-grep-E.patch
* Tue Oct 25 2022 William Cohen <wcohen@redhat.com> 0.14-8
- Added URL and complete path to source tarball to dwz.spec.
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.14-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jul 1 2022 Mark Wielaard <mjw@fedoraproject.org> 0.14-6
- Add dwz-0.14-gdb-add-index.patch
* Wed Jun 29 2022 Mark Wielaard <mjw@fedoraproject.org> 0.14-5
- Add dwz-0.14-binutils-readelf-alt.patch
- BuildRequires elfutils (for tests)
* Sun Jun 26 2022 Mark Wielaard <mjw@fedoraproject.org> 0.14-4
- Add dwz-0.14-binutils-Wn.patch
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.14-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Mar 09 2021 Jakub Jelinek <jakub@redhat.com> 0.14-1
- update to a new upstream release
* Fri Jan 22 2021 Mark Wielaard <mjw@fedoraproject.org> 0.13-7
- Don't crash on DWARF5 .debug_line table with zero files (#1919243)
* Thu Jan 21 2021 Jakub Jelinek <jakub@redhat.com> 0.13-6
- DW_FORM_implicit_const handling fixes (sw#27212, sw#27213)
- temporarily build odr tests with -gdwarf-4 as they are incompatible with
DWARF 5
* Mon Jan 18 2021 Jakub Jelinek <jakub@redhat.com> 0.13-5
- update to latest git snapshot
- DWARF5 support
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 0.13-3
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Dec 11 2019 Jakub Jelinek <jakub@redhat.com> 0.13-1
- update to a new upstream release
- add make check
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.12-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.12-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 19 2018 Marek Polacek <polacek@redhat.com> 0.12-9
- remove %{?_isa} from BuildRequires (#1545173)
- add gcc to BuildRequires
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.12-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 23 2018 Florian Weimer <fweimer@redhat.com> - 0.12-7
- Use LDFLAGS from redhat-rpm-config

View File

@ -1,6 +1,7 @@
--- !Policy
product_versions:
- rhel-8
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1-gating.functional}

6
plans/ci.fmf Normal file
View File

@ -0,0 +1,6 @@
summary: CI Gating Plan
discover:
how: fmf
directory: tests
execute:
how: beakerlib

View File

@ -1 +1 @@
SHA512 (dwz-0.12.tar.bz2) = 3b6e7270cde09dd3cfb39e4400e9012e781fb92f9ad91e2f930ec0c5ed1df2331a2dbd03ad520132460670b242c9a5585a2183df8dfda8a0188ebcfa51f8996e
SHA512 (dwz-0.15.tar.xz) = 43eb4b08c1f529859dc3466697d5ad7e172d6efbf21409530a67a2492ae4acc3734d5134bbd6e07c089ecc358d915871b13e22f6e4f1dd4c3af19ef804f8fcc5

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/dwz/dwz-quick-test
# Description: Quick sanity test
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/dwz/dwz-quick-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE testcase.c cmds
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Miroslav Franc <mfranc@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Quick sanity test" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 2m" >> $(METADATA)
@echo "RunFor: dwz" >> $(METADATA)
@echo "Requires: dwz gcc gdb glibc-debuginfo" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/dwz/dwz-quick-test
Description: Quick sanity test
Author: Miroslav Franc <mfranc@redhat.com>

View File

@ -0,0 +1,6 @@
b 19
r
p x
p/x var
c
q

View File

@ -0,0 +1,15 @@
summary: Quick sanity test
description: ''
contact: Miroslav Franc <mfranc@redhat.com>
component:
- dwz
test: ./runtest.sh
framework: beakerlib
recommend:
- dwz
- gcc
- gdb
- glibc-debuginfo
duration: 2m
extra-summary: /tools/dwz/dwz-quick-test
extra-task: /tools/dwz/dwz-quick-test

62
tests/dwz-quick-test/runtest.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/dwz/dwz-quick-test
# Description: Quick sanity test
# Author: Miroslav Franc <mfranc@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' `which dwz`)}"
REQUIRES="$PACKAGE gcc glibc gdb"
rlJournalStart
rlPhaseStartSetup
rlShowRunningKernel
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)"
rlRun "cp -r testcase.c cmds $TmpDir"
rlRun "pushd $TmpDir"
rlRun "gcc -g -O0 -o testcase testcase.c"
rlRun "cp testcase testcase.dwz"
rlPhaseEnd
rlPhaseStartTest
rlRun "dwz testcase.dwz"
rlRun "BYTES_BASE_FILE=`wc -c <testcase`"
rlRun "BYTES_DWZED_FILE=`wc -c <testcase.dwz`"
[ $BYTES_DWZED_FILE -gt $BYTES_BASE_FILE ] && rlFail "DWZed file should not be greater than the original file."
rlRun "gdb --command=cmds --quiet --batch testcase.dwz |& tee $TmpDir/testcase.log; test \${PIPESTATUS[0]} -eq 0"
rlRun "grep 'hello, world' $TmpDir/testcase.log"
rlRun "grep '\$1 = -1' $TmpDir/testcase.log"
rlRun "grep '\$2 = 0x2a' $TmpDir/testcase.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,21 @@
#include <stdio.h>
void f (int x);
int
main (int argc, char *argv[])
{
int a = -1;
f(a);
return 0;
}
void
f (int x)
{
static int var __attribute__ ((used)) = 42;
if(x)
puts("hello, world");
}

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/dwz/Sanity/dwz-testsuite
# Description: dwz testing by upstream testsuite
# Author: Michal Kolar <mkolar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/dwz/Sanity/dwz-testsuite
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Michal Kolar <mkolar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: dwz testing by upstream testsuite" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 1h" >> $(METADATA)
@echo "RunFor: dwz" >> $(METADATA)
@echo "Requires: dwz rpm-build yum-utils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7 -RHEL8" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/dwz/Sanity/dwz-testsuite
Description: dwz testing by upstream testsuite
Author: Michal Kolar <mkolar@redhat.com>

View File

@ -0,0 +1,14 @@
summary: dwz testing by upstream testsuite
description: ''
contact: Michal Kolar <mkolar@redhat.com>
component:
- dwz
test: ./runtest.sh
framework: beakerlib
recommend:
- dwz
- rpm-build
- yum-utils
duration: 1h
extra-summary: /tools/dwz/Sanity/dwz-testsuite
extra-task: /tools/dwz/Sanity/dwz-testsuite

87
tests/dwz-testsuite/runtest.sh Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/dwz/Sanity/dwz-testsuite
# Description: dwz testing by upstream testsuite
# Author: Michal Kolar <mkolar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
BUILD_USER=${BUILD_USER:-dwzbld}
TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-20}
PACKAGE="dwz"
REQUIRES="$PACKAGE rpm-build"
if rlIsFedora; then
REQUIRES="$REQUIRES dnf-utils"
else
REQUIRES="$REQUIRES yum-utils"
fi
rlJournalStart
rlPhaseStartSetup
rlShowRunningKernel
rlAssertRpm --all
rlRun "TmpDir=`mktemp -d`"
rlRun "pushd $TmpDir"
rlFetchSrcForInstalled $PACKAGE
rlRun "useradd -M -N $BUILD_USER" 0,9
[ "$?" == "0" ] && rlRun "del=yes"
rlRun "chown -R $BUILD_USER:users $TmpDir"
rlPhaseEnd
rlPhaseStartSetup "build dwz"
rlRun "rpm -D \"_topdir $TmpDir\" -U *.src.rpm"
rlRun "dnf builddep -y $TmpDir/SPECS/*.spec"
rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bp $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild.log' $BUILD_USER"
rlRun "rlFileSubmit $TmpDir/rpmbuild.log"
rlRun "cd $TmpDir/BUILD/dwz"
rlRun "su -c './configure &>$TmpDir/configure.log' $BUILD_USER"
rlRun "rlFileSubmit $TmpDir/configure.log"
rlRun "su -c 'make &>$TmpDir/make.log' $BUILD_USER"
rlRun "rlFileSubmit $TmpDir/make.log"
rlRun "ln -fs `which dwz` . && touch dwz"
# workaround
[ -f testsuite/dwz.tests/pr24468.sh ] && rlRun "mv testsuite/dwz.tests/pr24468.sh testsuite/dwz.tests/pr24468.sh~" 0 "Disabling pr24468.sh due to bz1893921"
rlPhaseEnd
rlPhaseStartTest "run testsuite"
rlRun "su -c 'make check RUNTESTFLAGS=-a |& tee $TmpDir/testsuite.log; test \${PIPESTATUS[0]} -eq 0' $BUILD_USER"
rlRun "rlFileSubmit $TmpDir/testsuite.log"
rlLogInfo "`awk '/=== dwz Summary ===/,0' dwz.sum`"
rlPhaseEnd
rlPhaseStartTest "evaluate results"
rlRun "grep -E '^FAIL:' dwz.sum" 1 "There should be no failure"
rlRun "tests_count=\$(grep -E '^PASS:' dwz.sum | wc -l)"
[ "$tests_count" -ge "$TESTS_COUNT_MIN" ] && rlLogInfo "Test counter: $tests_count" || rlFail "Test counter $tests_count should be greater than or equal to $TESTS_COUNT_MIN"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
[ "$del" == "yes" ] && rlRun "userdel -f $BUILD_USER"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd