1da0c48c4Sopenharmony_ci#!/usr/bin/env bash 2da0c48c4Sopenharmony_ci# 3da0c48c4Sopenharmony_ci# Copyright (C) 2021 Red Hat, Inc. 4da0c48c4Sopenharmony_ci# This file is part of elfutils. 5da0c48c4Sopenharmony_ci# 6da0c48c4Sopenharmony_ci# This file is free software; you can redistribute it and/or modify 7da0c48c4Sopenharmony_ci# it under the terms of the GNU General Public License as published by 8da0c48c4Sopenharmony_ci# the Free Software Foundation; either version 3 of the License, or 9da0c48c4Sopenharmony_ci# (at your option) any later version. 10da0c48c4Sopenharmony_ci# 11da0c48c4Sopenharmony_ci# elfutils is distributed in the hope that it will be useful, but 12da0c48c4Sopenharmony_ci# WITHOUT ANY WARRANTY; without even the implied warranty of 13da0c48c4Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14da0c48c4Sopenharmony_ci# GNU General Public License for more details. 15da0c48c4Sopenharmony_ci# 16da0c48c4Sopenharmony_ci# You should have received a copy of the GNU General Public License 17da0c48c4Sopenharmony_ci# along with this program. If not, see <http://www.gnu.org/licenses/>. 18da0c48c4Sopenharmony_ci 19da0c48c4Sopenharmony_ci. $srcdir/debuginfod-subr.sh 20da0c48c4Sopenharmony_ci 21da0c48c4Sopenharmony_ci# for test case debugging, uncomment: 22da0c48c4Sopenharmony_ciset -x 23da0c48c4Sopenharmony_ci 24da0c48c4Sopenharmony_cimkdir Z 25da0c48c4Sopenharmony_ci# This variable is essential and ensures no time-race for claiming ports occurs 26da0c48c4Sopenharmony_ci# set base to a unique multiple of 100 not used in any other 'run-debuginfod-*' test 27da0c48c4Sopenharmony_cibase=12000 28da0c48c4Sopenharmony_ciget_ports 29da0c48c4Sopenharmony_ci 30da0c48c4Sopenharmony_ciexport DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache 31da0c48c4Sopenharmony_ci 32da0c48c4Sopenharmony_cicp -rvp ${abs_srcdir}/debuginfod-tars Z 33da0c48c4Sopenharmony_citempfiles Z 34da0c48c4Sopenharmony_ci 35da0c48c4Sopenharmony_ci 36da0c48c4Sopenharmony_cifor Cnum in "" "-C" "-C10" "-C100" 37da0c48c4Sopenharmony_cido 38da0c48c4Sopenharmony_ci env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod $VERBOSE $Cnum -d :memory: -Z .tar.xz -Z .tar.bz2=bzcat -p $PORT1 -t0 -g0 -v --fdcache-fds=0 --fdcache-prefetch-fds=0 Z >> vlog$PORT1 2>&1 & 39da0c48c4Sopenharmony_ci PID1=$! 40da0c48c4Sopenharmony_ci tempfiles vlog$PORT1 41da0c48c4Sopenharmony_ci errfiles vlog$PORT1 42da0c48c4Sopenharmony_ci 43da0c48c4Sopenharmony_ci wait_ready $PORT1 'ready' 1 44da0c48c4Sopenharmony_ci # Wait for server to finish indexing 45da0c48c4Sopenharmony_ci wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 46da0c48c4Sopenharmony_ci wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 47da0c48c4Sopenharmony_ci wait_ready $PORT1 'thread_busy{role="scan"}' 0 48da0c48c4Sopenharmony_ci 49da0c48c4Sopenharmony_ci # Do a bunch of lookups in parallel 50da0c48c4Sopenharmony_ci lookup_nr=64 51da0c48c4Sopenharmony_ci for jobs in `seq $lookup_nr`; do 52da0c48c4Sopenharmony_ci curl -s http://localhost:$PORT1/buildid/cee13b2ea505a7f37bd20d271c6bc7e5f8d2dfcb/debuginfo > /dev/null & 53da0c48c4Sopenharmony_ci done 54da0c48c4Sopenharmony_ci 55da0c48c4Sopenharmony_ci # all curls should succeed 56da0c48c4Sopenharmony_ci wait_ready $PORT1 'http_responses_transfer_bytes_count{code="200",type="debuginfo"}' $lookup_nr 57da0c48c4Sopenharmony_ci 58da0c48c4Sopenharmony_ci (sleep 5; 59da0c48c4Sopenharmony_ci curl -s http://localhost:$PORT1/metrics | grep -E 'error|responses'; 60da0c48c4Sopenharmony_ci kill $PID1) & 61da0c48c4Sopenharmony_ci wait # for all curls, the ()& from just above, and for debuginfod 62da0c48c4Sopenharmony_ci PID1=0 63da0c48c4Sopenharmony_cidone 64da0c48c4Sopenharmony_ci 65da0c48c4Sopenharmony_ci# Note this xfail comes too late, the above wait_ready for 66da0c48c4Sopenharmony_ci# http_responses_transfer_bytes_count will have failed. 67da0c48c4Sopenharmony_cixfail "grep Server.reached.connection vlog$PORT1" # PR28661 68da0c48c4Sopenharmony_ci 69da0c48c4Sopenharmony_ciexit 0 70