Improve test-serialize test cases.

Changes include:
 - better test coverage for builds with snapshot
 - write snapshot blobs to buffer instead of test serialization files
 - renamed tests

R=machenbach@chromium.org

Review URL: https://codereview.chromium.org/1777213002

Cr-Commit-Position: refs/heads/master@{#34657}
This commit is contained in:
yangguo 2016-03-10 01:57:47 -08:00 committed by Commit bot
parent 25279332c7
commit a65edb8be6
6 changed files with 110 additions and 250 deletions

View File

@ -99,7 +99,7 @@
# Some tests are just too slow to run for now.
'test-heap/IncrementalMarkingStepMakesBigProgressWithLargeObjects': [PASS, NO_VARIANTS],
'test-heap-profiler/ManyLocalsInSharedContext': [PASS, NO_VARIANTS],
'test-serialize/SerializeToplevelLargeCodeObject': [PASS, NO_VARIANTS],
'test-serialize/CodeSerializerLargeCodeObject': [PASS, NO_VARIANTS],
'test-debug/ThreadedDebugging': [PASS, NO_VARIANTS],
# BUG(3742).
'test-mark-compact/MarkCompactCollector': [PASS, ['arch==arm', NO_VARIANTS]],
@ -151,8 +151,8 @@
'test-api/Bug618': [PASS],
# BUG(v8:3385).
'test-serialize/DeserializeFromSecondSerialization': [PASS, FAIL],
'test-serialize/DeserializeFromSecondSerializationAndRunScript2': [PASS, FAIL],
'test-serialize/StartupSerializerOnceRunScript': [PASS, FAIL],
'test-serialize/StartupSerializerTwiceRunScript': [PASS, FAIL],
# BUG(v8:3154).
'test-heap/ReleaseOverReservedPages': [PASS, FAIL],
@ -296,10 +296,10 @@
'test-log/ProfLazyMode': [SKIP],
# BUG(1075): Unresolved crashes.
'test-serialize/Deserialize': [SKIP],
'test-serialize/DeserializeFromSecondSerializationAndRunScript2': [SKIP],
'test-serialize/DeserializeAndRunScript2': [SKIP],
'test-serialize/DeserializeFromSecondSerialization': [SKIP],
'test-serialize/StartupSerializerOnce': [SKIP],
'test-serialize/StartupSerializerTwice': [SKIP],
'test-serialize/StartupSerializerOnceRunScript': [SKIP],
'test-serialize/StartupSerializerTwiceRunScript': [SKIP],
############################################################################
# Slow tests.
@ -321,10 +321,10 @@
'test-heap/TestSizeOfRegExpCode': [SKIP],
# BUG(1075): Unresolved crashes on MIPS also.
'test-serialize/Deserialize': [SKIP],
'test-serialize/DeserializeFromSecondSerializationAndRunScript2': [SKIP],
'test-serialize/DeserializeAndRunScript2': [SKIP],
'test-serialize/DeserializeFromSecondSerialization': [SKIP],
'test-serialize/StartupSerializerOnce': [SKIP],
'test-serialize/StartupSerializerTwice': [SKIP],
'test-serialize/StartupSerializerOnceRunScript': [SKIP],
'test-serialize/StartupSerializerTwiceRunScript': [SKIP],
}], # 'arch == mipsel or arch == mips'
##############################################################################
@ -348,10 +348,10 @@
'test-heap/TestSizeOfRegExpCode': [SKIP],
# BUG(1075): Unresolved crashes on MIPS also.
'test-serialize/Deserialize': [SKIP],
'test-serialize/DeserializeFromSecondSerializationAndRunScript2': [SKIP],
'test-serialize/DeserializeAndRunScript2': [SKIP],
'test-serialize/DeserializeFromSecondSerialization': [SKIP],
'test-serialize/StartupSerializerOnce': [SKIP],
'test-serialize/StartupSerializerTwice': [SKIP],
'test-serialize/StartupSerializerOnceRunScript': [SKIP],
'test-serialize/StartupSerializerTwiceRunScript': [SKIP],
}], # 'arch == mips64el or arch == mips64'
##############################################################################
@ -563,7 +563,7 @@
'test-heap/CompilationCacheCachingBehavior': [FAIL],
'test-heap/CellsInOptimizedCodeAreWeak': [FAIL],
'test-run-inlining/InlineTwice': [FAIL],
'test-serialize/SerializeInternalReference': [FAIL, ['arch == arm or arch == arm64', PASS]],
'test-serialize/CodeSerializerInternalReference': [FAIL, ['arch == arm or arch == arm64', PASS]],
}], # ignition == True

