|
| 1 | +# -*- Python -*- |
| 2 | + |
| 3 | +# Configuration file for the 'lit' test runner. |
| 4 | + |
| 5 | +import os |
| 6 | +import platform |
| 7 | +import subprocess |
| 8 | + |
| 9 | +import lit.formats |
| 10 | +import lit.util |
| 11 | + |
| 12 | +# name: The name of this test suite. |
| 13 | +config.name = 'SYCL-Unit' |
| 14 | + |
| 15 | +# suffixes: A list of file extensions to treat as test files. |
| 16 | +config.suffixes = [] |
| 17 | + |
| 18 | +# test_source_root: The root path where tests are located. |
| 19 | +# test_exec_root: The root path where tests should be run. |
| 20 | +config.test_exec_root = os.path.join(config.sycl_obj_root, 'unittests') |
| 21 | +config.test_source_root = config.test_exec_root |
| 22 | + |
| 23 | +# testFormat: The test format to use to interpret tests. |
| 24 | +config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests') |
| 25 | + |
| 26 | +# Propagate the temp directory. Windows requires this because it uses \Windows\ |
| 27 | +# if none of these are present. |
| 28 | +if 'TMP' in os.environ: |
| 29 | + config.environment['TMP'] = os.environ['TMP'] |
| 30 | +if 'TEMP' in os.environ: |
| 31 | + config.environment['TEMP'] = os.environ['TEMP'] |
| 32 | + |
| 33 | +# Propagate path to symbolizer for ASan/MSan. |
| 34 | +for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']: |
| 35 | + if symbolizer in os.environ: |
| 36 | + config.environment[symbolizer] = os.environ[symbolizer] |
| 37 | + |
| 38 | +def find_shlibpath_var(): |
| 39 | + if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']: |
| 40 | + yield 'LD_LIBRARY_PATH' |
| 41 | + elif platform.system() == 'Darwin': |
| 42 | + yield 'DYLD_LIBRARY_PATH' |
| 43 | + elif platform.system() == 'Windows': |
| 44 | + yield 'PATH' |
| 45 | + elif platform.system() == 'AIX': |
| 46 | + yield 'LIBPATH' |
| 47 | + |
| 48 | +for shlibpath_var in find_shlibpath_var(): |
| 49 | + # in stand-alone builds, shlibdir is clang's build tree |
| 50 | + # while llvm_libs_dir is installed LLVM (and possibly older clang) |
| 51 | + shlibpath = os.path.pathsep.join( |
| 52 | + (config.shlibdir, |
| 53 | + config.llvm_libs_dir, |
| 54 | + config.environment.get(shlibpath_var, ''))) |
| 55 | + config.environment[shlibpath_var] = shlibpath |
| 56 | + break |
| 57 | +else: |
| 58 | + lit_config.warning("unable to inject shared library path on '{}'" |
| 59 | + .format(platform.system())) |
0 commit comments