-
Notifications
You must be signed in to change notification settings - Fork 2
/
lit.cfg.in
135 lines (119 loc) · 4.26 KB
/
lit.cfg.in
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import lit.util
import lit.formats
config.name = 'perf-taint'
config.opt = '@LLVM_OPT@'
config.llc = '@LLVM_LLC@'
config.llvm_link = '@LLVM_LINK@'
config.clang = '@CLANG@'
config.clangxx = '@CLANGXX@'
config.source_root = '@CMAKE_CURRENT_SOURCE_DIR@'
config.exec_root = '@CMAKE_CURRENT_BINARY_DIR@'
# Path to test suite in build directory where tests are executed
config.test_source_root = os.path.join(config.source_root, 'tests')
config.test_exec_root = os.path.join(config.exec_root, 'tests')
config.perf_taint_include_path = os.path.join(config.source_root, 'include')
config.libcxx_include_path = os.path.join(
'@CMAKE_LIBCXX_PATH@', 'include', 'c++', 'v1'
)
config.libcxx_path = os.path.join('@CMAKE_LIBCXX_PATH@', 'lib')
config.with_unit = '@PERF_TAINT_WITH_UNIT_TESTS@' == 'TRUE'
config.with_regression = '@PERF_TAINT_WITH_REGRESSION_TESTS@' == 'TRUE'
config.with_cfsan = '@PERF_TAINT_WITH_CF_TAINTING@' == 'TRUE'
config.with_mpi = '@PERF_TAINT_WITH_MPI@' == 'TRUE'
config.with_omp = '@PERF_TAINT_WITH_OMP@' == 'TRUE'
# Dependencies
# Regression tests require MPI support
if not config.with_mpi:
config.with_regression = False
if not config.with_unit:
config.excludes.add('unit')
if not config.with_regression:
config.excludes.add('regression')
if config.with_cfsan:
config.cfsan_flag = '-dfsan-cfsan-enable'
else:
config.cfsan_flag = ''
config.excludes.add('control-flow')
if config.with_mpi:
config.mpi_include_flags = ''
for mpi_path in '@MPI_C_INCLUDE_PATH@'.split(';'):
config.mpi_include_flags += ' -I%s ' % mpi_path
config.mpi_link_flags = '@MPI_LINK_FLAGS@'
else:
config.mpi_include_flags = ''
config.mpi_link_flags = ''
config.excludes.add('mpi')
if config.with_omp:
config.omp_link_flags = '@OpenMP_C_LIBRARIES@'
else:
config.omp_link_flags = ''
config.excludes.add('openmp')
config.suffixes = ['.cpp', '.c', '.ll']
config.test_format = lit.formats.ShTest(True)
# place test .c files that we use to implement parts of the test
# however, these .c files shouldn't be run by lit directly
# this is the only way to exclude them
config.excludes.add('helpers')
# the substring of clangxx must be declared later to avoid `%clangxx` being
# translated as `%clang` + 'xx'
config.substitutions.append( ('%clangxx', config.clangxx) )
config.substitutions.append( ('%clang', config.clang) )
# Use debug-prefix-map to obtain debug paths relative to source directory.
config.substitutions.append( ('%c_flags',
'-I%s ' % config.perf_taint_include_path
+ '-c -g -O2 -mllvm -disable-llvm-optzns '
+ '-fdebug-prefix-map=%s/=' % config.source_root
)
)
config.substitutions.append( ('%cxx_flags',
'-I%s ' % config.libcxx_include_path
+ '-I%s ' % config.perf_taint_include_path
+ '-stdlib=libc++ -c -g -O2 -mllvm -disable-llvm-optzns '
+ '-fdebug-prefix-map=%s/=' % config.source_root
)
)
config.substitutions.append( ('%mpi_flags',
config.mpi_include_flags
)
)
# LLVM's opt flag: execute our perf-taint pass and then dfsan
config.substitutions.append( ('%opt_flags',
'-load ' + os.path.join(config.exec_root, 'lib', 'libPerfTaintPass.so')
+ ' -perf-taint'
+ ' -dfsan-abilist=%s/share/dfsan_abilist.txt' % config.source_root
)
)
config.substitutions.append( ('%opt_cfsan',
config.cfsan_flag
) )
config.substitutions.append( ('%opt_mpi',
'-perf-taint-func-database=%s/share/mpi_abilist.txt' % config.source_root
) )
config.substitutions.append( ('%opt', config.opt) )
# LLVM's LLC generation of machine code
config.substitutions.append( ('%llc_flags',
'-relocation-model=pic'
+ ' -filetype=obj'
)
)
config.substitutions.append( ('%llc', config.llc) )
config.substitutions.append( ('%llvm_link', config.llvm_link) )
# Compile LLVM IR and link with dfsan runtime, our runtime and libc++.
config.substitutions.append( ('%link_flags',
' -stdlib=libc++'
+ ' -fsanitize=dataflow'
+ ' -fsanitize-blacklist=%s/share/dfsan_abilist.txt' % config.source_root
+ ' -L%s' % config.libcxx_path
+ ' -Wl,--start-group,-lc++abi '
+ ' %s ' % config.mpi_link_flags
+ os.path.join(config.exec_root, 'libdfsan_runtime.a')
)
)
config.substitutions.append( ('%execparams',
'DFSAN_OPTIONS=warn_unimplemented=0'
)
)
config.substitutions.append( ('%jsonconvert',
os.path.join(config.exec_root, 'tools', 'JSONConverter')
)
)