View File

@ -50,12 +50,6 @@
using namespace v8::internal;
bool DefaultSnapshotAvailable() {
return i::Snapshot::DefaultSnapshotBlob() != NULL;
}
void DisableTurbofan() {
const char* flag = "--turbo-filter=\"\"";
FlagList::SetFlagsFromString(flag, StrLength(flag));
@ -77,34 +71,14 @@ class TestIsolate : public Isolate {
}
};
void WritePayload(const Vector<const byte>& payload, const char* file_name) {
FILE* file = v8::base::OS::FOpen(file_name, "wb");
if (file == NULL) {
PrintF("Unable to write to snapshot file \"%s\"\n", file_name);
exit(1);
}
size_t written = fwrite(payload.begin(), 1, payload.length(), file);
if (written != static_cast<size_t>(payload.length())) {
i::PrintF("Writing snapshot file failed.. Aborting.\n");
exit(1);
}
fclose(file);
static Vector<const byte> WritePayload(const Vector<const byte>& payload) {
int length = payload.length();
byte* blob = NewArray<byte>(length);
memcpy(blob, payload.begin(), length);
return Vector<const byte>(const_cast<const byte*>(blob), length);
}
static bool WriteToFile(Isolate* isolate, const char* snapshot_file) {
SnapshotByteSink sink;
StartupSerializer ser(isolate, &sink);
ser.SerializeStrongReferences();
ser.SerializeWeakReferencesAndDeferred();
SnapshotData snapshot_data(ser);
WritePayload(snapshot_data.RawData(), snapshot_file);
return true;
}
static void Serialize(v8::Isolate* isolate) {
static Vector<const byte> Serialize(v8::Isolate* isolate) {
// We have to create one context. One reason for this is so that the builtins
// can be loaded from v8natives.js and their addresses can be processed. This
// will clear the pending fixups array, which would otherwise contain GC roots
@ -117,7 +91,12 @@ static void Serialize(v8::Isolate* isolate) {
Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate);
internal_isolate->heap()->CollectAllAvailableGarbage("serialize");
WriteToFile(internal_isolate, FLAG_testing_serialization_file);
SnapshotByteSink sink;
StartupSerializer ser(internal_isolate, &sink);
ser.SerializeStrongReferences();
ser.SerializeWeakReferencesAndDeferred();
SnapshotData snapshot_data(ser);
return WritePayload(snapshot_data.RawData());
}
@ -137,49 +116,21 @@ Vector<const uint8_t> ConstructSource(Vector<const uint8_t> head,
source_length);
}
// Test that the whole heap can be serialized.
UNINITIALIZED_TEST(Serialize) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
}
// Test that heap serialization is non-destructive.
UNINITIALIZED_TEST(SerializeTwice) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
Serialize(isolate);
}
//----------------------------------------------------------------------------
// Tests that the heap can be deserialized.
v8::Isolate* InitializeFromFile(const char* snapshot_file) {
int len;
byte* str = ReadBytes(snapshot_file, &len);
if (!str) return NULL;
v8::Isolate* InitializeFromBlob(Vector<const byte> blob) {
v8::Isolate* v8_isolate = NULL;
{
SnapshotData snapshot_data(Vector<const byte>(str, len));
SnapshotData snapshot_data(blob);
Deserializer deserializer(&snapshot_data);
Isolate* isolate = new TestIsolate(false);
v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Isolate::Scope isolate_scope(v8_isolate);
isolate->Init(&deserializer);
}
DeleteArray(str);
return v8_isolate;
}
static v8::Isolate* Deserialize() {
v8::Isolate* isolate = InitializeFromFile(FLAG_testing_serialization_file);
static v8::Isolate* Deserialize(Vector<const byte> blob) {
v8::Isolate* isolate = InitializeFromBlob(blob);
CHECK(isolate);
return isolate;
}
@ -197,15 +148,15 @@ static void SanityCheck(v8::Isolate* v8_isolate) {
isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty"));
}
UNINITIALIZED_TEST(Deserialize) {
UNINITIALIZED_TEST(StartupSerializerOnce) {
// The serialize-deserialize tests only work if the VM is built without
// serialization. That doesn't matter. We don't need to be able to
// serialize a snapshot in a VM that is booted from a snapshot.
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
isolate = Deserialize();
Vector<const byte> blob = Serialize(isolate);
isolate = Deserialize(blob);
blob.Dispose();
{
v8::HandleScope handle_scope(isolate);
v8::Isolate::Scope isolate_scope(isolate);
@ -218,13 +169,14 @@ UNINITIALIZED_TEST(Deserialize) {
isolate->Dispose();
}
UNINITIALIZED_TEST(DeserializeFromSecondSerialization) {
UNINITIALIZED_TEST(StartupSerializerTwice) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
Serialize(isolate);
isolate = Deserialize();
Vector<const byte> blob1 = Serialize(isolate);
Vector<const byte> blob2 = Serialize(isolate);
blob1.Dispose();
isolate = Deserialize(blob2);
blob2.Dispose();
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
@ -237,12 +189,12 @@ UNINITIALIZED_TEST(DeserializeFromSecondSerialization) {
isolate->Dispose();
}
UNINITIALIZED_TEST(DeserializeAndRunScript2) {
UNINITIALIZED_TEST(StartupSerializerOnceRunScript) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
isolate = Deserialize();
Vector<const byte> blob = Serialize(isolate);
isolate = Deserialize(blob);
blob.Dispose();
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
@ -261,13 +213,14 @@ UNINITIALIZED_TEST(DeserializeAndRunScript2) {
isolate->Dispose();
}
UNINITIALIZED_TEST(DeserializeFromSecondSerializationAndRunScript2) {
UNINITIALIZED_TEST(StartupSerializerTwiceRunScript) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
Serialize(isolate);
isolate = Deserialize();
Vector<const byte> blob1 = Serialize(isolate);
Vector<const byte> blob2 = Serialize(isolate);
blob1.Dispose();
isolate = Deserialize(blob2);
blob2.Dispose();
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
@ -285,7 +238,8 @@ UNINITIALIZED_TEST(DeserializeFromSecondSerializationAndRunScript2) {
isolate->Dispose();
}
static void PartiallySerialize() {
static void PartiallySerializeObject(Vector<const byte>* startup_blob_out,
Vector<const byte>* partial_blob_out) {
v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
v8_isolate->Enter();
@ -320,10 +274,6 @@ static void PartiallySerialize() {
raw_foo = *(v8::Utils::OpenHandle(*foo));
}
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
{
v8::HandleScope handle_scope(v8_isolate);
v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
@ -344,40 +294,25 @@ static void PartiallySerialize() {
SnapshotData startup_snapshot(startup_serializer);
SnapshotData partial_snapshot(partial_serializer);
WritePayload(partial_snapshot.RawData(), FLAG_testing_serialization_file);
WritePayload(startup_snapshot.RawData(), startup_name.start());
startup_name.Dispose();
*partial_blob_out = WritePayload(partial_snapshot.RawData());
*startup_blob_out = WritePayload(startup_snapshot.RawData());
}
v8_isolate->Exit();
v8_isolate->Dispose();
}
UNINITIALIZED_TEST(PartialSerialization) {
UNINITIALIZED_TEST(PartialSerializerObject) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
PartiallySerialize();
}
Vector<const byte> startup_blob;
Vector<const byte> partial_blob;
PartiallySerializeObject(&startup_blob, &partial_blob);
UNINITIALIZED_TEST(PartialDeserialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
PartiallySerialize();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
v8::Isolate* v8_isolate = InitializeFromFile(startup_name.start());
v8::Isolate* v8_isolate = InitializeFromBlob(startup_blob);
startup_blob.Dispose();
CHECK(v8_isolate);
startup_name.Dispose();
{
v8::Isolate::Scope isolate_scope(v8_isolate);
const char* file_name = FLAG_testing_serialization_file;
int snapshot_size = 0;
byte* snapshot = ReadBytes(file_name, &snapshot_size);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
HandleScope handle_scope(isolate);
Handle<Object> root;
@ -385,7 +320,7 @@ UNINITIALIZED_TEST(PartialDeserialization) {
// any references to the global proxy in this test.
Handle<JSGlobalProxy> global_proxy = Handle<JSGlobalProxy>::null();
{
SnapshotData snapshot_data(Vector<const byte>(snapshot, snapshot_size));
SnapshotData snapshot_data(partial_blob);
Deserializer deserializer(&snapshot_data);
root = deserializer.DeserializePartial(isolate, global_proxy)
.ToHandleChecked();
@ -394,20 +329,20 @@ UNINITIALIZED_TEST(PartialDeserialization) {
Handle<Object> root2;
{
SnapshotData snapshot_data(Vector<const byte>(snapshot, snapshot_size));
SnapshotData snapshot_data(partial_blob);
Deserializer deserializer(&snapshot_data);
root2 = deserializer.DeserializePartial(isolate, global_proxy)
.ToHandleChecked();
CHECK(root2->IsString());
CHECK(root.is_identical_to(root2));
}
DeleteArray(snapshot);
partial_blob.Dispose();
}
v8_isolate->Dispose();
}
static void SerializeContext() {
static void PartiallySerializeContext(Vector<const byte>* startup_blob_out,
Vector<const byte>* partial_blob_out) {
v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
Heap* heap = isolate->heap();
@ -435,10 +370,6 @@ static void SerializeContext() {
// context even after we have disposed of env.
heap->CollectAllGarbage();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
{
v8::HandleScope handle_scope(v8_isolate);
v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
@ -461,46 +392,31 @@ static void SerializeContext() {
SnapshotData startup_snapshot(startup_serializer);
SnapshotData partial_snapshot(partial_serializer);
WritePayload(partial_snapshot.RawData(), FLAG_testing_serialization_file);
WritePayload(startup_snapshot.RawData(), startup_name.start());
startup_name.Dispose();
*partial_blob_out = WritePayload(partial_snapshot.RawData());
*startup_blob_out = WritePayload(startup_snapshot.RawData());
}
v8_isolate->Dispose();
}
UNINITIALIZED_TEST(ContextSerialization) {
UNINITIALIZED_TEST(PartialSerializerContext) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
SerializeContext();
}
Vector<const byte> startup_blob;
Vector<const byte> partial_blob;
PartiallySerializeContext(&startup_blob, &partial_blob);
UNINITIALIZED_TEST(ContextDeserialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
SerializeContext();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
v8::Isolate* v8_isolate = InitializeFromFile(startup_name.start());
v8::Isolate* v8_isolate = InitializeFromBlob(startup_blob);
CHECK(v8_isolate);
startup_name.Dispose();
startup_blob.Dispose();
{
v8::Isolate::Scope isolate_scope(v8_isolate);
const char* file_name = FLAG_testing_serialization_file;
int snapshot_size = 0;
byte* snapshot = ReadBytes(file_name, &snapshot_size);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
HandleScope handle_scope(isolate);
Handle<Object> root;
Handle<JSGlobalProxy> global_proxy =
isolate->factory()->NewUninitializedJSGlobalProxy();
{
SnapshotData snapshot_data(Vector<const byte>(snapshot, snapshot_size));
SnapshotData snapshot_data(partial_blob);
Deserializer deserializer(&snapshot_data);
root = deserializer.DeserializePartial(isolate, global_proxy)
.ToHandleChecked();
@ -510,19 +426,21 @@ UNINITIALIZED_TEST(ContextDeserialization) {
Handle<Object> root2;
{
SnapshotData snapshot_data(Vector<const byte>(snapshot, snapshot_size));
SnapshotData snapshot_data(partial_blob);
Deserializer deserializer(&snapshot_data);
root2 = deserializer.DeserializePartial(isolate, global_proxy)
.ToHandleChecked();
CHECK(root2->IsContext());
CHECK(!root.is_identical_to(root2));
}
DeleteArray(snapshot);
partial_blob.Dispose();
}
v8_isolate->Dispose();
}
static void SerializeCustomContext() {
static void PartiallySerializeCustomContext(
Vector<const byte>* startup_blob_out,
Vector<const byte>* partial_blob_out) {
v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
{
@ -569,10 +487,6 @@ static void SerializeCustomContext() {
// context even after we have disposed of env.
isolate->heap()->CollectAllAvailableGarbage("snapshotting");
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
{
v8::HandleScope handle_scope(v8_isolate);
v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
@ -595,47 +509,32 @@ static void SerializeCustomContext() {
SnapshotData startup_snapshot(startup_serializer);
SnapshotData partial_snapshot(partial_serializer);
WritePayload(partial_snapshot.RawData(), FLAG_testing_serialization_file);
WritePayload(startup_snapshot.RawData(), startup_name.start());
startup_name.Dispose();
*partial_blob_out = WritePayload(partial_snapshot.RawData());
*startup_blob_out = WritePayload(startup_snapshot.RawData());
}
v8_isolate->Dispose();
}
UNINITIALIZED_TEST(CustomContextSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
SerializeCustomContext();
}
UNINITIALIZED_TEST(CustomContextDeserialization) {
UNINITIALIZED_TEST(PartialSerializerCustomContext) {
DisableTurbofan();
FLAG_crankshaft = false;
if (DefaultSnapshotAvailable()) return;
SerializeCustomContext();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
Vector<const byte> startup_blob;
Vector<const byte> partial_blob;
PartiallySerializeCustomContext(&startup_blob, &partial_blob);
v8::Isolate* v8_isolate = InitializeFromFile(startup_name.start());
v8::Isolate* v8_isolate = InitializeFromBlob(startup_blob);
CHECK(v8_isolate);
startup_name.Dispose();
startup_blob.Dispose();
{
v8::Isolate::Scope isolate_scope(v8_isolate);
const char* file_name = FLAG_testing_serialization_file;
int snapshot_size = 0;
byte* snapshot = ReadBytes(file_name, &snapshot_size);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
HandleScope handle_scope(isolate);
Handle<Object> root;
Handle<JSGlobalProxy> global_proxy =
isolate->factory()->NewUninitializedJSGlobalProxy();
{
SnapshotData snapshot_data(Vector<const byte>(snapshot, snapshot_size));
SnapshotData snapshot_data(partial_blob);
Deserializer deserializer(&snapshot_data);
root = deserializer.DeserializePartial(isolate, global_proxy)
.ToHandleChecked();
@ -684,13 +583,12 @@ UNINITIALIZED_TEST(CustomContextDeserialization) {
.FromJust();
CHECK_EQ(100002, b);
}
DeleteArray(snapshot);
partial_blob.Dispose();
}
v8_isolate->Dispose();
}
TEST(PerIsolateSnapshotBlobs) {
TEST(CustomSnapshotDataBlob) {
DisableTurbofan();
const char* source1 = "function f() { return 42; }";
const char* source2 =
@ -744,8 +642,7 @@ static void SerializationFunctionTemplate(
args.GetReturnValue().Set(args[0]);
}
TEST(PerIsolateSnapshotBlobsOutdatedContextWithOverflow) {
TEST(CustomSnapshotDataBlobOutdatedContextWithOverflow) {
DisableTurbofan();
const char* source1 =
@ -791,8 +688,7 @@ TEST(PerIsolateSnapshotBlobsOutdatedContextWithOverflow) {
isolate->Dispose();
}
TEST(PerIsolateSnapshotBlobsWithLocker) {
TEST(CustomSnapshotDataBlobWithLocker) {
DisableTurbofan();
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
@ -830,8 +726,7 @@ TEST(PerIsolateSnapshotBlobsWithLocker) {
isolate1->Dispose();
}
TEST(SnapshotBlobsStackOverflow) {
TEST(CustomSnapshotDataBlobStackOverflow) {
DisableTurbofan();
const char* source =
"var a = [0];"
@ -902,8 +797,7 @@ static Handle<SharedFunctionInfo> CompileScript(
NOT_NATIVES_CODE, false);
}
TEST(SerializeToplevelOnePlusOne) {
TEST(CodeSerializerOnePlusOne) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -953,8 +847,7 @@ TEST(SerializeToplevelOnePlusOne) {
delete cache;
}
TEST(CodeCachePromotedToCompilationCache) {
TEST(CodeSerializerPromotedToCompilationCache) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -984,8 +877,7 @@ TEST(CodeCachePromotedToCompilationCache) {
delete cache;
}
TEST(SerializeToplevelInternalizedString) {
TEST(CodeSerializerInternalizedString) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1044,8 +936,7 @@ TEST(SerializeToplevelInternalizedString) {
delete cache;
}
TEST(SerializeToplevelLargeCodeObject) {
TEST(CodeSerializerLargeCodeObject) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1092,8 +983,7 @@ TEST(SerializeToplevelLargeCodeObject) {
source.Dispose();
}
TEST(SerializeToplevelLargeStrings) {
TEST(CodeSerializerLargeStrings) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1150,8 +1040,7 @@ TEST(SerializeToplevelLargeStrings) {
source_t.Dispose();
}
TEST(SerializeToplevelThreeBigStrings) {
TEST(CodeSerializerThreeBigStrings) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1261,8 +1150,7 @@ class SerializerTwoByteResource : public v8::String::ExternalStringResource {
size_t length_;
};
TEST(SerializeToplevelExternalString) {
TEST(CodeSerializerExternalString) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1324,8 +1212,7 @@ TEST(SerializeToplevelExternalString) {
delete cache;
}
TEST(SerializeToplevelLargeExternalString) {
TEST(CodeSerializerLargeExternalString) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1383,8 +1270,7 @@ TEST(SerializeToplevelLargeExternalString) {
string.Dispose();
}
TEST(SerializeToplevelExternalScriptName) {
TEST(CodeSerializerExternalScriptName) {
FLAG_serialize_toplevel = true;
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@ -1483,8 +1369,7 @@ v8::ScriptCompiler::CachedData* ProduceCache(const char* source) {
return cache;
}
TEST(SerializeToplevelIsolates) {
TEST(CodeSerializerIsolates) {
FLAG_serialize_toplevel = true;
const char* source = "function f() { return 'abc'; }; f() + 'def'";
@ -1525,8 +1410,7 @@ TEST(SerializeToplevelIsolates) {
isolate2->Dispose();
}
TEST(SerializeToplevelFlagChange) {
TEST(CodeSerializerFlagChange) {
FLAG_serialize_toplevel = true;
const char* source = "function f() { return 'abc'; }; f() + 'def'";
@ -1555,8 +1439,7 @@ TEST(SerializeToplevelFlagChange) {
isolate2->Dispose();
}
TEST(SerializeToplevelBitFlip) {
TEST(CodeSerializerBitFlip) {
FLAG_serialize_toplevel = true;
const char* source = "function f() { return 'abc'; }; f() + 'def'";
@ -1585,8 +1468,7 @@ TEST(SerializeToplevelBitFlip) {
isolate2->Dispose();
}
TEST(SerializeWithHarmonyScoping) {
TEST(CodeSerializerWithHarmonyScoping) {
FLAG_serialize_toplevel = true;
const char* source1 = "'use strict'; let x = 'X'";
@ -1664,8 +1546,7 @@ TEST(SerializeWithHarmonyScoping) {
isolate2->Dispose();
}
TEST(SerializeInternalReference) {
TEST(CodeSerializerInternalReference) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
return;
#endif
@ -1753,7 +1634,6 @@ TEST(SerializeInternalReference) {
TEST(Regress503552) {
// Test that the code serializer can deal with weak cells that form a linked
// list during incremental marking.
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();

View File

@ -42,15 +42,6 @@ class CcTestSuite(testsuite.TestSuite):
build_dir = "build"
else:
build_dir = "out"
self.serdes_dir = os.path.normpath(
os.path.join(root, "..", "..", build_dir, ".serdes"))
def SetupWorkingDirectory(self):
# This is only called once per machine, while init above is called once per
# process.
if os.path.exists(self.serdes_dir):
shutil.rmtree(self.serdes_dir, True)
os.makedirs(self.serdes_dir)
def ListTests(self, context):
shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
@ -72,10 +63,7 @@ class CcTestSuite(testsuite.TestSuite):
def GetFlagsForTestCase(self, testcase, context):
testname = testcase.path.split(os.path.sep)[-1]
serialization_file = os.path.join(self.serdes_dir, "serdes_" + testname)
serialization_file += ''.join(testcase.flags).replace('-', '_')
return (testcase.flags + [testcase.path] + context.mode_flags +
["--testing_serialization_file=" + serialization_file])
return (testcase.flags + [testcase.path] + context.mode_flags)
def shell(self):
return "cctest"

View File

@ -321,7 +321,6 @@ def Main():
suite = testsuite.TestSuite.LoadTestSuite(
os.path.join(BASE_DIR, "test", root))
if suite:
suite.SetupWorkingDirectory()
suites.append(suite)
if options.download_data:

View File

@ -626,7 +626,6 @@ def Main():
suite = testsuite.TestSuite.LoadTestSuite(
os.path.join(BASE_DIR, "test", root))
if suite:
suite.SetupWorkingDirectory()
suites.append(suite)
if options.download_data or options.download_data_only:

View File

@ -102,7 +102,6 @@ class TestSuite(object):
def __init__(self, name, root):
# Note: This might be called concurrently from different processes.
# Changing harddisk state should be done in 'SetupWorkingDirectory' below.
self.name = name # string
self.root = root # string containing path
self.tests = None # list of TestCase objects
@ -110,11 +109,6 @@ class TestSuite(object):
self.wildcards = None # dictionary mapping test paths to list of outcomes
self.total_duration = None # float, assigned on demand
def SetupWorkingDirectory(self):
# This is called once per test suite object in a multi-process setting.
# Multi-process-unsafe work-directory setup can go here.
pass
def shell(self):
return "d8"