1 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
2 # Configuration file for the 'lit' test runner.
9 # Tell pylint that we know config and lit_config exist somewhere.
10 if 'PYLINT_IMPORT' in os.environ:
14 def append_dynamic_library_path(path):
15 if config.operating_system == 'Windows':
18 elif config.operating_system == 'Darwin':
19 name = 'DYLD_LIBRARY_PATH'
22 name = 'LD_LIBRARY_PATH'
24 if name in config.environment:
25 config.environment[name] = path + sep + config.environment[name]
27 config.environment[name] = path
29 # name: The name of this test suite.
30 config.name = 'OMPT multiplex'
32 # suffixes: A list of file extensions to treat as test files.
33 config.suffixes = ['.c']
35 # test_source_root: The root path where tests are located.
36 config.test_source_root = os.path.dirname(__file__)
38 # test_exec_root: The root object directory where output is placed
39 config.test_exec_root = config.test_obj_root
42 config.test_format = lit.formats.ShTest()
45 config.test_flags = " -I " + config.test_source_root + "/.."\
46 " -I " + config.omp_header_dir + \
47 " -L " + config.omp_library_dir + \
48 " -I " + config.ompt_print_callback_dir + \
49 " -Wl,-rpath," + config.omp_library_dir + \
50 " " + config.test_openmp_flags + \
51 " " + config.test_extra_flags
53 # to run with icc INTEL_LICENSE_FILE must be set
54 if 'INTEL_LICENSE_FILE' in os.environ:
55 config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']
57 # set default environment variables for test
58 if 'CHECK_OPENMP_ENV' in os.environ:
59 test_env = os.environ['CHECK_OPENMP_ENV'].split()
61 name = env.split('=')[0]
62 value = env.split('=')[1]
63 config.environment[name] = value
66 config.target_triple = [ ]
67 for feature in config.test_compiler_features:
68 config.available_features.add(feature)
70 # Setup environment to find dynamic library at runtime
71 append_dynamic_library_path(config.omp_library_dir)
72 append_dynamic_library_path(config.test_obj_root+"/..")
74 # Rpath modifications for Darwin
75 if config.operating_system == 'Darwin':
76 config.test_flags += " -Wl,-rpath," + config.omp_library_dir
78 # Find the SDK on Darwin
79 if config.operating_system == 'Darwin':
80 cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
81 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
82 out, err = cmd.communicate()
86 config.test_flags += " -isysroot " + out
88 if 'Linux' in config.operating_system:
89 config.available_features.add("linux")
92 config.substitutions.append(("FileCheck", "tee %%t.out | %s" % config.test_filecheck))
93 config.substitutions.append(("%sort-threads", "sort -n -s"))
95 config.substitutions.append(("%libomp-compile-and-run", \
96 "%libomp-compile && %libomp-run"))
97 config.substitutions.append(("%libomp-compile", \
98 "%clang %cflags %s -o %t"))
99 config.substitutions.append(("%libomp-tool", \
100 "%clang %cflags -shared -fPIC -g"))
101 config.substitutions.append(("%libomp-run", "%t"))
102 config.substitutions.append(("%clang", config.test_c_compiler))
103 config.substitutions.append(("%openmp_flag", config.test_openmp_flags))
104 config.substitutions.append(("%cflags", config.test_flags))