Revision: 14674
Author:   [email protected]
Date:     Wed May 15 01:59:28 2013
Log:      Various minor cctest fixes to make ASAN a bit happier.

* Running with ASAN needs more stack, so don't set resource constraints too
     tight.

* Checking boot time memory usage doesn't make sense when running with ASAN,
     it eats tons of memory for itself.

* Fixed a malloc/delete[] mismatch: Not surprisingly, the pointer wrapped by
     a SmartArrayPointer should better be allocated by, well, NewArray...

Even with these 3 fixes, we still have a few failures when running our test
suite with ASAN. Most of them are either timeouts or failures caused by greatly
increased stack usage.

[email protected]

Review URL: https://codereview.chromium.org/15096011
http://code.google.com/p/v8/source/detail?r=14674

Modified:
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-mark-compact.cc
 /branches/bleeding_edge/test/cctest/test-parsing.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Mon May 13 07:18:43 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Wed May 15 01:59:28 2013
@@ -15881,11 +15881,14 @@
   if (answer > &size) return reinterpret_cast<uint32_t*>(sizeof(size));
   return answer;
 }
+
+
+// We need at least 165kB for an x64 debug build with clang and ASAN.
+static const int stack_breathing_room = 256 * i::KB;


 TEST(SetResourceConstraints) {
-  static const int K = 1024;
-  uint32_t* set_limit = ComputeStackLimit(128 * K);
+  uint32_t* set_limit = ComputeStackLimit(stack_breathing_room);

   // Set stack limit.
   v8::ResourceConstraints constraints;
@@ -15909,8 +15912,7 @@
   uint32_t* set_limit;
   {
     v8::Locker locker(CcTest::default_isolate());
-    static const int K = 1024;
-    set_limit = ComputeStackLimit(128 * K);
+    set_limit = ComputeStackLimit(stack_breathing_room);

     // Set stack limit.
     v8::ResourceConstraints constraints;
=======================================
--- /branches/bleeding_edge/test/cctest/test-mark-compact.cc Tue May 7 03:44:30 2013 +++ /branches/bleeding_edge/test/cctest/test-mark-compact.cc Wed May 15 01:59:28 2013
@@ -465,12 +465,19 @@
   global_handles->AddImplicitReferences(
         Handle<HeapObject>::cast(object).location(), NULL, 0);
 }
+
+
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+#define V8_WITH_ASAN 1
+#endif
+#endif


// Here is a memory use test that uses /proc, and is therefore Linux-only. We // do not care how much memory the simulator uses, since it is only there for
-// debugging purposes.
-#if defined(__linux__) && !defined(USE_SIMULATOR)
+// debugging purposes. Testing with ASAN doesn't make sense, either.
+#if defined(__linux__) && !defined(USE_SIMULATOR) && !defined(V8_WITH_ASAN)


 static uintptr_t ReadLong(char* buffer, intptr_t* position, int base) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-parsing.cc Wed May 8 00:45:16 2013 +++ /branches/bleeding_edge/test/cctest/test-parsing.cc Wed May 15 01:59:28 2013
@@ -388,8 +388,7 @@
       reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);

   size_t kProgramSize = 1024 * 1024;
-  i::SmartArrayPointer<char> program(
-      reinterpret_cast<char*>(malloc(kProgramSize + 1)));
+  i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1));
   memset(*program, '(', kProgramSize);
   program[kProgramSize] = '\0';

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to