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 25FDCACHE_FDS=100 26FDCACHE_MBS=100 27PREFETCH_FDS=100 28PREFETCH_MBS=100 29# This variable is essential and ensures no time-race for claiming ports occurs 30# set base to a unique multiple of 100 not used in any other 'run-debuginfod-*' test 31base=8800 32get_ports 33 34DB=${PWD}/.debuginfod_tmp.sqlite 35tempfiles $DB 36export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache 37 38echo $PORT1 39env LD_LIBRARY_PATH=$ldpath DEBUGINFOD_URLS= ${abs_builddir}/../debuginfod/debuginfod $VERBOSE -p $PORT1 -d $DB \ 40 --fdcache-mbs=$FDCACHE_MDS --fdcache-fds=$FDCACHE_FDS --fdcache-prefetch-mbs=$PREFETCH_MBS \ 41 --fdcache-prefetch-fds=$PREFETCH_FDS --fdcache-mintmp 0 -v -F F > vlog$PORT1 2>&1 & 42PID1=$! 43tempfiles vlog$PORT1 44errfiles vlog$PORT1 45# Server must become ready 46wait_ready $PORT1 'ready' 1 47 48grep 'fdcache fds ' vlog$PORT1 #$FDCACHE_FDS 49grep 'fdcache mbs ' vlog$PORT1 #$FDCACHE_MBS 50grep 'prefetch fds ' vlog$PORT1 #$PREFETCH_FDS 51grep 'prefetch mbs ' vlog$PORT1 #$PREFETCH_MBS 52# search the vlog to find what metric counts should be and check the correct metrics 53# were incrimented 54enqueue_nr=$(grep -c 'interned.*front=1' vlog$PORT1 || true) 55wait_ready $PORT1 'fdcache_op_count{op="enqueue"}' $enqueue_nr 56evict_nr=$(grep -c 'evicted a=.*' vlog$PORT1 || true) 57wait_ready $PORT1 'fdcache_op_count{op="evict"}' $evict_nr 58prefetch_enqueue_nr=$(grep -c 'interned.*front=0' vlog$PORT1 || true) 59wait_ready $PORT1 'fdcache_op_count{op="prefetch_enqueue"}' $prefetch_enqueue_nr 60prefetch_evict_nr=$(grep -c 'evicted from prefetch a=.*front=0' vlog$PORT1 || true) 61wait_ready $PORT1 'fdcache_op_count{op="prefetch_evict"}' $prefetch_evict_nr 62 63kill $PID1 64wait $PID1 65PID1=0 66exit 0 67