[llvm] [libsycl] Add lit configuration files and basic test (PR #177407)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 04:30:08 PST 2026


================
@@ -0,0 +1,214 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+import os
+import re
+import subprocess
+import textwrap
+import shlex
+
+from lit.llvm import llvm_config
+import lit.formats
+from lit.llvm.subst import ToolSubst, FindTool
+
+# name: The name of this test suite.
+config.name = "libsycl"
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes = [".cpp"]
+
+config.excludes = ["Inputs"]
+
+# test_source_root: The root path where tests are located.
+config.test_source_root = os.path.dirname(__file__)
+
+# allow expanding substitutions that are based on other substitutions
+config.recursiveExpansionLimit = 10
+
+# test_exec_root: The root path where tests should be run.
+config.test_exec_root = config.libsycl_obj_root
+
+# To be filled by lit.local.cfg files.
+config.required_features = []
+config.unsupported_features = []
+
+# Cleanup environment variables which may affect tests
+possibly_dangerous_env_vars = [
+    "COMPILER_PATH",
+    "RC_DEBUG_OPTIONS",
+    "CINDEXTEST_PREAMBLE_FILE",
+    "LIBRARY_PATH",
+    "CPATH",
+    "C_INCLUDE_PATH",
+    "CPLUS_INCLUDE_PATH",
+    "OBJC_INCLUDE_PATH",
+    "OBJCPLUS_INCLUDE_PATH",
+    "LIBCLANG_TIMING",
+    "LIBCLANG_OBJTRACKING",
+    "LIBCLANG_LOGGING",
+    "LIBCLANG_BGPRIO_INDEX",
+    "LIBCLANG_BGPRIO_EDIT",
+    "LIBCLANG_NOTHREADS",
+    "LIBCLANG_RESOURCE_USAGE",
+    "LIBCLANG_CODE_COMPLETION_LOGGING",
+    "INCLUDE",
+]
+
+for name in possibly_dangerous_env_vars:
+    if name in llvm_config.config.environment:
+        del llvm_config.config.environment[name]
+
+# Propagate some variables from the host environment.
+llvm_config.with_system_environment(
+    [
+        "PATH",
+    ]
+)
+
+# Take into account extra system environment variables if provided via parameter.
+if config.extra_system_environment:
+    lit_config.note(
+        "Extra system variables to propagate value from: "
+        + config.extra_system_environment
+    )
+    extra_env_vars = config.extra_system_environment.split(",")
+    for var in extra_env_vars:
+        if var in os.environ:
+            llvm_config.with_system_environment(var)
+
+llvm_config.with_environment("PATH", config.lit_tools_dir, append_path=True)
+
+# Configure LD_LIBRARY_PATH
+llvm_config.with_system_environment(
+    ["LD_LIBRARY_PATH", "LIBRARY_PATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]
----------------
KseniyaTikhomirova wrote:

this script covers linux only. I will add path for windows when I enable RT + tests there. This work is blocked by liboffload since it can't be built on Windows now.

https://github.com/llvm/llvm-project/pull/177407


More information about the llvm-commits mailing list