[PATCH] D19514: [sanitizers] rewriting test assuming assert() changes coverage.
Mike Aizatsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 15:02:05 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267610: [sanitizers] rewriting test assuming assert() changes coverage. (authored by aizatsky).
Changed prior to commit:
http://reviews.llvm.org/D19514?vs=54949&id=55104#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19514
Files:
compiler-rt/trunk/test/asan/TestCases/coverage-pc-buffer.cc
Index: compiler-rt/trunk/test/asan/TestCases/coverage-pc-buffer.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/coverage-pc-buffer.cc
+++ compiler-rt/trunk/test/asan/TestCases/coverage-pc-buffer.cc
@@ -19,23 +19,47 @@
}
int main() {
- uintptr_t *buf = NULL;
- uintptr_t sz = __sanitizer_get_coverage_pc_buffer(&buf);
- assertNotZeroPcs(buf, sz);
- assert(sz);
-
- foo();
- bar();
- uintptr_t *buf1 = NULL;
- uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer(&buf1);
- assertNotZeroPcs(buf1, sz1);
- assert(buf1 == buf);
- assert(sz1 > sz);
-
- __sanitizer_reset_coverage();
- uintptr_t *buf3 = NULL;
- uintptr_t sz3 = __sanitizer_get_coverage_pc_buffer(&buf3);
- assertNotZeroPcs(buf3, sz3);
- assert(buf3 == buf);
- assert(sz3 < sz1);
+ {
+ uintptr_t *buf = NULL;
+ uintptr_t sz = __sanitizer_get_coverage_pc_buffer(&buf);
+ assertNotZeroPcs(buf, sz);
+ assert(sz);
+ }
+
+ {
+ uintptr_t *buf = NULL;
+ uintptr_t sz = __sanitizer_get_coverage_pc_buffer(&buf);
+ // call functions for the first time.
+ foo();
+ bar();
+ uintptr_t *buf1 = NULL;
+ uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer(&buf1);
+ assertNotZeroPcs(buf1, sz1);
+ assert(buf1 == buf);
+ assert(sz1 > sz);
+ }
+
+ {
+ uintptr_t *buf = NULL;
+ uintptr_t sz = __sanitizer_get_coverage_pc_buffer(&buf);
+ // second call shouldn't increase coverage.
+ bar();
+ uintptr_t *buf1 = NULL;
+ uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer(&buf1);
+ assertNotZeroPcs(buf1, sz1);
+ assert(buf1 == buf);
+ assert(sz1 == sz);
+ }
+
+ {
+ uintptr_t *buf = NULL;
+ uintptr_t sz = __sanitizer_get_coverage_pc_buffer(&buf);
+ // reset coverage to 0.
+ __sanitizer_reset_coverage();
+ uintptr_t *buf1 = NULL;
+ uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer(&buf1);
+ assertNotZeroPcs(buf1, sz1);
+ assert(buf1 == buf);
+ assert(sz1 < sz);
+ }
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19514.55104.patch
Type: text/x-patch
Size: 2002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/2299abe7/attachment.bin>
More information about the llvm-commits
mailing list