xref: /llvm-project/lld/test/Unit/lit.cfg.py (revision f8559751fc2b15b45ac417be9abe865085af45ad)
16f2e92c1SAlexandre Ganea# -*- Python -*-
26f2e92c1SAlexandre Ganea
36f2e92c1SAlexandre Ganea# Configuration file for the 'lit' test runner.
46f2e92c1SAlexandre Ganea
56f2e92c1SAlexandre Ganeaimport os
66f2e92c1SAlexandre Ganeaimport subprocess
76f2e92c1SAlexandre Ganea
86f2e92c1SAlexandre Ganeaimport lit.formats
96f2e92c1SAlexandre Ganea
106f2e92c1SAlexandre Ganea# name: The name of this test suite.
116f2e92c1SAlexandre Ganeaconfig.name = "LLD-Unit"
126f2e92c1SAlexandre Ganea
136f2e92c1SAlexandre Ganea# suffixes: A list of file extensions to treat as test files.
146f2e92c1SAlexandre Ganeaconfig.suffixes = []
156f2e92c1SAlexandre Ganea
166f2e92c1SAlexandre Ganea# test_source_root: The root path where tests are located.
176f2e92c1SAlexandre Ganea# test_exec_root: The root path where tests should be run.
186f2e92c1SAlexandre Ganeaconfig.test_exec_root = os.path.join(config.lld_obj_root, "unittests")
196f2e92c1SAlexandre Ganeaconfig.test_source_root = config.test_exec_root
206f2e92c1SAlexandre Ganea
216f2e92c1SAlexandre Ganea# testFormat: The test format to use to interpret tests.
226f2e92c1SAlexandre Ganeaconfig.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")
236f2e92c1SAlexandre Ganea
246f2e92c1SAlexandre Ganea# Propagate the temp directory. Windows requires this because it uses \Windows\
256f2e92c1SAlexandre Ganea# if none of these are present.
266f2e92c1SAlexandre Ganeaif "TMP" in os.environ:
276f2e92c1SAlexandre Ganea    config.environment["TMP"] = os.environ["TMP"]
286f2e92c1SAlexandre Ganeaif "TEMP" in os.environ:
296f2e92c1SAlexandre Ganea    config.environment["TEMP"] = os.environ["TEMP"]
306f2e92c1SAlexandre Ganea
316f2e92c1SAlexandre Ganea# Propagate HOME as it can be used to override incorrect homedir in passwd
326f2e92c1SAlexandre Ganea# that causes the tests to fail.
336f2e92c1SAlexandre Ganeaif "HOME" in os.environ:
346f2e92c1SAlexandre Ganea    config.environment["HOME"] = os.environ["HOME"]
356f2e92c1SAlexandre Ganea
366f2e92c1SAlexandre Ganea# Win32 seeks DLLs along %PATH%.
376f2e92c1SAlexandre Ganeaif sys.platform in ["win32", "cygwin"] and os.path.isdir(config.shlibdir):
386f2e92c1SAlexandre Ganea    config.environment["PATH"] = os.path.pathsep.join((
396f2e92c1SAlexandre Ganea            config.shlibdir, config.environment["PATH"]))
406f2e92c1SAlexandre Ganea
41*f8559751SJay Foad# Win32 may use %SYSTEMDRIVE% during file system shell operations, so propagate.
426f2e92c1SAlexandre Ganeaif sys.platform == "win32" and "SYSTEMDRIVE" in os.environ:
436f2e92c1SAlexandre Ganea    config.environment["SYSTEMDRIVE"] = os.environ["SYSTEMDRIVE"]
446f2e92c1SAlexandre Ganea
456f2e92c1SAlexandre Ganea# Expand the LLD source path so that unittests can use associated input files.
466f2e92c1SAlexandre Ganea# (see AsLibELF/ROCm.cpp test)
476f2e92c1SAlexandre Ganeaconfig.environment["LLD_SRC_DIR"] = config.lld_src_dir
48