Skip to content

Commit 19a4df3

Browse files
authored
[Test] Propagate XDG_CACHE_HOME to lit tests
This is another tool we can leverage to configure separate caches for CI runs in Linux to hopefully reduce the likelihood of module cache related issues. Also this will allow us to respect the default values for the environment we are running in. As per clang source code, the environment variable only impacts Linux environments. Addresses rdar://73582047
1 parent 748339a commit 19a4df3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

test/Unit/lit.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ config.test_source_root = config.test_exec_root
7272

7373
# testFormat: The test format to use to interpret tests.
7474
config.test_format = lit.formats.GoogleTest(config.build_mode, 'Tests')
75+
76+
# XDG_CACHE_HOME can be used to influence the position of the clang
77+
# module cache for all those tests that do not set that explicitly
78+
if 'XDG_CACHE_HOME' in os.environ:
79+
config.environment['XDG_CACHE_HOME'] = os.environ['XDG_CACHE_HOME']

test/lit.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,6 +2113,11 @@ if platform.system() == 'Linux':
21132113
config.available_features.add("LinuxDistribution=" + distributor + '-' + release)
21142114
lit_config.note('Running tests on %s-%s' % (distributor, release))
21152115

2116+
# XDG_CACHE_HOME can be used to influence the position of the clang
2117+
# module cache for all those tests that do not set that explicitly
2118+
if 'XDG_CACHE_HOME' in os.environ:
2119+
config.environment['XDG_CACHE_HOME'] = os.environ['XDG_CACHE_HOME']
2120+
21162121
# Copy environment variables specified in --param copy_env=..., overriding
21172122
# anything computed here. It's assumed that the person setting this knows what
21182123
# they're doing.

0 commit comments

Comments
 (0)