File tree Expand file tree Collapse file tree 5 files changed +41
-0
lines changed Expand file tree Collapse file tree 5 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -898,6 +898,18 @@ build-subdir=buildbot_incremental_asan
898
898
899
899
enable-asan
900
900
901
+ [preset: buildbot_incremental_linux,lsan]
902
+ build-subdir =buildbot_incremental_lsan
903
+
904
+ release-debuginfo
905
+ assertions
906
+ enable-lsan
907
+
908
+ dash-dash
909
+
910
+ build-ninja
911
+ reconfigure
912
+
901
913
# ===------------------------------------------------------------------------===#
902
914
# OS X Package Builders
903
915
# ===------------------------------------------------------------------------===#
Original file line number Diff line number Diff line change @@ -682,6 +682,14 @@ class BuildScriptInvocation(object):
682
682
# NOT pass them to build-script-impl.
683
683
if args .enable_asan :
684
684
impl_args += ["--enable-asan" ]
685
+ # If we have lsan, we need to export our suppression list. The actual
686
+ # passing in of the LSAN flag is done via the normal cmake method. We
687
+ # do not pass the flag to build-script-impl.
688
+ if args .enable_lsan :
689
+ supp_file = os .path .join (SWIFT_SOURCE_ROOT , SWIFT_REPO_NAME ,
690
+ "utils" ,
691
+ "lsan_leaks_suppression_list.txt" )
692
+ os .environ ['LSAN_OPTIONS' ] = 'suppressions={}' .format (supp_file )
685
693
if args .verbose_build :
686
694
impl_args += ["--verbose-build" ]
687
695
if args .install_symroot :
@@ -2018,6 +2026,10 @@ iterations with -O",
2018
2026
parser .add_argument (
2019
2027
"--enable-tsan-runtime" ,
2020
2028
help = "enable Thread Sanitizer on the swift runtime" )
2029
+ parser .add_argument (
2030
+ "--enable-lsan" ,
2031
+ help = "enable Leak Sanitizer for swift tools" ,
2032
+ action = arguments .action .optional_bool )
2021
2033
2022
2034
parser .add_argument (
2023
2035
"--compiler-vendor" ,
Original file line number Diff line number Diff line change
1
+ leak:*buildCompilation*
2
+ leak:*llvm::TableGenMain*
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ def common_options(self):
92
92
sanitizers .append ('Undefined' )
93
93
if args .enable_tsan :
94
94
sanitizers .append ('Thread' )
95
+ if args .enable_lsan :
96
+ sanitizers .append ('Leaks' )
95
97
if sanitizers :
96
98
define ("LLVM_USE_SANITIZER" , ";" .join (sanitizers ))
97
99
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def default_args(self):
33
33
enable_asan = False ,
34
34
enable_ubsan = False ,
35
35
enable_tsan = False ,
36
+ enable_lsan = False ,
36
37
export_compile_commands = False ,
37
38
distcc = False ,
38
39
cmake_generator = "Ninja" ,
@@ -148,6 +149,18 @@ def test_common_options_asan_ubsan_tsan(self):
148
149
"-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
149
150
"-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
150
151
152
+ def test_common_options_lsan (self ):
153
+ args = self .default_args ()
154
+ args .enable_lsan = True
155
+ cmake = self .cmake (args )
156
+ self .assertEqual (
157
+ list (cmake .common_options ()),
158
+ ["-G" , "Ninja" ,
159
+ "-DLLVM_USE_SANITIZER=Leaks" ,
160
+ "-DCMAKE_C_COMPILER:PATH=/path/to/clang" ,
161
+ "-DCMAKE_CXX_COMPILER:PATH=/path/to/clang++" ,
162
+ "-DCMAKE_MAKE_PROGRAM=" + self .which_ninja (args )])
163
+
151
164
def test_common_options_export_compile_commands (self ):
152
165
args = self .default_args ()
153
166
args .export_compile_commands = True
You can’t perform that action at this time.
0 commit comments