1#!/usr/bin/env bash 2# 3# Copyright (C) 2019-2021 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# This variable is essential and ensures no time-race for claiming ports occurs 25# set base to a unique multiple of 100 not used in any other 'run-debuginfod-*' test 26base=8600 27get_ports 28 29DB=${PWD}/.debuginfod_tmp.sqlite 30tempfiles $DB 31export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache 32 33env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod \ 34 $VERBOSE -F -p $PORT1 -t0 -g0 -d ${DB} F > vlog$PORT1 2>&1 & 35PID1=$! 36tempfiles vlog$PORT1 37errfiles vlog$PORT1 38wait_ready $PORT1 'ready' 1 39 40######################################################################## 41## PR27983 42# Ensure no duplicate urls are used in when querying servers for files 43rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests 44env DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:7999" \ 45 LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -vvv executable 0 > vlog1 2>&1 || true 46tempfiles vlog1 47cat vlog1 48if [ $( grep -c 'duplicate url: http://127.0.0.1:'$PORT1'.*' vlog1 ) -ne 2 ]; then 49 echo "Duplicate servers remain"; 50 err 51fi 52 53kill $PID1 54wait $PID1 55PID1=0 56exit 0 57