forked from OSchip/llvm-project
[Debuginfod] Fix debuginfod unit test when $HOME is not writable.
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. Reviewed By: estewart08 Differential Revision: https://reviews.llvm.org/D115813
This commit is contained in:
parent
15c8b8ad85
commit
3d595eccc7
|
@ -40,6 +40,12 @@ TEST(DebuginfodClient, CacheHit) {
|
|||
// 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();
|
||||
|
|
Loading…
Reference in New Issue