[compiler-rt] r239461 - [ASan] Quick-fix tests for new string interceptors.

Yury Gribov y.gribov at samsung.com
Wed Jun 10 00:16:03 PDT 2015


Author: ygribov
Date: Wed Jun 10 02:16:02 2015
New Revision: 239461

URL: http://llvm.org/viewvc/llvm-project?rev=239461&view=rev
Log:
[ASan] Quick-fix tests for new string interceptors.
Patch by Maria Guseva.

Differential Revision: http://reviews.llvm.org/D10336

Modified:
    compiler-rt/trunk/test/asan/TestCases/strcasestr-1.c
    compiler-rt/trunk/test/asan/TestCases/strcspn-1.c
    compiler-rt/trunk/test/asan/TestCases/strcspn-2.c
    compiler-rt/trunk/test/asan/TestCases/strpbrk-1.c
    compiler-rt/trunk/test/asan/TestCases/strpbrk-2.c
    compiler-rt/trunk/test/asan/TestCases/strspn-1.c
    compiler-rt/trunk/test/asan/TestCases/strspn-2.c
    compiler-rt/trunk/test/asan/TestCases/strstr-1.c

Modified: compiler-rt/trunk/test/asan/TestCases/strcasestr-1.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strcasestr-1.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strcasestr-1.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strcasestr-1.c Wed Jun 10 02:16:02 2015
@@ -15,10 +15,10 @@
 int main(int argc, char **argv) {
   char *r = 0;
   char s2[] = "c";
-  char s1[] = {'a', 'b'};
+  char s1[] = {'a', 'C'};
   char s3 = 0;
   r = strcasestr(s1, s2);
   // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r == 0);
+  assert(r == s1 + 1);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strcspn-1.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strcspn-1.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strcspn-1.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strcspn-1.c Wed Jun 10 02:16:02 2015
@@ -10,10 +10,10 @@
 int main(int argc, char **argv) {
   size_t r;
   char s2[] = "ab";
-  char s1[] = {'c', 'd'};
+  char s1[] = {'c', 'a'};
   char s3 = 0;
   r = strcspn(s1, s2);
   // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r >= sizeof(s1));
+  assert(r == 1);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strcspn-2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strcspn-2.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strcspn-2.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strcspn-2.c Wed Jun 10 02:16:02 2015
@@ -10,10 +10,10 @@
 int main(int argc, char **argv) {
   size_t r;
   char s1[] = "ab";
-  char s2[] = {'c', 'd'};
+  char s2[] = {'a'};
   char s3 = 0;
   r = strcspn(s1, s2);
   // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r == sizeof(s1) - 1);
+  assert(r == 0);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strpbrk-1.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strpbrk-1.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strpbrk-1.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strpbrk-1.c Wed Jun 10 02:16:02 2015
@@ -10,10 +10,10 @@
 int main(int argc, char **argv) {
   char *r;
   char s2[] = "ab";
-  char s1[] = {'c', 'd'};
-  char s3[] = "a";
+  char s1[] = {'c', 'a'};
+  char s3 = 0;
   r = strpbrk(s1, s2);
   // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r <= s3);
+  assert(r == s1 + 1);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strpbrk-2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strpbrk-2.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strpbrk-2.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strpbrk-2.c Wed Jun 10 02:16:02 2015
@@ -9,11 +9,11 @@
 
 int main(int argc, char **argv) {
   char *r;
-  char s1[] = "a";
+  char s1[] = "c";
   char s2[] = {'b', 'c'};
   char s3 = 0;
   r = strpbrk(s1, s2);
   // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r == (r ? s1 : 0));
+  assert(r == s1);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strspn-1.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strspn-1.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strspn-1.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strspn-1.c Wed Jun 10 02:16:02 2015
@@ -10,10 +10,10 @@
 int main(int argc, char **argv) {
   size_t r;
   char s2[] = "ab";
-  char s1[] = {'a', 'a'};
+  char s1[] = {'a', 'c'};
   char s3 = 0;
   r = strspn(s1, s2);
   // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r >= sizeof(s1));
+  assert(r == 1);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strspn-2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strspn-2.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strspn-2.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strspn-2.c Wed Jun 10 02:16:02 2015
@@ -9,11 +9,11 @@
 
 int main(int argc, char **argv) {
   size_t r;
-  char s1[] = "cc";
+  char s1[] = "bbc";
   char s2[] = {'a', 'b'};
   char s3 = 0;
   r = strspn(s1, s2);
   // CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r == 0);
+  assert(r >= 2);
   return 0;
 }

Modified: compiler-rt/trunk/test/asan/TestCases/strstr-1.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/strstr-1.c?rev=239461&r1=239460&r2=239461&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/strstr-1.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/strstr-1.c Wed Jun 10 02:16:02 2015
@@ -11,10 +11,10 @@
 int main(int argc, char **argv) {
   char *r = 0;
   char s2[] = "c";
-  char s1[] = {'a', 'b'};
+  char s1[] = {'a', 'c'};
   char s3 = 0;
   r = strstr(s1, s2);
   // CHECK:'s{{[1|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
-  assert(r == 0);
+  assert(r == s1 + 1);
   return 0;
 }





More information about the llvm-commits mailing list