[compiler-rt] r196576 - [asan] in SizedStackTest check the death string, also restrict one of the checks to 64-bit

Kostya Serebryany kcc at google.com
Fri Dec 6 01:33:36 PST 2013


Author: kcc
Date: Fri Dec  6 03:33:36 2013
New Revision: 196576

URL: http://llvm.org/viewvc/llvm-project?rev=196576&view=rev
Log:
[asan] in SizedStackTest check the death string, also restrict one of the checks to 64-bit

Modified:
    compiler-rt/trunk/lib/asan/tests/asan_test.cc

Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=196576&r1=196575&r2=196576&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Fri Dec  6 03:33:36 2013
@@ -449,17 +449,18 @@ template<int kSize>
 NOINLINE void SizedStackTest() {
   char a[kSize];
   char  *A = Ident((char*)&a);
+  const char *expected_death = "AddressSanitizer: stack-buffer-";
   for (size_t i = 0; i < kSize; i++)
     A[i] = i;
-  EXPECT_DEATH(A[-1] = 0, "");
-  EXPECT_DEATH(A[-5] = 0, "");
+  EXPECT_DEATH(A[-1] = 0, expected_death);
+  EXPECT_DEATH(A[-5] = 0, expected_death);
+  if (kSize > 16 && SANITIZER_WORDSIZE == 64)
+    EXPECT_DEATH(A[-31] = 0, expected_death);
+  EXPECT_DEATH(A[kSize] = 0, expected_death);
+  EXPECT_DEATH(A[kSize + 1] = 0, expected_death);
+  EXPECT_DEATH(A[kSize + 5] = 0, expected_death);
   if (kSize > 16)
-    EXPECT_DEATH(A[-31] = 0, "");
-  EXPECT_DEATH(A[kSize] = 0, "");
-  EXPECT_DEATH(A[kSize + 1] = 0, "");
-  EXPECT_DEATH(A[kSize + 5] = 0, "");
-  if (kSize > 16)
-    EXPECT_DEATH(A[kSize + 31] = 0, "");
+    EXPECT_DEATH(A[kSize + 31] = 0, expected_death);
 }
 
 TEST(AddressSanitizer, SimpleStackTest) {





More information about the llvm-commits mailing list