Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 2711353003: Fixed tests not having MallocHooks initialized for tests in release mode. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/source_report.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_tools_api.h" 7 #include "include/dart_tools_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/clustered_snapshot.h" 10 #include "vm/clustered_snapshot.h"
11 #include "vm/dart_api_impl.h" 11 #include "vm/dart_api_impl.h"
12 #include "vm/dart_api_message.h" 12 #include "vm/dart_api_message.h"
13 #include "vm/dart_api_state.h" 13 #include "vm/dart_api_state.h"
14 #include "vm/flags.h" 14 #include "vm/flags.h"
15 #include "vm/malloc_hooks.h"
15 #include "vm/snapshot.h" 16 #include "vm/snapshot.h"
16 #include "vm/symbols.h" 17 #include "vm/symbols.h"
17 #include "vm/unicode.h" 18 #include "vm/unicode.h"
18 #include "vm/unit_test.h" 19 #include "vm/unit_test.h"
19 20
20 namespace dart { 21 namespace dart {
21 22
22 // Check if serialized and deserialized objects are equal. 23 // Check if serialized and deserialized objects are equal.
23 static bool Equals(const Object& expected, const Object& actual) { 24 static bool Equals(const Object& expected, const Object& actual) {
24 if (expected.IsNull()) { 25 if (expected.IsNull()) {
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 for (intptr_t i = 0; i < lib_scripts.Length(); i++) { 1116 for (intptr_t i = 0; i < lib_scripts.Length(); i++) {
1116 script ^= lib_scripts.At(i); 1117 script ^= lib_scripts.At(i);
1117 EXPECT(!script.IsNull()); 1118 EXPECT(!script.IsNull());
1118 uri = script.url(); 1119 uri = script.url();
1119 OS::Print("Generating source for part: %s\n", uri.ToCString()); 1120 OS::Print("Generating source for part: %s\n", uri.ToCString());
1120 GenerateSourceAndCheck(script); 1121 GenerateSourceAndCheck(script);
1121 } 1122 }
1122 } 1123 }
1123 1124
1124 ISOLATE_UNIT_TEST_CASE(GenerateSource) { 1125 ISOLATE_UNIT_TEST_CASE(GenerateSource) {
1126 // Disable stack trace collection for this test as it results in a timeout.
1127 bool stack_trace_collection_enabled =
1128 MallocHooks::stack_trace_collection_enabled();
1129 MallocHooks::set_stack_trace_collection_enabled(false);
1130
1125 Zone* zone = thread->zone(); 1131 Zone* zone = thread->zone();
1126 Isolate* isolate = thread->isolate(); 1132 Isolate* isolate = thread->isolate();
1127 const GrowableObjectArray& libs = 1133 const GrowableObjectArray& libs =
1128 GrowableObjectArray::Handle(zone, isolate->object_store()->libraries()); 1134 GrowableObjectArray::Handle(zone, isolate->object_store()->libraries());
1129 Library& lib = Library::Handle(); 1135 Library& lib = Library::Handle();
1130 String& uri = String::Handle(); 1136 String& uri = String::Handle();
1131 for (intptr_t i = 0; i < libs.Length(); i++) { 1137 for (intptr_t i = 0; i < libs.Length(); i++) {
1132 lib ^= libs.At(i); 1138 lib ^= libs.At(i);
1133 EXPECT(!lib.IsNull()); 1139 EXPECT(!lib.IsNull());
1134 uri = lib.url(); 1140 uri = lib.url();
1135 OS::Print("Generating source for library: %s\n", uri.ToCString()); 1141 OS::Print("Generating source for library: %s\n", uri.ToCString());
1136 IterateScripts(lib); 1142 IterateScripts(lib);
1137 } 1143 }
1144
1145 MallocHooks::set_stack_trace_collection_enabled(
1146 stack_trace_collection_enabled);
1138 } 1147 }
1139 1148
1140 1149
1141 VM_UNIT_TEST_CASE(FullSnapshot) { 1150 VM_UNIT_TEST_CASE(FullSnapshot) {
1142 const char* kScriptChars = 1151 const char* kScriptChars =
1143 "class Fields {\n" 1152 "class Fields {\n"
1144 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n" 1153 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n"
1145 " int fld1;\n" 1154 " int fld1;\n"
1146 " final int fld2;\n" 1155 " final int fld2;\n"
1147 " final int bigint_fld = 0xfffffffffff;\n" 1156 " final int bigint_fld = 0xfffffffffff;\n"
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 StackZone zone(Thread::Current()); 3012 StackZone zone(Thread::Current());
3004 uint8_t* buffer; 3013 uint8_t* buffer;
3005 MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true); 3014 MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
3006 writer.WriteInlinedObjectHeader(kOmittedObjectId); 3015 writer.WriteInlinedObjectHeader(kOmittedObjectId);
3007 // For performance, we'd like single-byte headers when ids are omitted. 3016 // For performance, we'd like single-byte headers when ids are omitted.
3008 // If this starts failing, consider renumbering the snapshot ids. 3017 // If this starts failing, consider renumbering the snapshot ids.
3009 EXPECT_EQ(1, writer.BytesWritten()); 3018 EXPECT_EQ(1, writer.BytesWritten());
3010 } 3019 }
3011 3020
3012 } // namespace dart 3021 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/source_report.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698