[compiler-rt] r217769 - [asan] Fix a flaky test.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Mon Sep 15 06:05:40 PDT 2014


Author: eugenis
Date: Mon Sep 15 08:05:40 2014
New Revision: 217769

URL: http://llvm.org/viewvc/llvm-project?rev=217769&view=rev
Log:
[asan] Fix a flaky test.

This test has a chance to hit some other random allocation
and get neither heap overflow nor SEGV.

Relax test condition to only check that there is no internal CHECK failure.

Modified:
    compiler-rt/trunk/test/asan/TestCases/Linux/heap-overflow-large.cc

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/heap-overflow-large.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/heap-overflow-large.cc?rev=217769&r1=217768&r2=217769&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/heap-overflow-large.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/heap-overflow-large.cc Mon Sep 15 08:05:40 2014
@@ -8,16 +8,16 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 
 int main(int argc, char *argv[]) {
+  fprintf(stderr, "main\n");
   int *x = new int[5];
   memset(x, 0, sizeof(x[0]) * 5);
   int index = atoi(argv[1]);
   int res = x[index];
-  // CHECK: AddressSanitizer: {{(heap-buffer-overflow|SEGV)}}
-  // CHECK: #0 0x{{.*}} in main {{.*}}heap-overflow-large.cc:[[@LINE-2]]
-  // CHECK: AddressSanitizer can not {{(provide additional info|describe address in more detail \(wild memory access suspected\))}}
-  // CHECK: SUMMARY: AddressSanitizer: {{(heap-buffer-overflow|SEGV)}}
+  // CHECK: main
+  // CHECK-NOT: CHECK failed
   delete[] x;
-  return res;
+  return res ? res : 1;
 }





More information about the llvm-commits mailing list