[PATCH] D115813: [Debuginfod] Fix debuginfod unit test when $HOME is not writable.

Noah Shutty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 14:21:06 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3d595eccc7d5: [Debuginfod] Fix debuginfod unit test when $HOME is not writable. (authored by noajshu).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115813/new/

https://reviews.llvm.org/D115813

Files:
  llvm/unittests/Debuginfod/DebuginfodTests.cpp


Index: llvm/unittests/Debuginfod/DebuginfodTests.cpp
===================================================================
--- llvm/unittests/Debuginfod/DebuginfodTests.cpp
+++ llvm/unittests/Debuginfod/DebuginfodTests.cpp
@@ -40,6 +40,12 @@
 // Check that the Debuginfod client returns an Error when it fails to find an
 // artifact.
 TEST(DebuginfodClient, CacheMiss) {
+  // Set the cache path to a temp directory to avoid permissions issues if $HOME
+  // is not writable.
+  SmallString<32> TempDir;
+  sys::path::system_temp_directory(true, TempDir);
+  setenv("DEBUGINFOD_CACHE_PATH", TempDir.c_str(),
+         /*replace=*/1);
   // Ensure there are no urls to guarantee a cache miss.
   setenv("DEBUGINFOD_URLS", "", /*replace=*/1);
   HTTPClient::initialize();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115813.394659.patch
Type: text/x-patch
Size: 769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211215/2c8e019d/attachment.bin>


More information about the llvm-commits mailing list