| 1 |
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: |
| 2 |
# Configuration file for the 'lit' test runner. |
| 3 |
|
| 4 |
import os |
| 5 |
import re |
| 6 |
import subprocess |
| 7 |
import lit.formats |
| 8 |
|
| 9 |
# Tell pylint that we know config and lit_config exist somewhere. |
| 10 |
if 'PYLINT_IMPORT' in os.environ: |
| 11 |
config = object() |
| 12 |
lit_config = object() |
| 13 |
|
| 14 |
def append_dynamic_library_path(path): |
| 15 |
if config.operating_system == 'Windows': |
| 16 |
name = 'PATH' |
| 17 |
sep = ';' |
| 18 |
elif config.operating_system == 'Darwin': |
| 19 |
name = 'DYLD_LIBRARY_PATH' |
| 20 |
sep = ':' |
| 21 |
else: |
| 22 |
name = 'LD_LIBRARY_PATH' |
| 23 |
sep = ':' |
| 24 |
if name in config.environment: |
| 25 |
config.environment[name] = path + sep + config.environment[name] |
| 26 |
else: |
| 27 |
config.environment[name] = path |
| 28 |
|
| 29 |
# name: The name of this test suite. |
| 30 |
config.name = 'OMPT multiplex' |
| 31 |
|
| 32 |
# suffixes: A list of file extensions to treat as test files. |
| 33 |
config.suffixes = ['.c'] |
| 34 |
|
| 35 |
# test_source_root: The root path where tests are located. |
| 36 |
config.test_source_root = os.path.dirname(__file__) |
| 37 |
|
| 38 |
# test_exec_root: The root object directory where output is placed |
| 39 |
config.test_exec_root = config.test_obj_root |
| 40 |
|
| 41 |
# test format |
| 42 |
config.test_format = lit.formats.ShTest() |
| 43 |
|
| 44 |
# compiler flags |
| 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 |
| 52 |
|
| 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'] |
| 56 |
|
| 57 |
# set default environment variables for test |
| 58 |
if 'CHECK_OPENMP_ENV' in os.environ: |
| 59 |
test_env = os.environ['CHECK_OPENMP_ENV'].split() |
| 60 |
for env in test_env: |
| 61 |
name = env.split('=')[0] |
| 62 |
value = env.split('=')[1] |
| 63 |
config.environment[name] = value |
| 64 |
|
| 65 |
# Allow XFAIL to work |
| 66 |
for feature in config.test_compiler_features: |
| 67 |
config.available_features.add(feature) |
| 68 |
|
| 69 |
# Setup environment to find dynamic library at runtime |
| 70 |
append_dynamic_library_path(config.omp_library_dir) |
| 71 |
append_dynamic_library_path(config.test_obj_root+"/..") |
| 72 |
|
| 73 |
# Rpath modifications for Darwin |
| 74 |
if config.operating_system == 'Darwin': |
| 75 |
config.test_flags += " -Wl,-rpath," + config.omp_library_dir |
| 76 |
|
| 77 |
# Find the SDK on Darwin |
| 78 |
if config.operating_system == 'Darwin': |
| 79 |
cmd = subprocess.Popen(['xcrun', '--show-sdk-path'], |
| 80 |
stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 81 |
out, err = cmd.communicate() |
| 82 |
out = out.strip() |
| 83 |
res = cmd.wait() |
| 84 |
if res == 0 and out: |
| 85 |
config.test_flags += " -isysroot " + out |
| 86 |
|
| 87 |
if 'Linux' in config.operating_system: |
| 88 |
config.available_features.add("linux") |
| 89 |
|
| 90 |
# substitutions |
| 91 |
config.substitutions.append(("FileCheck", "tee %%t.out | %s" % config.test_filecheck)) |
| 92 |
config.substitutions.append(("%sort-threads", "sort -n -s")) |
| 93 |
|
| 94 |
config.substitutions.append(("%libomp-compile-and-run", \ |
| 95 |
"%libomp-compile && %libomp-run")) |
| 96 |
config.substitutions.append(("%libomp-compile", \ |
| 97 |
"%clang %cflags %s -o %t")) |
| 98 |
config.substitutions.append(("%libomp-tool", \ |
| 99 |
"%clang %cflags -shared -fPIC -g")) |
| 100 |
config.substitutions.append(("%libomp-run", "%t")) |
| 101 |
config.substitutions.append(("%clang", config.test_c_compiler)) |
| 102 |
config.substitutions.append(("%openmp_flag", config.test_openmp_flags)) |
| 103 |
config.substitutions.append(("%cflags", config.test_flags)) |
| 104 |
|