Skip to content

Commit 635c62a

Browse files
authored
[SYCL] Add lit parameter to pass extra system env vars (#18250)
Add lit parameter which allows to pass comma-separated list of variables to be propagated from the host environment to test environment.
1 parent b0351a0 commit 635c62a

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

sycl/test-e2e/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ configure specific single test execution in the command line:
293293
* **extra_environment** - comma-separated list of variables with values to be
294294
added to test environment. Can be also set by LIT_EXTRA_ENVIRONMENT variable
295295
in CMake.
296+
* **extra_system_environment** - comma-separated list of variables to be
297+
propagated from the host environment to test environment. Can be also set by
298+
LIT_EXTRA_SYSTEM_ENVIRONMENT variable in CMake.
296299
* **level_zero_include** - directory containing Level_Zero native headers, can
297300
be also set by CMake variable LEVEL_ZERO_INCLUDE.
298301
* **level_zero_libs_dir** - directory containing Level_Zero native libraries,

sycl/test-e2e/lit.cfg.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@
121121
]
122122
)
123123

124+
# Take into account extra system environment variables if provided via parameter.
125+
if config.extra_system_environment:
126+
lit_config.note(
127+
"Extra system variables to propagate value from: "
128+
+ config.extra_system_environment
129+
)
130+
extra_env_vars = config.extra_system_environment.split(",")
131+
for var in extra_env_vars:
132+
if var in os.environ:
133+
llvm_config.with_system_environment(var)
134+
124135
llvm_config.with_environment("PATH", config.lit_tools_dir, append_path=True)
125136

126137
# Configure LD_LIBRARY_PATH or corresponding os-specific alternatives

sycl/test-e2e/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ config.sycl_build_targets = set("target-" + t for t in lit_config.params.get(
3838
config.amd_arch = lit_config.params.get("amd_arch", "@AMD_ARCH@")
3939
config.sycl_threads_lib = '@SYCL_THREADS_LIB@'
4040
config.extra_environment = lit_config.params.get("extra_environment", "@LIT_EXTRA_ENVIRONMENT@")
41+
config.extra_system_environment = lit_config.params.get("extra_system_environment", "@LIT_EXTRA_SYSTEM_ENVIRONMENT@")
4142
config.cxx_flags = lit_config.params.get("cxx_flags", "@SYCL_E2E_CLANG_CXX_FLAGS@")
4243
config.c_flags = "@CMAKE_C_FLAGS@"
4344
config.external_tests = "@SYCL_EXTERNAL_TESTS@"

0 commit comments

Comments
 (0)