reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
# -*- 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"))