brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · 786b2d9 Raw
133 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 = 'libarcher'31 32# suffixes: A list of file extensions to treat as test files.33config.suffixes = ['.c', '.cpp']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.libarcher_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    " -Wl,-rpath," + config.omp_library_dir + \49    " " + config.test_archer_flags + \50    " " + config.test_extra_flags51 52config.archer_flags = "-gdwarf-4 -O1 -fsanitize=thread"53 54 55# extra libraries56libs = ""57if config.has_libatomic:58    libs += " -latomic"59 60# Allow XFAIL to work61for feature in config.test_compiler_features:62    config.available_features.add(feature)63 64# Setup environment to find dynamic library at runtime65append_dynamic_library_path(config.omp_library_dir)66append_dynamic_library_path(config.libarcher_obj_root+"/..")67 68# Rpath modifications for Darwin69if config.operating_system == 'Darwin':70    config.test_flags += " -Wl,-rpath," + config.omp_library_dir71 72# Find the SDK on Darwin73if config.operating_system == 'Darwin':74  cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],75                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)76  out, err = cmd.communicate()77  out = out.strip()78  res = cmd.wait()79  if res == 0 and out:80    config.test_flags += " -isysroot " + out81 82if 'Linux' in config.operating_system:83    config.available_features.add("linux")84 85if config.has_tsan:86    config.available_features.add("tsan")87 88# to run with icc INTEL_LICENSE_FILE must be set89if 'INTEL_LICENSE_FILE' in os.environ:90    config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']91 92# set default environment variables for test93if 'CHECK_OPENMP_ENV' in os.environ:94    test_env = os.environ['CHECK_OPENMP_ENV'].split()95    for env in test_env:96        name = env.split('=')[0]97        value = env.split('=')[1]98        config.environment[name] = value99 100config.environment['ARCHER_OPTIONS'] = "report_data_leak=1"101 102# Race Tests103config.substitutions.append(("%libarcher-compile-and-run-race-noserial", \104    "%%libarcher-compile && env ARCHER_OPTIONS=\"ignore_serial=1 %s\" %%libarcher-run-race" \105    % config.environment['ARCHER_OPTIONS']))106config.substitutions.append(("%libarcher-compile-and-run-race", \107    "%libarcher-compile && %libarcher-run-race"))108config.substitutions.append(("%libarcher-compile-and-run-nosuppression", \109                             "%libarcher-compile && %libarcher-run-nosuppression"))110config.substitutions.append(("%libarcher-compile-and-run", \111                             "%libarcher-compile && %libarcher-run"))112config.substitutions.append(("%libarcher-cxx-compile-and-run", \113    "%libarcher-cxx-compile && %libarcher-run"))114config.substitutions.append(("%libarcher-cxx-compile", \115    "%clang-archerXX %openmp_flags %archer_flags %flags -std=c++17 %s -o %t" + libs))116config.substitutions.append(("%libarcher-compile", \117                             "%clang-archer %openmp_flags %archer_flags %flags %s -o %t" + libs))118config.substitutions.append(("%libarcher-run-race", "%suppression %deflake %t 2>&1 | tee %t.log"))119config.substitutions.append(("%libarcher-run-nosuppression", "%nosuppression %t 2>&1 | tee %t.log"))120config.substitutions.append(("%libarcher-run", "%suppression %t 2>&1 | tee %t.log"))121config.substitutions.append(("%clang-archerXX", config.test_cxx_compiler))122config.substitutions.append(("%clang-archer", config.test_c_compiler))123config.substitutions.append(("%openmp_flags", config.test_openmp_flags))124config.substitutions.append(("%archer_flags", config.archer_flags))125config.substitutions.append(("%flags", config.test_flags))126config.substitutions.append(("%nosuppression", "env TSAN_OPTIONS='ignore_noninstrumented_modules=0:exitcode=0'"))127config.substitutions.append(("%suppression", "env TSAN_OPTIONS='ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1'"))128config.substitutions.append(("%deflake", os.path.join(os.path.dirname(__file__), "deflake.bash")))129 130config.substitutions.append(("FileCheck", config.test_filecheck))131config.substitutions.append(("%not", config.test_not))132config.substitutions.append(("%sort-threads", "sort --numeric-sort --stable"))133