Set HOME for tests that use module cache path
authorColin Cross <ccross@android.com>
Thu, 15 Sep 2022 23:58:57 +0000 (23:58 +0000)
committerPirama Arumuga Nainar <pirama@google.com>
Thu, 15 Sep 2022 23:58:57 +0000 (23:58 +0000)
commit7fe475756b26080fe0bb02e8e317662ccc9a01f1
tree07c018e525484325a4c1509cf46210b56776c573
parent3e52c0926c22575d918e7ca8369522b986635cd3
Set HOME for tests that use module cache path

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.

Reviewed By: pirama, srhines

Differential Revision: https://reviews.llvm.org/D132984
clang/test/Driver/modules-cache-path.m
clang/test/Modules/driver.c
clang/test/Unit/lit.cfg.py