1*7304104dSAndroid Build Coastguard Worker#!/usr/bin/env bash 2*7304104dSAndroid Build Coastguard Worker# 3*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2019-2021 Red Hat, Inc. 4*7304104dSAndroid Build Coastguard Worker# This file is part of elfutils. 5*7304104dSAndroid Build Coastguard Worker# 6*7304104dSAndroid Build Coastguard Worker# This file is free software; you can redistribute it and/or modify 7*7304104dSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 8*7304104dSAndroid Build Coastguard Worker# the Free Software Foundation; either version 3 of the License, or 9*7304104dSAndroid Build Coastguard Worker# (at your option) any later version. 10*7304104dSAndroid Build Coastguard Worker# 11*7304104dSAndroid Build Coastguard Worker# elfutils is distributed in the hope that it will be useful, but 12*7304104dSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of 13*7304104dSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*7304104dSAndroid Build Coastguard Worker# GNU General Public License for more details. 15*7304104dSAndroid Build Coastguard Worker# 16*7304104dSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 17*7304104dSAndroid Build Coastguard Worker# along with this program. If not, see <http://www.gnu.org/licenses/>. 18*7304104dSAndroid Build Coastguard Worker 19*7304104dSAndroid Build Coastguard Worker. $srcdir/debuginfod-subr.sh 20*7304104dSAndroid Build Coastguard Worker 21*7304104dSAndroid Build Coastguard Worker# for test case debugging, uncomment: 22*7304104dSAndroid Build Coastguard Workerset -x 23*7304104dSAndroid Build Coastguard Workerunset VALGRIND_CMD 24*7304104dSAndroid Build Coastguard Worker 25*7304104dSAndroid Build Coastguard Workerexport DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache 26*7304104dSAndroid Build Coastguard Worker 27*7304104dSAndroid Build Coastguard Worker# Test fetching a file using file:// . No debuginfod server needs to be run for 28*7304104dSAndroid Build Coastguard Worker# this test. 29*7304104dSAndroid Build Coastguard Workerlocal_dir=${PWD}/mocktree/buildid/aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd/source/my/path 30*7304104dSAndroid Build Coastguard Workermkdir -p ${local_dir} 31*7304104dSAndroid Build Coastguard Workerecho "int main() { return 0; }" > ${local_dir}/main.c 32*7304104dSAndroid Build Coastguard Worker# first test that is doesn't work, when no DEBUGINFOD_URLS is set 33*7304104dSAndroid Build Coastguard Workerexport DEBUGINFOD_URLS="" 34*7304104dSAndroid Build Coastguard Workertestrun ${abs_top_builddir}/debuginfod/debuginfod-find source aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd /my/path/main.c && false || true 35*7304104dSAndroid Build Coastguard Worker 36*7304104dSAndroid Build Coastguard Worker# Now test is with proper DEBUGINFOD_URLS 37*7304104dSAndroid Build Coastguard Workerexport DEBUGINFOD_URLS="file://${PWD}/mocktree/" 38*7304104dSAndroid Build Coastguard Workerfilename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd /my/path/main.c` 39*7304104dSAndroid Build Coastguard Workercmp $filename ${local_dir}/main.c 40*7304104dSAndroid Build Coastguard Worker 41*7304104dSAndroid Build Coastguard Workerexit 0 42