blob: e6d446757be4505bf88d6c79456b0fed901645c7 [file] [log] [blame]
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
# Configuration file for the 'lit' test runner.
import os
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
# 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
# substitutions
config.substitutions.append(("%libomp-compile-and-run", \
"%clang %cflags %s -o %t -lm && %t"))
config.substitutions.append(("%clang", config.test_compiler))
config.substitutions.append(("%openmp_flag", config.test_openmp_flag))
config.substitutions.append(("%cflags", config.test_cflags))