xref: /llvm-project/openmp/tools/multiplex/tests/lit.cfg (revision e66876f2e05faa82ffee8e3c28cbfe0637193b99)
1# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
2# Configuration file for the 'lit' test runner.
3
4import os
5import re
6import subprocess
7import lit.formats
8
9# Tell pylint that we know config and lit_config exist somewhere.
10if 'PYLINT_IMPORT' in os.environ:
11    config = object()
12    lit_config = object()
13
14def 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.
30config.name = 'OMPT multiplex'
31
32# suffixes: A list of file extensions to treat as test files.
33config.suffixes = ['.c']
34
35# test_source_root: The root path where tests are located.
36config.test_source_root = os.path.dirname(__file__)
37
38# test_exec_root: The root object directory where output is placed
39config.test_exec_root = config.test_obj_root
40
41# test format
42config.test_format = lit.formats.ShTest()
43
44# compiler flags
45config.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
54if '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
58if '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
66config.target_triple = [ ]
67for feature in config.test_compiler_features:
68    config.available_features.add(feature)
69
70# Setup environment to find dynamic library at runtime
71append_dynamic_library_path(config.omp_library_dir)
72append_dynamic_library_path(config.test_obj_root+"/..")
73
74# Rpath modifications for Darwin
75if config.operating_system == 'Darwin':
76    config.test_flags += " -Wl,-rpath," + config.omp_library_dir
77
78# Find the SDK on Darwin
79if config.operating_system == 'Darwin':
80  cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
81                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
82  out, err = cmd.communicate()
83  out = out.strip()
84  res = cmd.wait()
85  if res == 0 and out:
86    config.test_flags += " -isysroot " + out
87
88if 'Linux' in config.operating_system:
89    config.available_features.add("linux")
90
91# substitutions
92config.substitutions.append(("FileCheck", "tee %%t.out | %s" % config.test_filecheck))
93config.substitutions.append(("%sort-threads", "sort -n -s"))
94
95config.substitutions.append(("%libomp-compile-and-run", \
96    "%libomp-compile && %libomp-run"))
97config.substitutions.append(("%libomp-compile", \
98    "%clang %cflags %s -o %t"))
99config.substitutions.append(("%libomp-tool", \
100    "%clang %cflags -shared -fPIC -g"))
101config.substitutions.append(("%libomp-run", "%t"))
102config.substitutions.append(("%clang", config.test_c_compiler))
103config.substitutions.append(("%openmp_flag", config.test_openmp_flags))
104config.substitutions.append(("%cflags", config.test_flags))
105
106