xref: /aosp_15_r20/external/elfutils/tests/run-debuginfod-query-retry.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
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
25########################################################################
26# set up tests for retrying failed queries.
27retry_attempts=`(testrun env DEBUGINFOD_URLS=http://255.255.255.255/JUNKJUNK DEBUGINFOD_RETRY_LIMIT=10 DEBUGINFOD_VERBOSE=1 DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache \
28    ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo \
29    ${abs_top_builddir}/debuginfod/debuginfod-find || true) \
30    2>&1 >/dev/null | grep -c 'Retry failed query'`
31if [ $retry_attempts -ne 10 ]; then
32    echo "retry mechanism failed."
33    exit 1;
34fi
35
36exit 0;
37