summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test/lit.cfg
blob: c356f768b5c292b6e7686c3304cc0535db78fbf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
# Configuration file for the 'lit' test runner.

import os
import re
import subprocess
import lit.formats

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
    config = object()
    lit_config = object()

def append_dynamic_library_path(path):
    if config.operating_system == 'Windows':
        name = 'PATH'
        sep = ';'
    elif config.operating_system == 'Darwin':
        name = 'DYLD_LIBRARY_PATH'
        sep = ':'
    else:
        name = 'LD_LIBRARY_PATH'
        sep = ':'
    if name in config.environment:
        config.environment[name] = path + sep + config.environment[name]
    else:
        config.environment[name] = path

# name: The name of this test suite.
config.name = 'libomp'

# suffixes: A list of file extensions to treat as test files.
config.suffixes = ['.c']

# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)

# test_exec_root: The root object directory where output is placed
config.test_exec_root = config.libomp_obj_root

# test format
config.test_format = lit.formats.ShTest()

# compiler flags
config.test_cflags = config.test_openmp_flag + \
    " -I " + config.test_source_root + \
    " -I " + config.omp_header_directory + \
    " -L " + config.library_dir + \
    " " + config.test_extra_cflags

# Allow XFAIL to work
config.target_triple = [ ]
if re.search('gcc', config.test_compiler) is not None:
    config.available_features.add('gcc')

# Setup environment to find dynamic library at runtime
append_dynamic_library_path(config.library_dir)
if config.using_hwloc:
    append_dynamic_library_path(config.hwloc_library_dir)

# Rpath modifications for Darwin
if config.operating_system == 'Darwin':
    config.test_cflags += " -Wl,-rpath," + config.library_dir
    if config.using_hwloc:
        config.test_cflags += " -Wl,-rpath," + config.hwloc_library_dir

# Find the SDK on Darwin
if config.operating_system == 'Darwin':
  cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  out, err = cmd.communicate()
  out = out.strip()
  res = cmd.wait()
  if res == 0 and out:
    config.test_cflags += " -isysroot " + out

# Disable OMPT tests if FileCheck was not found
if config.has_ompt and config.test_filecheck == "":
    lit_config.note("Not testing OMPT because FileCheck was not found")
    config.has_ompt = False

if config.has_ompt:
    config.available_features.add("ompt")
    # for callback.h
    config.test_cflags += " -I " + config.test_source_root + "/ompt"

# substitutions
if config.has_ompt:
    config.substitutions.append(("FileCheck", config.test_filecheck))
    config.substitutions.append(("%sort-threads", "sort --numeric-sort --stable"))

config.substitutions.append(("%libomp-compile-and-run", \
    "%libomp-compile && %libomp-run"))
config.substitutions.append(("%libomp-compile", \
    "%clang %cflags %s -o %t -lm"))
config.substitutions.append(("%libomp-run", "%t"))
config.substitutions.append(("%clang", config.test_compiler))
config.substitutions.append(("%openmp_flag", config.test_openmp_flag))
config.substitutions.append(("%cflags", config.test_cflags))

OpenPOWER on IntegriCloud