srcfiles: Fix compile with --disable-libdebuginfod

Message ID 20240909082407.728903-1-mark@klomp.org
State Committed
Headers
Series srcfiles: Fix compile with --disable-libdebuginfod |

Commit Message

Mark Wielaard Sept. 9, 2024, 8:24 a.m. UTC
  The eu-srcfiles --no-backup option is only valid when build with
libdebuginfod support. Adjust the ENABLE_LIBDEBUGINFOD conditional
to not use no_backup anywhere. Also only run the run-srcfiles-self.sh
test when debuginfod is enabled.

     * src/srcfiles.cxx (zip_files): Move endif ENABLE_LIBDEBUGINFOD
     after no_backup check.
     * tests/Makefile.am (TESTS): Only add run-srcfiles-self.sh
     if DEBUGINFOD and !DUMMY_LIBDEBUGINFOD.
     * tests/run-srcfiles.self.sh: Use local DEBUGINFOD_CACHE_PATH.

https://sourceware.org/bugzilla/show_bug.cgi?id=32155

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/srcfiles.cxx           | 2 +-
 tests/Makefile.am          | 4 ++--
 tests/run-srcfiles-self.sh | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/src/srcfiles.cxx b/src/srcfiles.cxx
index 09d50f8d234a..c466b3076593 100644
--- a/src/srcfiles.cxx
+++ b/src/srcfiles.cxx
@@ -349,9 +349,9 @@  void zip_files()
         else
             cerr << "Error: Invalid build ID length (" << bits_length << ")." << endl;
     }
-    #endif
 
     if (!no_backup)
+    #endif /* ENABLE_LIBDEBUGINFOD */
       /* Files could not be located using debuginfod, search locally */
       if (fd < 0)
         fd = open(file_path.c_str(), O_RDONLY);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cdb2d405d212..424c184bc200 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -132,7 +132,6 @@  TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
 	run-find-prologues.sh run-allregs.sh run-addrcfi.sh \
 	run-dwarfcfi.sh run-nm-syms.sh \
 	run-nm-self.sh run-readelf-self.sh run-readelf-info-plus.sh \
-	run-srcfiles-self.sh \
 	run-readelf-compressed.sh \
 	run-readelf-const-values.sh \
 	run-varlocs-self.sh run-exprlocs-self.sh \
@@ -246,7 +245,8 @@  if DEBUGINFOD
 check_PROGRAMS += debuginfod_build_id_find
 # With the dummy delegation doesn't work
 if !DUMMY_LIBDEBUGINFOD
-TESTS += run-debuginfod-dlopen.sh \
+TESTS += run-srcfiles-self.sh \
+	 run-debuginfod-dlopen.sh \
 	 run-debuginfod-artifact-running.sh \
 	 run-debuginfod-fd-prefetch-caches.sh \
 	 run-debuginfod-regex.sh \
diff --git a/tests/run-srcfiles-self.sh b/tests/run-srcfiles-self.sh
index 515cc47a5169..c9dbbc096bf1 100755
--- a/tests/run-srcfiles-self.sh
+++ b/tests/run-srcfiles-self.sh
@@ -85,6 +85,7 @@  if [ -x ${abs_builddir}/../debuginfod/debuginfod ] && $zip; then
 
   export DEBUGINFOD_URLS="http://localhost:${PORT1}/"
   export DEBUGINFOD_VERBOSE=1
+  export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache
   testrun $ET_EXEC -z -b -e $ET_EXEC > test.zip
   tempfiles test.zip