105 lines · plain
1# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:2# Configuration file for the 'lit' test runner.3 4import os5import re6import subprocess7import lit.formats8 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] = path28 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 placed39config.test_exec_root = config.test_obj_root40 41# test format42config.test_format = lit.formats.ShTest()43 44# compiler flags45config.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_flags52 53# to run with icc INTEL_LICENSE_FILE must be set54if 'INTEL_LICENSE_FILE' in os.environ:55 config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']56 57# set default environment variables for test58if '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] = value64 65# Allow XFAIL to work66for feature in config.test_compiler_features:67 config.available_features.add(feature)68 69# Setup environment to find dynamic library at runtime70append_dynamic_library_path(config.omp_library_dir)71append_dynamic_library_path(config.test_obj_root+"/..")72 73# Rpath modifications for Darwin74if config.operating_system == 'Darwin':75 config.test_flags += " -Wl,-rpath," + config.omp_library_dir76 77# Find the SDK on Darwin78if 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 " + out86 87if 'Linux' in config.operating_system:88 config.available_features.add("linux")89 90# substitutions91config.substitutions.append(("FileCheck", "tee %%t.out | %s" % config.test_filecheck))92config.substitutions.append(("%sort-threads", "sort -n -s"))93 94config.substitutions.append(("%libomp-compile-and-run", \95 "%libomp-compile && %libomp-run"))96config.substitutions.append(("%libomp-compile", \97 "%clang %cflags %s -o %t"))98config.substitutions.append(("%libomp-tool", \99 "%clang %cflags -shared -fPIC -g"))100config.substitutions.append(("%libomp-run", "%t"))101config.substitutions.append(("%clang", config.test_c_compiler))102config.substitutions.append(("%openmp_flag", config.test_openmp_flags))103config.substitutions.append(("%cflags", config.test_flags))104 105