blob: 2f258eff748c7a3e6fb8acd49547080dafe1f890 [file] [log] [blame]
Jonathan Peyton614c7ef2015-09-21 20:41:31 +00001# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
2# Configuration file for the 'lit' test runner.
3
4import os
5import lit.formats
6
7# Tell pylint that we know config and lit_config exist somewhere.
8if 'PYLINT_IMPORT' in os.environ:
9 config = object()
10 lit_config = object()
11
Jonathan Peyton01dcf362015-11-30 20:02:59 +000012def append_dynamic_library_path(path):
13 if config.operating_system == 'Windows':
14 name = 'PATH'
15 sep = ';'
16 elif config.operating_system == 'Darwin':
17 name = 'DYLD_LIBRARY_PATH'
18 sep = ':'
Jonathan Peyton614c7ef2015-09-21 20:41:31 +000019 else:
Jonathan Peyton01dcf362015-11-30 20:02:59 +000020 name = 'LD_LIBRARY_PATH'
21 sep = ':'
22 if name in config.environment:
23 config.environment[name] = path + sep + config.environment[name]
24 else:
25 config.environment[name] = path
Jonathan Peyton614c7ef2015-09-21 20:41:31 +000026
27# name: The name of this test suite.
28config.name = 'libomp'
29
30# suffixes: A list of file extensions to treat as test files.
31config.suffixes = ['.c']
32
33# test_source_root: The root path where tests are located.
34config.test_source_root = os.path.dirname(__file__)
35
36# test_exec_root: The root object directory where output is placed
37config.test_exec_root = config.libomp_obj_root
38
39# test format
40config.test_format = lit.formats.ShTest()
41
42# compiler flags
43config.test_cflags = config.test_openmp_flag + \
44 " -I " + config.test_source_root + \
45 " -I " + config.omp_header_directory + \
46 " -L " + config.library_dir + \
47 " " + config.test_extra_cflags
48
49# Setup environment to find dynamic library at runtime
Jonathan Peyton01dcf362015-11-30 20:02:59 +000050append_dynamic_library_path(config.library_dir)
51if config.using_hwloc:
52 append_dynamic_library_path(config.hwloc_library_dir)
53
54# Rpath modifications for Darwin
55if config.operating_system == 'Darwin':
Jonathan Peyton5a60bc52015-09-24 15:09:51 +000056 config.test_cflags += " -Wl,-rpath," + config.library_dir
Jonathan Peyton01dcf362015-11-30 20:02:59 +000057 if config.using_hwloc:
58 config.test_cflags += " -Wl,-rpath," + config.hwloc_library_dir
Jonathan Peyton614c7ef2015-09-21 20:41:31 +000059
60# substitutions
61config.substitutions.append(("%libomp-compile-and-run", \
62 "%clang %cflags %s -o %t -lm && %t"))
63config.substitutions.append(("%clang", config.test_compiler))
64config.substitutions.append(("%openmp_flag", config.test_openmp_flag))
65config.substitutions.append(("%cflags", config.test_cflags))
66