[llvm-commits] [compiler-rt] r145848 - in /compiler-rt/trunk/lib/asan: Makefile.old tests/asan_exceptions_test.cc tests/test_output.sh

Kostya Serebryany kcc at google.com
Mon Dec 5 12:44:30 PST 2011


Author: kcc
Date: Mon Dec  5 14:44:30 2011
New Revision: 145848

URL: http://llvm.org/viewvc/llvm-project?rev=145848&view=rev
Log:
[asan]: test a pure C file with -faddress-sanitizer; lint fixes

Modified:
    compiler-rt/trunk/lib/asan/Makefile.old
    compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
    compiler-rt/trunk/lib/asan/tests/test_output.sh

Modified: compiler-rt/trunk/lib/asan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/Makefile.old?rev=145848&r1=145847&r2=145848&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/Makefile.old (original)
+++ compiler-rt/trunk/lib/asan/Makefile.old Mon Dec  5 14:44:30 2011
@@ -210,7 +210,7 @@
 test: t64 t32 output_tests lint
 
 output_tests: b32 b64
-	cd tests && ./test_output.sh $(CLANG_CXX)
+	cd tests && ./test_output.sh $(CLANG_CXX) $(CLANG_CC)
 
 t64: b64
 	$(BIN)/asan_test64

Modified: compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc?rev=145848&r1=145847&r2=145848&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc Mon Dec  5 14:44:30 2011
@@ -9,7 +9,7 @@
     fprintf(stderr, "%s\n", msg.c_str());
   }
   void Throw(const char& arg) const {
-    PrintString("PrintString called!"); // this line is important
+    PrintString("PrintString called!");  // this line is important
     throw arg;
   }
 };
@@ -19,7 +19,7 @@
   fprintf(stderr, "&a before = %p\n", &a);
   try {
     a.Throw('c');
-  } catch (const char&) {
+  } catch(const char&) {
     fprintf(stderr, "&a in catch = %p\n", &a);
   }
   fprintf(stderr, "&a final = %p\n", &a);

Modified: compiler-rt/trunk/lib/asan/tests/test_output.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/test_output.sh?rev=145848&r1=145847&r2=145848&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/test_output.sh (original)
+++ compiler-rt/trunk/lib/asan/tests/test_output.sh Mon Dec  5 14:44:30 2011
@@ -2,9 +2,16 @@
 
 OS=`uname`
 CXX=$1
+CC=$2
 CXXFLAGS="-mno-omit-leaf-frame-pointer"
 SYMBOLIZER=../scripts/asan_symbolize.py
 
+C_TEST=use-after-free
+$CC -g -faddress-sanitizer -O2 $C_TEST.c  || exit 1
+echo "Sanity checking a test in pure C"
+./a.out 2>&1 | grep "heap-use-after-free" > /dev/null || exit 1
+rm ./a.out
+
 for t in  *.tmpl; do
   for b in 32 64; do
     for O in 0 1 2 3; do
@@ -29,4 +36,5 @@
     done
   done
 done
+
 exit 0





More information about the llvm-commits mailing list