blob: b86c86f9063b9534fe18194fb3aff7707504ce1e [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
12def append_dynamic_library_path(name, value, sep):
13 if name in config.environment:
14 config.environment[name] = value + sep + config.environment[name]
15 else:
16 config.environment[name] = value
17
18# name: The name of this test suite.
19config.name = 'libomp'
20
21# suffixes: A list of file extensions to treat as test files.
22config.suffixes = ['.c']
23
24# test_source_root: The root path where tests are located.
25config.test_source_root = os.path.dirname(__file__)
26
27# test_exec_root: The root object directory where output is placed
28config.test_exec_root = config.libomp_obj_root
29
30# test format
31config.test_format = lit.formats.ShTest()
32
33# compiler flags
34config.test_cflags = config.test_openmp_flag + \
35 " -I " + config.test_source_root + \
36 " -I " + config.omp_header_directory + \
37 " -L " + config.library_dir + \
38 " " + config.test_extra_cflags
39
40# Setup environment to find dynamic library at runtime
41if config.operating_system == 'Windows':
42 append_dynamic_library_path('PATH', config.library_dir, ";")
43elif config.operating_system == 'Darwin':
44 append_dynamic_library_path('DYLD_LIBRARY_PATH', config.library_dir, ":")
45else: # Unices
46 append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
47
48# substitutions
49config.substitutions.append(("%libomp-compile-and-run", \
50 "%clang %cflags %s -o %t -lm && %t"))
51config.substitutions.append(("%clang", config.test_compiler))
52config.substitutions.append(("%openmp_flag", config.test_openmp_flag))
53config.substitutions.append(("%cflags", config.test_cflags))
54