[compiler-rt] r189016 - [lsan] Add a regression test for building C code.

Sergey Matveev earthdok at google.com
Thu Aug 22 07:48:44 PDT 2013


Author: smatveev
Date: Thu Aug 22 09:48:44 2013
New Revision: 189016

URL: http://llvm.org/viewvc/llvm-project?rev=189016&view=rev
Log:
[lsan] Add a regression test for building C code.

Added:
    compiler-rt/trunk/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c
Modified:
    compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg
    compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg
    compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg

Modified: compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg?rev=189016&r1=189015&r2=189016&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg Thu Aug 22 09:48:44 2013
@@ -24,5 +24,10 @@ clang_lsan_cxxflags = config.clang_cxxfl
 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

Modified: compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg?rev=189016&r1=189015&r2=189016&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg Thu Aug 22 09:48:44 2013
@@ -24,4 +24,9 @@ clang_lsan_cxxflags = config.clang_cxxfl
 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

Added: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c?rev=189016&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c (added)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c Thu Aug 22 09:48:44 2013
@@ -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;
+}

Modified: compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg?rev=189016&r1=189015&r2=189016&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg Thu Aug 22 09:48:44 2013
@@ -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





More information about the llvm-commits mailing list