diff options
| author | Noah Sanci <[email protected]> | 2021-08-10 11:21:35 -0400 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2021-09-03 10:40:52 +0200 |
| commit | ef856762088bcd85ac9121b129dba0c6910369a2 (patch) | |
| tree | b33ae613f227794530adf125dc3e4ff0101f55e5 /tests/run-debuginfod-file.sh | |
| parent | 6eb991a9ebc45cc468a049ef30a98a0f7cad4a0d (diff) | |
debuginfod: Fracture tests/run-debuginfod-find.sh into specific tests
tests/run-debuginfod-find.sh was a massive test script with many broadly
varying tests. This caused the test script to fail when any number of
things went wrong and because of its intertwined nature, detecting the
source of a failure could be difficult. The size of the test script
also meant many unrelated tests were run making the testing process
unnecessarily lengthy.
This patch fractures tests/run-debuginfod-find.sh into smaller, more
manageable individual test script files. This ensures that when failure
occurs, a programmer can easily determine where their patch went
wrong. It also allows programmers to specify exactly which tests to
run, making testing more efficient. Redundancies are also reduced by
placing code in tests/debuginfod-subr.sh.
Signed-off-by: Noah Sanci <[email protected]>
Diffstat (limited to 'tests/run-debuginfod-file.sh')
| -rwxr-xr-x | tests/run-debuginfod-file.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/run-debuginfod-file.sh b/tests/run-debuginfod-file.sh new file mode 100755 index 00000000..22c956dd --- /dev/null +++ b/tests/run-debuginfod-file.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2019-2021 Red Hat, Inc. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/debuginfod-subr.sh + +# for test case debugging, uncomment: +set -x +unset VALGRIND_CMD + +export DEBUGINFOD_URLS=http://127.0.0.1:$PORT1/ # or without trailing / + +# Test fetching a file using file:// . No debuginfod server needs to be run for +# this test. +local_dir=${PWD}/mocktree/buildid/aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd/source/my/path +mkdir -p ${local_dir} +echo "int main() { return 0; }" > ${local_dir}/main.c +# first test that is doesn't work, when no DEBUGINFOD_URLS is set +DEBUGINFOD_URLS="" +testrun ${abs_top_builddir}/debuginfod/debuginfod-find source aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd /my/path/main.c && false || true + +# Now test is with proper DEBUGINFOD_URLS +DEBUGINFOD_URLS="file://${PWD}/mocktree/" +filename=`testrun ${abs_top_builddir}/debuginfod/debuginfod-find source aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd /my/path/main.c` +cmp $filename ${local_dir}/main.c + +exit 0 |
