summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog7
-rw-r--r--tests/Makefile.am30
-rw-r--r--tests/debuginfod-rpms/fedora30/hello2-1.0-2.src.rpmbin0 -> 8087 bytes
-rw-r--r--tests/debuginfod-rpms/fedora30/hello2-1.0-2.x86_64.rpmbin0 -> 10448 bytes
-rw-r--r--tests/debuginfod-rpms/fedora30/hello2-debuginfo-1.0-2.x86_64.rpmbin0 -> 11316 bytes
-rw-r--r--tests/debuginfod-rpms/fedora30/hello2-debugsource-1.0-2.x86_64.rpmbin0 -> 7308 bytes
-rw-r--r--tests/debuginfod-rpms/fedora30/hello2-two-1.0-2.x86_64.rpmbin0 -> 10380 bytes
-rw-r--r--tests/debuginfod-rpms/fedora30/hello2-two-debuginfo-1.0-2.x86_64.rpmbin0 -> 10888 bytes
-rw-r--r--tests/debuginfod-rpms/hello2.spec.57
-rw-r--r--tests/debuginfod-rpms/rhel6/hello2-1.0-2.i686.rpmbin0 -> 4112 bytes
-rw-r--r--tests/debuginfod-rpms/rhel6/hello2-1.0-2.src.rpmbin0 -> 3816 bytes
-rw-r--r--tests/debuginfod-rpms/rhel6/hello2-debuginfo-1.0-2.i686.rpmbin0 -> 6060 bytes
-rw-r--r--tests/debuginfod-rpms/rhel6/hello2-two-1.0-2.i686.rpmbin0 -> 4052 bytes
-rw-r--r--tests/debuginfod-rpms/rhel7/hello2-1.0-2.src.rpmbin0 -> 3819 bytes
-rw-r--r--tests/debuginfod-rpms/rhel7/hello2-1.0-2.x86_64.rpmbin0 -> 5156 bytes
-rw-r--r--tests/debuginfod-rpms/rhel7/hello2-debuginfo-1.0-2.x86_64.rpmbin0 -> 6936 bytes
-rw-r--r--tests/debuginfod-rpms/rhel7/hello2-two-1.0-2.x86_64.rpmbin0 -> 5092 bytes
-rw-r--r--tests/debuginfod_build_id_find.c62
-rwxr-xr-xtests/run-debuginfod-find.sh230
19 files changed, 383 insertions, 3 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 369af37e..a5e57282 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2019-10-28 Aaron Merey <amerey@redhat.com>
+ Frank Ch. Eigler <fche@redhat.com>
+
+ * run-debuginfod-find.sh, debuginfod_build_id_find.c: New test.
+ * testfile-debuginfod-*.rpm.bz2: New data files for test.
+ * Makefile.am: Run it.
+
2019-11-14 Andreas Schwab <schwab@suse.de>
* run-large-elf-file.sh: Skip if available memory cannot be
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ad0855de..83d27a06 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to create Makefile.in
##
-## Copyright (C) 1996-2018 Red Hat, Inc.
+## Copyright (C) 1996-2019 Red Hat, Inc.
## This file is part of elfutils.
##
## This file is free software; you can redistribute it and/or modify
@@ -190,6 +190,11 @@ check_PROGRAMS += $(asm_TESTS)
TESTS += $(asm_TESTS) run-disasm-bpf.sh
endif
+if DEBUGINFOD
+check_PROGRAMS += debuginfod_build_id_find
+TESTS += run-debuginfod-find.sh
+endif
+
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
run-show-die-info.sh run-get-files.sh run-get-lines.sh \
run-next-files.sh run-next-lines.sh testfile-only-debug-line.bz2 \
@@ -440,7 +445,25 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
run-dwelf_elf_e_machine_string.sh \
run-elfclassify.sh run-elfclassify-self.sh \
run-disasm-riscv64.sh \
- testfile-riscv64-dis1.o.bz2 testfile-riscv64-dis1.expect.bz2
+ testfile-riscv64-dis1.o.bz2 testfile-riscv64-dis1.expect.bz2 \
+ run-debuginfod-find.sh \
+ debuginfod-rpms/fedora30/hello2-1.0-2.src.rpm \
+ debuginfod-rpms/fedora30/hello2-1.0-2.x86_64.rpm \
+ debuginfod-rpms/fedora30/hello2-debuginfo-1.0-2.x86_64.rpm \
+ debuginfod-rpms/fedora30/hello2-debugsource-1.0-2.x86_64.rpm \
+ debuginfod-rpms/fedora30/hello2-two-1.0-2.x86_64.rpm \
+ debuginfod-rpms/fedora30/hello2-two-debuginfo-1.0-2.x86_64.rpm \
+ debuginfod-rpms/hello2.spec. \
+ debuginfod-rpms/rhel6/hello2-1.0-2.i686.rpm \
+ debuginfod-rpms/rhel6/hello2-1.0-2.src.rpm \
+ debuginfod-rpms/rhel6/hello2-debuginfo-1.0-2.i686.rpm \
+ debuginfod-rpms/rhel6/hello2-two-1.0-2.i686.rpm \
+ debuginfod-rpms/rhel7/hello2-1.0-2.src.rpm \
+ debuginfod-rpms/rhel7/hello2-1.0-2.x86_64.rpm \
+ debuginfod-rpms/rhel7/hello2-debuginfo-1.0-2.x86_64.rpm \
+ debuginfod-rpms/rhel7/hello2-two-1.0-2.x86_64.rpm
+
+
if USE_VALGRIND
valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1'
@@ -474,7 +497,7 @@ TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \
export LC_ALL; export LANG; export VALGRIND_CMD; \
NM=$(NM); export NM;
LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
- $(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm
+ $(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm:$(abs_top_builddir)/debuginfod
installcheck-local:
$(MAKE) $(AM_MAKEFLAGS) \
@@ -610,6 +633,7 @@ unit_info_LDADD = $(libdw)
next_cfi_LDADD = $(libelf) $(libdw)
elfcopy_LDADD = $(libelf)
addsections_LDADD = $(libelf)
+debuginfod_build_id_find_LDADD = $(libelf) $(libdw)
xlate_notes_LDADD = $(libelf)
elfrdwrnop_LDADD = $(libelf)
dwelf_elf_e_machine_string_LDADD = $(libelf) $(libdw)
diff --git a/tests/debuginfod-rpms/fedora30/hello2-1.0-2.src.rpm b/tests/debuginfod-rpms/fedora30/hello2-1.0-2.src.rpm
new file mode 100644
index 00000000..29a60999
--- /dev/null
+++ b/tests/debuginfod-rpms/fedora30/hello2-1.0-2.src.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/fedora30/hello2-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/fedora30/hello2-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..2757e01a
--- /dev/null
+++ b/tests/debuginfod-rpms/fedora30/hello2-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/fedora30/hello2-debuginfo-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/fedora30/hello2-debuginfo-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..dc6e0f2f
--- /dev/null
+++ b/tests/debuginfod-rpms/fedora30/hello2-debuginfo-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/fedora30/hello2-debugsource-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/fedora30/hello2-debugsource-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..f036fa39
--- /dev/null
+++ b/tests/debuginfod-rpms/fedora30/hello2-debugsource-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/fedora30/hello2-two-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/fedora30/hello2-two-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..e1c09dac
--- /dev/null
+++ b/tests/debuginfod-rpms/fedora30/hello2-two-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/fedora30/hello2-two-debuginfo-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/fedora30/hello2-two-debuginfo-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..b9a63dfa
--- /dev/null
+++ b/tests/debuginfod-rpms/fedora30/hello2-two-debuginfo-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/hello2.spec. b/tests/debuginfod-rpms/hello2.spec.
new file mode 100644
index 00000000..0690992f
--- /dev/null
+++ b/tests/debuginfod-rpms/hello2.spec.
@@ -0,0 +1,57 @@
+Summary: hello2 -- double hello, world rpm
+Name: hello2
+Version: 1.0
+Release: 2
+Group: Utilities
+License: GPL
+Distribution: RPM ^W Elfutils test suite.
+Vendor: Red Hat Software
+Packager: Red Hat Software <bugs@redhat.com>
+URL: http://www.redhat.com
+BuildRequires: gcc make
+Source0: hello-1.0.tar.gz
+
+%description
+Simple rpm demonstration with an eye to consumption by debuginfod.
+
+%package two
+Summary: hello2two
+License: GPL
+
+%description two
+Dittoish.
+
+%prep
+%setup -q -n hello-1.0
+
+%build
+gcc -g -O1 hello.c -o hello
+gcc -g -O2 -D_FORTIFY_SOURCE=2 hello.c -o hello2
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/usr/local/bin
+cp hello $RPM_BUILD_ROOT/usr/local/bin/
+cp hello2 $RPM_BUILD_ROOT/usr/local/bin/
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%attr(0751,root,root) /usr/local/bin/hello
+
+%files two
+%defattr(-,root,root)
+%attr(0751,root,root) /usr/local/bin/hello2
+
+%changelog
+* Thu Nov 14 2019 Frank Ch. Eigler <fche@redhat.com>
+- Added source code right here to make spec file self-contained.
+- Dropped misc files not relevant to debuginfod testing.
+
+* Wed May 18 2016 Mark Wielaard <mjw@redhat.com>
+- Add hello2 for dwz testing support.
+
+* Tue Oct 20 1998 Jeff Johnson <jbj@redhat.com>
+- create.
diff --git a/tests/debuginfod-rpms/rhel6/hello2-1.0-2.i686.rpm b/tests/debuginfod-rpms/rhel6/hello2-1.0-2.i686.rpm
new file mode 100644
index 00000000..cb99fd6e
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel6/hello2-1.0-2.i686.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel6/hello2-1.0-2.src.rpm b/tests/debuginfod-rpms/rhel6/hello2-1.0-2.src.rpm
new file mode 100644
index 00000000..603a9b1a
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel6/hello2-1.0-2.src.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel6/hello2-debuginfo-1.0-2.i686.rpm b/tests/debuginfod-rpms/rhel6/hello2-debuginfo-1.0-2.i686.rpm
new file mode 100644
index 00000000..19f4360c
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel6/hello2-debuginfo-1.0-2.i686.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel6/hello2-two-1.0-2.i686.rpm b/tests/debuginfod-rpms/rhel6/hello2-two-1.0-2.i686.rpm
new file mode 100644
index 00000000..58c77a1d
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel6/hello2-two-1.0-2.i686.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel7/hello2-1.0-2.src.rpm b/tests/debuginfod-rpms/rhel7/hello2-1.0-2.src.rpm
new file mode 100644
index 00000000..5ca4d423
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel7/hello2-1.0-2.src.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel7/hello2-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/rhel7/hello2-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..0e6f6cc8
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel7/hello2-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel7/hello2-debuginfo-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/rhel7/hello2-debuginfo-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..c1136f3a
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel7/hello2-debuginfo-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod-rpms/rhel7/hello2-two-1.0-2.x86_64.rpm b/tests/debuginfod-rpms/rhel7/hello2-two-1.0-2.x86_64.rpm
new file mode 100644
index 00000000..5e89afd2
--- /dev/null
+++ b/tests/debuginfod-rpms/rhel7/hello2-two-1.0-2.x86_64.rpm
Binary files differ
diff --git a/tests/debuginfod_build_id_find.c b/tests/debuginfod_build_id_find.c
new file mode 100644
index 00000000..753a20c2
--- /dev/null
+++ b/tests/debuginfod_build_id_find.c
@@ -0,0 +1,62 @@
+/* Test program for fetching debuginfo with debuginfo-server.
+ Copyright (C) 2019 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file 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 3 of the License, or
+ (at your option) any later version.
+
+ elfutils 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/>. */
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <stdio.h>
+#include ELFUTILS_HEADER(dwfl)
+#include <elf.h>
+#include <dwarf.h>
+#include <argp.h>
+#include <assert.h>
+#include <string.h>
+
+static const char *debuginfo_path = "";
+static const Dwfl_Callbacks cb =
+ {
+ NULL,
+ dwfl_standard_find_debuginfo,
+ NULL,
+ (char **)&debuginfo_path,
+ };
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+ int expect_pass = strcmp(argv[3], "0");
+ Dwarf_Addr bias = 0;
+ Dwfl *dwfl = dwfl_begin(&cb);
+ dwfl_report_begin(dwfl);
+
+ /* Open an executable. */
+ Dwfl_Module *mod = dwfl_report_offline(dwfl, argv[2], argv[2], -1);
+
+ /* The corresponding debuginfo will not be found in debuginfo_path
+ (since it's empty), causing the server to be queried. */
+
+ Dwarf *res = dwfl_module_getdwarf(mod, &bias);
+ if (expect_pass)
+ assert(res);
+ else
+ assert(!res);
+
+ dwfl_end (dwfl);
+
+ return 0;
+}
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
new file mode 100755
index 00000000..145c704a
--- /dev/null
+++ b/tests/run-debuginfod-find.sh
@@ -0,0 +1,230 @@
+#!/bin/bash
+#
+# Copyright (C) 2019 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file 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 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils 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/>.
+
+set -x
+. $srcdir/test-subr.sh # includes set -e
+
+DB=${PWD}/.debuginfod_tmp.sqlite
+export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache
+
+# clean up trash if we were aborted early
+trap 'kill $PID1 $PID2 || true; sleep 5; rm -rf F R ${PWD}/.client_cache*; exit_cleanup' 0 1 2 3 5 9 15
+
+# find an unused port number
+while true; do
+ PORT1=`expr '(' $RANDOM % 1000 ')' + 9000`
+ ss -atn | fgrep ":$PORT1" || break
+done
+
+# We want to run debuginfod in the background. We also want to start
+# it with the same check/installcheck-sensitive LD_LIBRARY_PATH stuff
+# that the testrun alias sets. But: we if we just use
+# testrun .../debuginfod
+# it runs in a subshell, with different pid, so not helpful.
+#
+# So we gather the LD_LIBRARY_PATH with this cunning trick:
+ldpath=`testrun sh -c 'echo $LD_LIBRARY_PATH'`
+
+mkdir F R
+# not tempfiles F R - they are directories which we clean up manually
+env DEBUGINFOD_TEST_WEBAPI_SLEEP=3 LD_LIBRARY_PATH=$ldpath DEBUGINFOD_URLS= ${abs_builddir}/../debuginfod/debuginfod -F -R -vvvv -d $DB -p $PORT1 -t0 -g0 R F &
+PID1=$!
+sleep 3
+export DEBUGINFOD_URLS=http://localhost:$PORT1/ # or without trailing /
+
+# Be patient when run on a busy machine things might take a bit.
+# And under valgrind debuginfod-find is really, really slow.
+if [ "x$VALGRIND_CMD" = "x" ]; then
+ export DEBUGINFOD_TIMEOUT=60
+else
+ export DEBUGINFOD_TIMEOUT=300
+fi
+
+# We use -t0 and -g0 here to turn off time-based scanning & grooming.
+# For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process.
+
+########################################################################
+
+# Compile a simple program, strip its debuginfo and save the build-id.
+# Also move the debuginfo into another directory so that elfutils
+# cannot find it without debuginfod.
+echo "int main() { return 0; }" > ${PWD}/prog.c
+tempfiles prog.c
+gcc -g -o prog ${PWD}/prog.c
+ ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog
+BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
+ -a prog | grep 'Build ID' | cut -d ' ' -f 7`
+
+mv prog F
+mv prog.debug F
+kill -USR1 $PID1
+sleep 3 # give enough time for scanning pass
+
+########################################################################
+
+# Test whether elfutils, via the debuginfod client library dlopen hooks,
+# is able to fetch debuginfo from the local debuginfod.
+testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog 1
+
+########################################################################
+
+# Test whether debuginfod-find is able to fetch those files.
+rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
+filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID`
+cmp $filename F/prog.debug
+
+filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID`
+cmp $filename F/prog
+
+filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source $BUILDID ${PWD}/prog.c`
+cmp $filename ${PWD}/prog.c
+
+########################################################################
+
+# Add artifacts to the search paths and test whether debuginfod finds them while already running.
+
+# Build another, non-stripped binary
+echo "int main() { return 0; }" > ${PWD}/prog2.c
+tempfiles prog2.c
+gcc -g -o prog2 ${PWD}/prog2.c
+BUILDID2=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \
+ -a prog2 | grep 'Build ID' | cut -d ' ' -f 7`
+
+mv prog2 F
+kill -USR1 $PID1
+sleep 3
+
+# Rerun same tests for the prog2 binary
+filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID2`
+cmp $filename F/prog2
+filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID2`
+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
+kill -USR1 $PID1
+sleep 10
+kill -USR1 $PID1 # two hits of SIGUSR1 may be needed to resolve .debug->dwz->srefs
+sleep 10
+
+
+# Run a bank of queries against the debuginfod-rpms test cases
+
+rpm_test() {
+ __BUILDID=$1
+ __SOURCEPATH=$2
+ __SOURCESHA1=$3
+
+ filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $__BUILDID`
+ 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 debuginfo $__BUILDID`
+ 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
+}
+
+
+# common source file sha1
+SHA=f4a1a8062be998ae93b8f1cd744a398c6de6dbb1
+# fedora30
+rpm_test c36708a78618d597dee15d0dc989f093ca5f9120 /usr/src/debug/hello2-1.0-2.x86_64/hello.c $SHA
+rpm_test 41a236eb667c362a1c4196018cc4581e09722b1b /usr/src/debug/hello2-1.0-2.x86_64/hello.c $SHA
+# rhel7
+rpm_test bc1febfd03ca05e030f0d205f7659db29f8a4b30 /usr/src/debug/hello-1.0/hello.c $SHA
+rpm_test f0aa15b8aba4f3c28cac3c2a73801fefa644a9f2 /usr/src/debug/hello-1.0/hello.c $SHA
+# rhel6
+rpm_test bbbf92ebee5228310e398609c23c2d7d53f6e2f9 /usr/src/debug/hello-1.0/hello.c $SHA
+rpm_test d44d42cbd7d915bc938c81333a21e355a6022fb7 /usr/src/debug/hello-1.0/hello.c $SHA
+
+RPM_BUILDID=d44d42cbd7d915bc938c81333a21e355a6022fb7 # in rhel6/ subdir, for a later test
+
+
+########################################################################
+
+# Drop some of the artifacts, run a groom cycle; confirm that
+# debuginfod has forgotten them, but remembers others
+
+rm -r R/debuginfod-rpms/rhel6/*
+kill -USR2 $PID1 # groom cycle
+sleep 3
+rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
+
+testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $RPM_BUILDID && false || true
+
+testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $BUILDID2
+
+########################################################################
+
+# Federation mode
+
+# find another unused port
+while true; do
+ PORT2=`expr '(' $RANDOM % 1000 ')' + 9000`
+ ss -atn | fgrep ":$PORT2" || break
+done
+
+export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache2
+mkdir -p $DEBUGINFOD_CACHE_PATH
+# NB: inherits the DEBUGINFOD_URLS to the first server
+env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod -F -vvvv -d ${DB}_2 -p $PORT2 &
+PID2=$!
+sleep 3
+
+# have clients contact the new server
+export DEBUGINFOD_URLS=http://localhost:$PORT2
+testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog 1
+
+# test parallel queries in client
+export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache3
+mkdir -p $DEBUGINFOD_CACHE_PATH
+export DEBUGINFOD_URLS="BAD http://localhost:$PORT1 localhost:$PORT1 http://localhost:$PORT2 DNE"
+
+testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog2 1
+
+
+########################################################################
+
+# Run the tests again without the servers running. The target file should
+# be found in the cache.
+
+kill -INT $PID1 $PID2
+sleep 5
+tempfiles .debuginfod_*
+
+testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog2 1
+
+########################################################################
+
+# Trigger a cache clean and run the tests again. The clients should be unable to
+# find the target.
+echo 0 > $DEBUGINFOD_CACHE_PATH/cache_clean_interval_s
+echo 0 > $DEBUGINFOD_CACHE_PATH/max_unused_age_s
+
+testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog 1
+
+testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID2 && false || true
+
+exit 0