[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 11:23:55 PST 2021
noajshu created this revision.
noajshu added a reviewer: estewart08.
noajshu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The directory returned from `cache_directory` may not be writable if the unit tests are run with limited permissions (e.g. if $HOME is not writable).
This fixes a unit test of the debuginfod client to set the cache path to the system temporary directory to avoid this issue.
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.394615.patch
Type: text/x-patch
Size: 769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211215/88c76e93/attachment.bin>
More information about the llvm-commits
mailing list