[lsan] Add a regression test for building C code.

llvm-svn: 189016
This commit is contained in:
Sergey Matveev 2013-08-22 14:48:44 +00:00
parent 251080b0eb
commit 5371e90f7a
4 changed files with 29 additions and 0 deletions

View File

@ -24,5 +24,10 @@ clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=address "
config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
clang_lsan_cxxflags + " ")) )
clang_lsan_cflags = config.clang_cflags + " -fsanitize=address "
config.substitutions.append( ("%clang_lsan ", (" " + config.clang + " " +
clang_lsan_cflags + " ")) )
config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
config.environment['ASAN_SYMBOLIZER_PATH'] = config.llvm_symbolizer_path

View File

@ -24,4 +24,9 @@ clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=leak "
config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
clang_lsan_cxxflags + " ")) )
clang_lsan_cflags = config.clang_cflags + " -fsanitize=leak "
config.substitutions.append( ("%clang_lsan ", (" " + config.clang + " " +
clang_lsan_cflags + " ")) )
config.environment['LSAN_SYMBOLIZER_PATH'] = config.llvm_symbolizer_path

View File

@ -0,0 +1,10 @@
// Check that we can build C code.
// RUN: %clang_lsan %s -o %t
#ifdef __cplusplus
#error "This test must be built in C mode"
#endif
int main() {
// FIXME: ideally this should somehow check that we don't have libstdc++
return 0;
}

View File

@ -22,11 +22,20 @@ clang_cxxflags = ("--driver-mode=g++ "
+ "-O0 "
+ "-m64 ")
clang_cflags = ("-g "
+ "-O0 "
+ "-m64 ")
config.clang_cxxflags = clang_cxxflags
config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
clang_cxxflags + " ")) )
config.clang_cflags = clang_cflags
config.substitutions.append( ("%clang ", (" " + config.clang + " " +
clang_cflags + " ")) )
# LeakSanitizer tests are currently supported on x86-64 Linux only.
if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
config.unsupported = True