RFCv2: debuginfod debian archive support
Frank Ch. Eigler
fche@redhat.com
Fri Dec 6 21:17:00 GMT 2019
Hi -
Presenting testing for the debuginfod .deb/.ddeb support patch, after
finding a good debian-packaging tutorial, and generating a workable
basic set of test deb's on a Ubuntu box.
This patch is also on the elfutils.git fche/debuginfod-deb branch. In
the absence of objections, I plan to merge this next week.
commit 1d9ff81da0f5e1c7383b255c15529402035ad5bf
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Fri Dec 6 16:08:50 2019 -0500
debuginfod: deb support, tests
Using a synthetic .deb/.ddeb from a Ubuntu 18 machine,
extend the debuginfod testsuite with some .deb processing,
if the dpkg-deb binary is installed.
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/config/ChangeLog b/config/ChangeLog
index d71fb39..9b2a408 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-06 Frank Ch. Eigler <fche@redhat.com>
+
+ * elfutils.spec.in (debuginfod): Add BuildRequire dpkg
+ for deb testing. (Available on Fedora & EPEL, not base RHEL.)
+
2019-11-28 Mark Wielaard <mark@klomp.org>
* elfutils.spec.in (debuginfod): Add an explicit Requires
diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in
index 1cdca21..faeb7f8 100644
--- a/config/elfutils.spec.in
+++ b/config/elfutils.spec.in
@@ -35,6 +35,9 @@ BuildRequires: pkgconfig(libarchive) >= 3.1.2
BuildRequires: bzip2
# For the run-debuginfod-find.sh test case in %check for /usr/sbin/ss
BuildRequires: iproute
+%if 0%{?fedora} >= 20
+BuildRequires: dpkg
+%endif
BuildRequires: curl
%define _gnu %{nil}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 8fcb161..ba3a10e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2019-12-06 Frank Ch. Eigler <fche@redhat.com>
+
+ * debuginfod-debs/*: New test files, based on
+ https://wiki.debian.org/Packaging/Intro.
+ * run-debuginfod-find.sh: Test deb file processing (if dpkg
+ installed).
+
2019-12-02 Frank Ch. Eigler <fche@redhat.com>
* run-debuginfod-find.sh: Adjust to "rpm"->"archive" in metrics.
diff --git a/tests/debuginfod-debs/hithere-dbgsym_1.0-1_amd64.ddeb b/tests/debuginfod-debs/hithere-dbgsym_1.0-1_amd64.ddeb
new file mode 100644
index 0000000..f9879eb
Binary files /dev/null and b/tests/debuginfod-debs/hithere-dbgsym_1.0-1_amd64.ddeb differ
diff --git a/tests/debuginfod-debs/hithere_1.0-1.debian.tar.xz b/tests/debuginfod-debs/hithere_1.0-1.debian.tar.xz
new file mode 100644
index 0000000..9f0ce68
Binary files /dev/null and b/tests/debuginfod-debs/hithere_1.0-1.debian.tar.xz differ
diff --git a/tests/debuginfod-debs/hithere_1.0-1.dsc b/tests/debuginfod-debs/hithere_1.0-1.dsc
new file mode 100644
index 0000000..d5f72b9
--- /dev/null
+++ b/tests/debuginfod-debs/hithere_1.0-1.dsc
@@ -0,0 +1,19 @@
+Format: 3.0 (quilt)
+Source: hithere
+Binary: hithere
+Architecture: any
+Version: 1.0-1
+Maintainer: Lars Wirzenius <liw@liw.fi>
+Standards-Version: 3.9.2
+Build-Depends: debhelper (>= 9)
+Package-List:
+ hithere deb misc optional arch=any
+Checksums-Sha1:
+ 2dcd65497a12a3ea03223f52186447bd5733dce9 617 hithere_1.0.orig.tar.gz
+ 0b71331ef1c714c5bac67878551864b7356c56ce 764 hithere_1.0-1.debian.tar.xz
+Checksums-Sha256:
+ 63062b582a712f169f37a5f52a41aa3ca9a405aafb8aa837bc906fa413b62cdb 617 hithere_1.0.orig.tar.gz
+ 9afa907e360e626639ccb86b86e799429bea27149034aec5d5c7e500971d651e 764 hithere_1.0-1.debian.tar.xz
+Files:
+ 5b2830fa1fcd44ce489774771625526e 617 hithere_1.0.orig.tar.gz
+ 70106164d9397c70c2c1a4594e9897e4 764 hithere_1.0-1.debian.tar.xz
diff --git a/tests/debuginfod-debs/hithere_1.0-1_amd64.deb b/tests/debuginfod-debs/hithere_1.0-1_amd64.deb
new file mode 100644
index 0000000..11d1e95
Binary files /dev/null and b/tests/debuginfod-debs/hithere_1.0-1_amd64.deb differ
diff --git a/tests/debuginfod-debs/hithere_1.0.orig.tar.gz b/tests/debuginfod-debs/hithere_1.0.orig.tar.gz
new file mode 100644
index 0000000..23abea7
Binary files /dev/null and b/tests/debuginfod-debs/hithere_1.0.orig.tar.gz differ
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index c2926a0..cd31e30 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -18,6 +18,10 @@
. $srcdir/test-subr.sh # includes set -e
+# for test case debugging, uncomment:
+# set -x
+# VERBOSE=-vvvv
+
DB=${PWD}/.debuginfod_tmp.sqlite
tempfiles $DB
export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache
@@ -30,7 +34,7 @@ cleanup()
if [ $PID1 -ne 0 ]; then kill $PID1; wait $PID1; fi
if [ $PID2 -ne 0 ]; then kill $PID2; wait $PID2; fi
- rm -rf F R L ${PWD}/.client_cache*
+ rm -rf F R D L ${PWD}/.client_cache*
exit_cleanup
}
@@ -52,8 +56,8 @@ done
# So we gather the LD_LIBRARY_PATH with this cunning trick:
ldpath=`testrun sh -c 'echo $LD_LIBRARY_PATH'`
-mkdir F R L
-# not tempfiles F R L - they are directories which we clean up manually
+mkdir F R L D
+# not tempfiles F R L D - they are directories which we clean up manually
ln -s ${abs_builddir}/dwfllines L/foo # any program not used elsewhere in this test
wait_ready()
@@ -82,7 +86,7 @@ wait_ready()
fi
}
-env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_URLS= ${abs_builddir}/../debuginfod/debuginfod -F -R -d $DB -p $PORT1 -t0 -g0 R F L &
+env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_URLS= ${abs_builddir}/../debuginfod/debuginfod $VERBOSE -F -R -d $DB -p $PORT1 -t0 -g0 R F L &
PID1=$!
# Server must become ready
wait_ready $PORT1 'ready' 1
@@ -158,7 +162,7 @@ cmp $filename F/prog2
filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source $BUILDID2 ${PWD}/prog2.c`
cmp $filename ${PWD}/prog2.c
-cp -rp ${abs_srcdir}/debuginfod-rpms R
+cp -rvp ${abs_srcdir}/debuginfod-rpms R
kill -USR1 $PID1
# All rpms need to be in the index
rpms=$(find R -name \*rpm | wc -l)
@@ -177,7 +181,7 @@ for i in $newrpms; do
mkdir $subdir;
cd $subdir;
ls -lah ../$i
- rpm2cpio ../$i | cpio -id;
+ rpm2cpio ../$i | cpio -ivd;
cd ..;
done
sourcefiles=$(find -name \*\\.debug \
@@ -205,10 +209,12 @@ rpm_test() {
buildid=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
-a $filename | grep 'Build ID' | cut -d ' ' -f 7`
test $__BUILDID = $buildid
-
- filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source $__BUILDID $__SOURCEPATH`
- hash=`cat $filename | sha1sum | awk '{print $1}'`
- test $__SOURCESHA1 = $hash
+
+ if test "x$__SOURCEPATH" != "x"; then
+ filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source $__BUILDID $__SOURCEPATH`
+ hash=`cat $filename | sha1sum | awk '{print $1}'`
+ test $__SOURCESHA1 = $hash
+ fi
}
@@ -257,13 +263,26 @@ export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache2
mkdir -p $DEBUGINFOD_CACHE_PATH
# NB: inherits the DEBUGINFOD_URLS to the first server
# NB: run in -L symlink-following mode for the L subdir
-env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod -F -d ${DB}_2 -p $PORT2 -L L &
+env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod $VERBOSE -F -U -d ${DB}_2 -p $PORT2 -L L D &
PID2=$!
tempfiles ${DB}_2
wait_ready $PORT2 'ready' 1
# have clients contact the new server
export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2
+
+if type dpkg-deb 2>/dev/null; then
+ # copy in the deb files
+ cp -rvp ${abs_srcdir}/debuginfod-debs/*deb D
+ kill -USR1 $PID2
+ # All debs need to be in the index
+ debs=$(find D -name \*deb | wc -l)
+ wait_ready $PORT2 'scanned_total{source="archive"}' `expr $debs`
+
+ # ubuntu
+ rpm_test f17a29b5a25bd4960531d82aa6b07c8abe84fa66 "" ""
+fi
+
rm -rf $DEBUGINFOD_CACHE_PATH
testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
More information about the Elfutils-devel
mailing list