lit.cfg 2.44 KB
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
# Configuration file for the 'lit' test runner.

import os
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 prepend_library_path(name, value, sep):
    if name in config.environment:
        config.environment[name] = value + sep + config.environment[name]
    else:
        config.environment[name] = value

# name: The name of this test suite.
config.name = 'libomptarget-nvptx'

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

# 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.binary_dir

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

# compiler flags
config.test_flags = " -I " + config.omp_header_directory + \
    " -L " + config.library_dir + \
    " --libomptarget-nvptx-path=" + config.library_dir;

if config.omp_host_rtl_directory:
    config.test_flags = config.test_flags + \
        " -L " + config.omp_host_rtl_directory

config.test_flags = config.test_flags + " " + config.test_extra_flags

# Setup environment to find dynamic library at runtime.
prepend_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
prepend_library_path('LD_LIBRARY_PATH', config.omp_host_rtl_directory, ":")

# Forbid fallback to host.
config.environment["OMP_TARGET_OFFLOAD"] = "MANDATORY"

# substitutions
config.substitutions.append(("%compilexx-run-and-check",
    "%compilexx-and-run | " + config.libomptarget_filecheck + " %s"))
config.substitutions.append(("%compile-run-and-check",
    "%compile-and-run | " + config.libomptarget_filecheck + " %s"))
config.substitutions.append(("%compilexx-and-run", "%compilexx && %run"))
config.substitutions.append(("%compile-and-run", "%compile && %run"))

config.substitutions.append(("%compilexx",
    "%clangxx %openmp_flags %flags %s -o %t"))
config.substitutions.append(("%compile",
    "%clang %openmp_flags %flags %s -o %t"))

config.substitutions.append(("%clangxx", config.test_cxx_compiler))
config.substitutions.append(("%clang", config.test_c_compiler))
config.substitutions.append(("%openmp_flags", config.test_openmp_flags))
config.substitutions.append(("%flags", config.test_flags))

config.substitutions.append(("%run", "%t"))