1 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
2 # Configuration file for the 'lit' test runner.
7 # Tell pylint that we know config and lit_config exist somewhere.
8 if 'PYLINT_IMPORT' in os.environ:
12 def prepend_library_path(name, value, sep):
13 if name in config.environment:
14 config.environment[name] = value + sep + config.environment[name]
16 config.environment[name] = value
18 # name: The name of this test suite.
19 config.name = 'libomptarget-nvptx'
21 # suffixes: A list of file extensions to treat as test files.
22 config.suffixes = ['.c', '.cpp', '.cc']
24 # test_source_root: The root path where tests are located.
25 config.test_source_root = os.path.dirname(__file__)
27 # test_exec_root: The root object directory where output is placed
28 config.test_exec_root = config.binary_dir
31 config.test_format = lit.formats.ShTest()
34 config.test_flags = " -I " + config.omp_header_directory + \
35 " -L " + config.library_dir
37 if config.omp_host_rtl_directory:
38 config.test_flags = config.test_flags + \
39 " -L " + config.omp_host_rtl_directory
41 config.test_flags = config.test_flags + " " + config.test_extra_flags
43 # Setup environment to find dynamic library at runtime.
44 prepend_library_path('LIBRARY_PATH', config.library_dir, ":")
45 prepend_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
46 prepend_library_path('LD_LIBRARY_PATH', config.omp_host_rtl_directory, ":")
47 if config.cuda_libdir:
48 prepend_library_path('LD_LIBRARY_PATH', config.cuda_libdir, ":")
50 # Forbid fallback to host.
51 config.environment["OMP_TARGET_OFFLOAD"] = "MANDATORY"
54 config.substitutions.append(("%compilexx-run-and-check",
55 "%compilexx-and-run | " + config.libomptarget_filecheck + " %s"))
56 config.substitutions.append(("%compile-run-and-check",
57 "%compile-and-run | " + config.libomptarget_filecheck + " %s"))
58 config.substitutions.append(("%compilexx-and-run", "%compilexx && %run"))
59 config.substitutions.append(("%compile-and-run", "%compile && %run"))
61 config.substitutions.append(("%compilexx",
62 "%clangxx %openmp_flags %cuda_flags %flags %s -o %t"))
63 config.substitutions.append(("%compile",
64 "%clang %openmp_flags %cuda_flags %flags %s -o %t"))
66 config.substitutions.append(("%clangxx", config.test_cxx_compiler))
67 config.substitutions.append(("%clang", config.test_c_compiler))
68 config.substitutions.append(("%openmp_flags", config.test_openmp_flags))
70 config.substitutions.append(("%cuda_flags", "--cuda-path=" + config.cuda_path))
72 config.substitutions.append(("%cuda_flags", ""))
73 config.substitutions.append(("%flags", config.test_flags))
75 config.substitutions.append(("%run", "%t"))
76 config.substitutions.append(("%not", config.libomptarget_not))