Reviewers: Michael Starzinger,

Description:
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.

Please review this at https://codereview.chromium.org/15096011/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M test/cctest/test-api.cc
  M test/cctest/test-mark-compact.cc
  M test/cctest/test-parsing.cc


Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 4fccce6085cea8324ac7694081b54c68972cf22c..cc2a28312bc920aff88aa24f4ee2114a73b9d9a6 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -15883,9 +15883,12 @@ static uint32_t* ComputeStackLimit(uint32_t size) {
 }


+// We need at least 165kB for an x64 debug build with clang and ASAN.
+static const int stack_breathing_room = 256 * 1024;
+
+
 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 @@ TEST(SetResourceConstraintsInThread) {
   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;
Index: test/cctest/test-mark-compact.cc
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc index 2cb4646d5a8209a06d5116b61b5e10d18f35ce31..33fb8c3bfd58568de25f61957ff31d6ce0650250 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -469,8 +469,9 @@ TEST(EmptyObjectGroups) {

// 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(__has_feature) && __has_feature(address_sanitizer))


 static uintptr_t ReadLong(char* buffer, intptr_t* position, int base) {
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 05fea0bbb617ba0a9b06f140f8a144df122fd712..170ec76a14e01998fe74d7834e45977c0dc29091 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -388,8 +388,7 @@ TEST(PreParseOverflow) {
       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