[llvm-commits] [compiler-rt] r148695 - /compiler-rt/trunk/lib/asan/tests/asan_test.cc
Alexander Potapenko
glider at google.com
Mon Jan 23 02:06:14 PST 2012
Author: glider
Date: Mon Jan 23 04:06:14 2012
New Revision: 148695
URL: http://llvm.org/viewvc/llvm-project?rev=148695&view=rev
Log:
Add a test for CFStringCreateCopy.
Normally this function should not create copies of constant strings, but it does when the default CFAllocator
is replaced (e.g. under AddressSanitizer)
This test is related to http://code.google.com/p/address-sanitizer/issues/detail?id=10
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=148695&r1=148694&r2=148695&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Mon Jan 23 04:06:14 2012
@@ -29,6 +29,8 @@
#ifndef __APPLE__
#include <malloc.h>
+#else
+#include <CoreFoundation/CFString.h>
#endif // __APPLE__
#ifdef __APPLE__
@@ -1894,6 +1896,14 @@
pthread_join(th, NULL);
pthread_key_delete(test_key);
}
+
+// Test that CFStringCreateCopy does not copy constant strings.
+TEST(AddressSanitizerMac, DISABLED_CFStringCreateCopy) {
+ CFStringRef str = CFSTR("Hello world!\n");
+ CFStringRef str2 = CFStringCreateCopy(0, str);
+ EXPECT_EQ(str, str2);
+}
+
#endif // __APPLE__
int main(int argc, char **argv) {
More information about the llvm-commits
mailing list