ccross created this revision. ccross added a reviewer: pirama. Herald added a project: All. ccross requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Getting the default module cache path calls llvm::sys::path::cache_directory, which calls home_directory, which checks the HOME environment variable before falling back to getpwuid. When compiling against musl libc, which does not support NSS, and running on a machine that doesn't have the current user in /etc/passwd due to NSS, no home directory can be found. Set the HOME environment variable in the tests to avoid depending on getpwuid. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D132984 Files: clang/test/Driver/modules-cache-path.m clang/test/Modules/driver.c clang/test/Unit/lit.cfg.py Index: clang/test/Unit/lit.cfg.py =================================================================== --- clang/test/Unit/lit.cfg.py +++ clang/test/Unit/lit.cfg.py @@ -30,6 +30,9 @@ if 'TEMP' in os.environ: config.environment['TEMP'] = os.environ['TEMP'] +if 'HOME' in os.environ: + config.environment['HOME'] = os.environ['HOME'] + # Propagate sanitizer options. for var in [ 'ASAN_SYMBOLIZER_PATH', Index: clang/test/Modules/driver.c =================================================================== --- clang/test/Modules/driver.c +++ clang/test/Modules/driver.c @@ -1,4 +1,4 @@ -// RUN: %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s +// RUN: env HOME=%t.home %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s // RUN: %clang -fmodules -fimplicit-module-maps -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix CHECK-WITH_MODULE_CACHE %s // CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}} Index: clang/test/Driver/modules-cache-path.m =================================================================== --- clang/test/Driver/modules-cache-path.m +++ clang/test/Driver/modules-cache-path.m @@ -1,4 +1,4 @@ -// RUN: %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT +// RUN: env HOME=%t.home %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT // CHECK-DEFAULT: -fmodules-cache-path={{.*}}clang{{[/\\]+}}ModuleCache // RUN: env CLANG_MODULE_CACHE_PATH=/dev/null \
Index: clang/test/Unit/lit.cfg.py =================================================================== --- clang/test/Unit/lit.cfg.py +++ clang/test/Unit/lit.cfg.py @@ -30,6 +30,9 @@ if 'TEMP' in os.environ: config.environment['TEMP'] = os.environ['TEMP'] +if 'HOME' in os.environ: + config.environment['HOME'] = os.environ['HOME'] + # Propagate sanitizer options. for var in [ 'ASAN_SYMBOLIZER_PATH', Index: clang/test/Modules/driver.c =================================================================== --- clang/test/Modules/driver.c +++ clang/test/Modules/driver.c @@ -1,4 +1,4 @@ -// RUN: %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s +// RUN: env HOME=%t.home %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s // RUN: %clang -fmodules -fimplicit-module-maps -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix CHECK-WITH_MODULE_CACHE %s // CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}} Index: clang/test/Driver/modules-cache-path.m =================================================================== --- clang/test/Driver/modules-cache-path.m +++ clang/test/Driver/modules-cache-path.m @@ -1,4 +1,4 @@ -// RUN: %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT +// RUN: env HOME=%t.home %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT // CHECK-DEFAULT: -fmodules-cache-path={{.*}}clang{{[/\\]+}}ModuleCache // RUN: env CLANG_MODULE_CACHE_PATH=/dev/null \
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits