1#!/usr/bin/env bash 2# 3# Copyright (C) 2019-2023 Red Hat, Inc. 4# This file is part of elfutils. 5# 6# This file is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 3 of the License, or 9# (at your option) any later version. 10# 11# elfutils is distributed in the hope that it will be useful, but 12# WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19. $srcdir/debuginfod-subr.sh 20 21# for test case debugging, uncomment: 22set -x 23unset VALGRIND_CMD 24 25mkdir R Z 26# This variable is essential and ensures no time-race for claiming ports occurs 27# set base to a unique multiple of 100 not used in any other 'run-debuginfod-*' test 28base=10100 29get_ports 30 31DB=${PWD}/.debuginfod_tmp.sqlite 32tempfiles $DB 33export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache 34 35cp -rvp ${abs_srcdir}/debuginfod-rpms R 36 37if [ "$zstd" = "false" ]; then # nuke the zstd fedora 31 ones 38 rm -vrf R/debuginfod-rpms/fedora31 39 rpms=0 40 tarxz=1 41 groomed=2 42else 43 rpms=6 44 tarxz=1 45 groomed=8 46fi 47 48cp -rvp ${abs_srcdir}/debuginfod-tars Z 49 50env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod $VERBOSE -d $DB -X 'hello2' -I 'hello' -R -Z .tar.xz -Z .tar.bz2=bzcat -p $PORT1 -t0 -g0 -v R Z > vlog$PORT1 2>&1 & 51PID1=$! 52tempfiles vlog$PORT1 53errfiles vlog$PORT1 54# Server must become ready 55wait_ready $PORT1 'ready' 1 56 57# Wait till both files are in the index and scan/index fully finished 58wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 59wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 60wait_ready $PORT1 'thread_busy{role="scan"}' 0 61 62# Confirm that the hello3 files are excluded 63 64wait_ready $PORT1 'scanned_files_total{source=".rpm archive"}' $rpms 65wait_ready $PORT1 'scanned_files_total{source=".tar.xz archive"}' $tarxz 66 67 68kill $PID1 69wait $PID1 70PID1=0 71 72# Start second debuginfod, with exclusion of everything 73 74echo 'RERUN WITH -r and -X everything' >> vlog$PORT1 75 76env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod $VERBOSE -d $DB -r -X '.*' -F -R -Z .tar.xz -Z .tar.bz2=bzcat -p $PORT1 -t0 -g0 -v R Z >> vlog$PORT1 2>&1 & 77PID1=$! 78tempfiles vlog$PORT1 79errfiles vlog$PORT1 80# Server must become ready 81wait_ready $PORT1 'ready' 1 82 83wait_ready $PORT1 'thread_work_total{role="groom"}' 1 84wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 85wait_ready $PORT1 'thread_busy{role="scan"}' 0 86 87wait_ready $PORT1 'groomed_total{decision="stale"}' $groomed 88wait_ready $PORT1 'groom{statistic="files scanned (#)"}' 0 89 90kill $PID1 91wait $PID1 92PID1=0 93 94exit 0 95