xref: /llvm-project/openmp/libompd/test/lit.cfg (revision 1099498e3f35b2ad4b021ba3888b590259124e74)
1# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
2# Configuration file for the 'lit' test runner.
3
4import os
5import re
6import subprocess
7import lit.formats
8
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] = path
28#    config.environment['PYTHONPATH'] = config.ompd_module + sep + config.environment['PYTHON_PATH']
29
30# name: The name of this test suite.
31config.name = 'ompd-test'
32
33# suffixes: A list of file extensions to treat as test files.
34config.suffixes = ['.c']
35
36# test_source_root: The root path where tests are located.
37#config.test_source_root = os.path.dirname(__file__)
38config.test_source_root = config.ompd_test_src
39
40# test_exec_root: The root object directory where output is placed
41config.test_exec_root = config.ompd_obj_root
42
43# test format
44config.test_format = lit.formats.ShTest()
45
46# compiler flags
47config.test_flags = " -I " + config.test_source_root + " -I " + config.ompt_include_dir + \
48    " " + config.test_extra_flags + " -L " + config.library_dir
49
50append_dynamic_library_path(config.library_dir)
51append_dynamic_library_path(config.ompd_library_dir)
52
53# Disable OMPT tests if FileCheck was not found
54if config.test_filecheck == "":
55    lit_config.note("Not testing OMPT_OMPD because FileCheck was not found")
56
57if 'Linux' in config.operating_system:
58    config.available_features.add("linux")
59
60# to run with icc INTEL_LICENSE_FILE must be set
61if 'INTEL_LICENSE_FILE' in os.environ:
62    config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']
63if 'OMP_NUM_THREADS' in os.environ:
64    config.environment['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']
65#config.environment['ompd'] = "/home/gu620893/LLVM-openmp-master/install/"
66
67config.substitutions.append(("%gdb-compile-and-run", "%gdb-compile && %gdb-run"))
68
69config.substitutions.append(("%gdb-compile",
70    "%test_c_compiler -fopenmp -g -gdwarf-4 %s -o %t " + config.test_flags))
71config.substitutions.append(("%test_c_compiler", config.test_c_compiler))
72config.substitutions.append(("%gdb-run",
73    "env OMP_DEBUG=enabled gdb -x " + config.ompd_obj_root + "/../gdb-plugin/python-module/ompd/__init__.py -x " \
74    + config.ompd_test_src + "/test.cmd %t "))
75
76config.substitutions.append(("%gdb-test",
77    "env OMP_DEBUG=enabled gdb -x " + config.ompd_obj_root + "/../gdb-plugin/python-module/ompd/__init__.py "))
78
79config.substitutions.append(("%ompt-tool",
80    config.ompt_plugin))
81
82config.substitutions.append(("FileCheck", config.test_filecheck))
83
84