2015-09-22 04:41:31 +08:00
|
|
|
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
|
|
|
|
# Configuration file for the 'lit' test runner.
|
|
|
|
|
|
|
|
import os
|
2016-03-24 20:52:20 +08:00
|
|
|
import re
|
2016-01-20 03:26:43 +08:00
|
|
|
import subprocess
|
2015-09-22 04:41:31 +08:00
|
|
|
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()
|
|
|
|
|
2015-12-01 04:02:59 +08:00
|
|
|
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 = ':'
|
2015-09-22 04:41:31 +08:00
|
|
|
if name in config.environment:
|
2015-12-01 04:02:59 +08:00
|
|
|
config.environment[name] = path + sep + config.environment[name]
|
2015-09-22 04:41:31 +08:00
|
|
|
else:
|
2015-12-01 04:02:59 +08:00
|
|
|
config.environment[name] = path
|
2015-09-22 04:41:31 +08:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2016-03-24 20:52:20 +08:00
|
|
|
# Allow XFAIL to work
|
|
|
|
config.target_triple = [ ]
|
|
|
|
if re.search('gcc', config.test_compiler) is not None:
|
|
|
|
config.available_features.add('gcc')
|
|
|
|
|
2015-09-22 04:41:31 +08:00
|
|
|
# Setup environment to find dynamic library at runtime
|
2015-12-01 04:02:59 +08:00
|
|
|
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':
|
2015-09-24 23:09:51 +08:00
|
|
|
config.test_cflags += " -Wl,-rpath," + config.library_dir
|
2015-12-01 04:02:59 +08:00
|
|
|
if config.using_hwloc:
|
|
|
|
config.test_cflags += " -Wl,-rpath," + config.hwloc_library_dir
|
2015-09-22 04:41:31 +08:00
|
|
|
|
2016-01-20 03:26:43 +08:00
|
|
|
# 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
|
|
|
|
|
2016-03-22 15:22:49 +08:00
|
|
|
# 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"
|
|
|
|
|
2015-09-22 04:41:31 +08:00
|
|
|
# substitutions
|
2016-03-22 15:22:49 +08:00
|
|
|
if config.has_ompt:
|
|
|
|
config.substitutions.append(("FileCheck", config.test_filecheck))
|
|
|
|
config.substitutions.append(("%sort-threads", "sort --numeric-sort --stable"))
|
|
|
|
|
2015-09-22 04:41:31 +08:00
|
|
|
config.substitutions.append(("%libomp-compile-and-run", \
|
2016-02-26 02:04:09 +08:00
|
|
|
"%libomp-compile && %libomp-run"))
|
|
|
|
config.substitutions.append(("%libomp-compile", \
|
|
|
|
"%clang %cflags %s -o %t -lm"))
|
|
|
|
config.substitutions.append(("%libomp-run", "%t"))
|
2015-09-22 04:41:31 +08:00
|
|
|
config.substitutions.append(("%clang", config.test_compiler))
|
|
|
|
config.substitutions.append(("%openmp_flag", config.test_openmp_flag))
|
|
|
|
config.substitutions.append(("%cflags", config.test_cflags))
|
|
|
|
|