Create isolate from the platform kernel when running VM tests under dartk.

This is take 2 with appropriate status files updates or fixes to the
tests.

This reverts commit 4925ed38ac.

Change-Id: I133b9ae307f0feed1b72ec5a0131facdc51ad4e9
Reviewed-on: https://dart-review.googlesource.com/41600
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Siva Chandra
2018-02-20 22:08:25 +00:00
committed by commit-bot@chromium.org
parent 3caa0f9fee
commit 6214cedaf5
19 changed files with 136 additions and 120 deletions
-2
View File
@@ -1137,8 +1137,6 @@ executable("run_vm_tests") {
sources = [
"builtin_nolib.cc",
"dfe.cc",
"dfe.h",
"error_exit.cc",
"error_exit.h",
"run_vm_tests.cc",
-4
View File
@@ -28,10 +28,6 @@ extern const uint8_t kDartCoreIsolateSnapshotInstructions[];
// TODO(iposva, asiva): This is a placeholder for the real unittest framework.
namespace dart {
namespace bin {
DFE dfe;
}
// Defined in vm/os_thread_win.cc
extern bool private_flag_windows_run_tls_destructors;
+19 -9
View File
@@ -163,7 +163,7 @@ cc/Dart2JSCompileAll: SkipSlow # Timeout.
[ $compiler == dartk && $mode == debug && $runtime == vm ]
cc/InjectNativeFields1: Crash
cc/InjectNativeFields3: Crash
cc/PrintJSON: Crash
cc/Service_TokenStream: Crash
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
@@ -174,20 +174,18 @@ cc/StackTraceMallocHookLengthTest: Fail # Please triage.
[ $compiler == dartk && $mode == release && $runtime == vm ]
cc/InjectNativeFields1: Fail
cc/InjectNativeFields3: Fail
cc/Service_TokenStream: Fail
[ $compiler == dartk && $runtime == vm ]
cc/CanonicalizationInScriptSnapshots: Fail
cc/Class_ComputeEndTokenPos: Crash
cc/CorelibCompileAll: Crash
cc/CorelibCompilerStats: Crash
cc/DartAPI_CurrentStackTraceInfo: Fail
cc/DartAPI_ImplicitNativeFieldAccess: Crash
cc/DartAPI_InjectNativeFields1: Skip
cc/DartAPI_InjectNativeFields3: Crash
cc/DartAPI_InjectNativeFields4: Crash
cc/DartAPI_InjectNativeFieldsSuperClass: Crash
cc/DartAPI_InvokeNoSuchMethod: Fail
cc/DartAPI_Invoke_CrossLibrary: Crash
cc/DartAPI_IsolateSetCheckedMode: Skip # Checked mode is not relevant for dart 2?
cc/DartAPI_IsolateShutdownRunDartCode: Skip # Flaky
cc/DartAPI_LazyLoadDeoptimizes: Fail
cc/DartAPI_LoadLibrary: Crash
@@ -200,13 +198,11 @@ cc/DartAPI_LoadSource: Crash
cc/DartAPI_LoadSource_LateLoad: Crash
cc/DartAPI_LookupLibrary: Crash
cc/DartAPI_NativeFieldAccess: Fail
cc/DartAPI_NegativeNativeFieldInIsolateMessage: Crash
cc/DartAPI_ParsePatchLibrary: Crash
cc/DartAPI_PropagateError: Fail
cc/DartAPI_StackOverflowStackTraceInfoArrowFunction: Fail
cc/DartAPI_StackOverflowStackTraceInfoBraceFunction1: Fail
cc/DartAPI_StackOverflowStackTraceInfoBraceFunction2: Fail
cc/DartAPI_TestNativeFieldsAccess: Crash
cc/DebuggerAPI_BreakpointStubPatching: Fail
cc/DebuggerAPI_GetClosureInfo: Fail
cc/DebuggerAPI_InterruptIsolate: SkipSlow
@@ -217,6 +213,7 @@ cc/Debugger_PrintBreakpointsToJSONArray: Fail
cc/Debugger_Rewind_Optimized: SkipSlow
cc/Debugger_SetBreakpointInPartOfLibrary: Crash
cc/FunctionSourceFingerprint: Fail
cc/GenerateSource: Skip # Cannot generate source from a kernel binary.
cc/IsolateReload_DanglingGetter_Library: Fail
cc/IsolateReload_DanglingSetter_Class: Fail
cc/IsolateReload_DanglingSetter_Instance: Fail
@@ -274,7 +271,7 @@ cc/SourcePosition_WhileContinueBreak: Crash
cc/SourceReport_CallSites_PolymorphicCall: Fail
cc/SourceReport_CallSites_SimpleCall: Fail
cc/SourceReport_Coverage_AllFunctions: Fail
cc/SourceReport_Coverage_AllFunctions_ForceCompile: Fail
cc/SourceReport_Coverage_AllFunctions_ForceCompile: Crash
cc/SourceReport_Coverage_ForceCompile: Fail
cc/SourceReport_Coverage_NestedFunctions: Fail
cc/SourceReport_Coverage_NoCalls: Fail
@@ -351,6 +348,19 @@ cc/Service_Address: Fail
cc/Service_Code: Fail
[ $compiler == dartk && $strong ]
cc/DartAPI_ImportLibrary3: Fail # Issue 32190
cc/DartAPI_LazyLoadDeoptimizes: Crash # Issue 32190
cc/DartAPI_NativePortPostInteger: Crash # Issue 32190
cc/DartAPI_NativePortReceiveInteger: Timeout # Issue 32190
cc/DartAPI_NativePortReceiveNull: Timeout # Issue 32190
cc/DartAPI_NewNativePort: Crash # Issue 32190
cc/DartGeneratedArrayLiteralMessages: Crash # Issue 32190
cc/FullSnapshot1: Crash # Issue 32190
cc/IsolateReload_LibraryImportAdded: Crash # Issue 32190
cc/IsolateReload_LibraryImportRemoved: Fail # Issue 32190
cc/IsolateReload_LibraryLookup: Crash # Issue 32190
cc/Mixin_PrivateSuperResolutionCrossLibraryShouldFail: Fail # Issue 32190
cc/StackMapGC: Crash # Issue 32190
dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586
dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586
+1 -16
View File
@@ -16,13 +16,13 @@
#include "vm/compiler_stats.h"
#include "vm/dart_api_impl.h"
#include "vm/stack_frame.h"
#include "vm/unit_test.h"
using dart::bin::File;
namespace dart {
DECLARE_FLAG(bool, use_dart_frontend);
DECLARE_FLAG(bool, strong);
Benchmark* Benchmark::first_ = NULL;
Benchmark* Benchmark::tail_ = NULL;
@@ -92,19 +92,6 @@ void Benchmark::RunAll(const char* executable) {
}
}
Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data,
const uint8_t* snapshot_instructions) {
char* err = NULL;
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
isolate_ = Dart_CreateIsolate(NULL, NULL, snapshot_data,
snapshot_instructions, &api_flags, NULL, &err);
EXPECT(isolate_ != NULL);
free(err);
return isolate_;
}
//
// Measure compile of all functions in dart core lib classes.
//
@@ -522,13 +509,11 @@ BENCHMARK_SIZE(StandaloneSnapshotSize) {
"import 'dart:async';\n"
"import 'dart:core';\n"
"import 'dart:collection';\n"
"import 'dart:_internal';\n"
"import 'dart:convert';\n"
"import 'dart:math';\n"
"import 'dart:isolate';\n"
"import 'dart:mirrors';\n"
"import 'dart:typed_data';\n"
"import 'dart:_builtin';\n"
"import 'dart:io';\n"
"import 'dart:cli';\n"
"\n";
+7 -5
View File
@@ -13,6 +13,7 @@
#include "vm/isolate.h"
#include "vm/malloc_hooks.h"
#include "vm/object.h"
#include "vm/unit_test.h"
#include "vm/zone.h"
namespace dart {
@@ -85,9 +86,6 @@ class Benchmark {
int64_t score() const { return score_; }
Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); }
Dart_Isolate CreateIsolate(const uint8_t* snapshot_data,
const uint8_t* snapshot_instructions);
void Run() { (*run_)(this); }
void RunBenchmark();
@@ -95,6 +93,11 @@ class Benchmark {
static void SetExecutable(const char* arg) { executable_ = arg; }
static const char* Executable() { return executable_; }
void CreateIsolate() {
isolate_ = TestCase::CreateTestIsolate();
EXPECT(isolate_ != NULL);
}
private:
static Benchmark* first_;
static Benchmark* tail_;
@@ -113,8 +116,7 @@ class Benchmark {
class BenchmarkIsolateScope {
public:
explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) {
benchmark_->CreateIsolate(bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions);
benchmark->CreateIsolate();
Dart_EnterScope(); // Create a Dart API scope for unit benchmarks.
}
~BenchmarkIsolateScope() {
+2 -1
View File
@@ -5586,7 +5586,6 @@ class SeedVMIsolateVisitor : public ClassVisitor, public FunctionVisitor {
}
void Visit(const Script& script) {
objects_->Add(&Object::Handle(zone_, script_.tokens()));
kernel_program_info_ = script_.kernel_program_info();
if (!kernel_program_info_.IsNull()) {
objects_->Add(
@@ -5599,6 +5598,8 @@ class SeedVMIsolateVisitor : public ClassVisitor, public FunctionVisitor {
objects_->Add(
&Object::Handle(zone_, kernel_program_info_.metadata_mappings()));
objects_->Add(&Object::Handle(zone_, kernel_program_info_.constants()));
} else {
objects_->Add(&Object::Handle(zone_, script_.tokens()));
}
}
+8 -37
View File
@@ -3287,11 +3287,8 @@ VM_UNIT_TEST_CASE(DartAPI_Isolates) {
VM_UNIT_TEST_CASE(DartAPI_CurrentIsolateData) {
intptr_t mydata = 12345;
char* err;
Dart_Isolate isolate =
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL,
reinterpret_cast<void*>(mydata), &err);
TestCase::CreateTestIsolate(NULL, reinterpret_cast<void*>(mydata));
EXPECT(isolate != NULL);
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData()));
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateData(isolate)));
@@ -3338,13 +3335,12 @@ VM_UNIT_TEST_CASE(DartAPI_IsolateSetCheckedMode) {
api_flags.enable_error_on_bad_type = true;
api_flags.enable_error_on_bad_override = true;
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
char* err;
Dart_Isolate isolate = Dart_CreateIsolate(
NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
if (isolate == NULL) {
OS::Print("Creation of isolate failed '%s'\n", err);
OS::PrintErr("Creation of isolate failed '%s'\n", err);
free(err);
}
EXPECT(isolate != NULL);
@@ -5167,7 +5163,7 @@ TEST_CASE(DartAPI_InvokeClosure) {
" return f;\n"
" }\n"
" static Function method2(int i) {\n"
" n(int j) => true + i + fld4; \n"
" n(int j) { throw new Exception('I am an exception'); return 1; }\n"
" return n;\n"
" }\n"
" int fld1;\n"
@@ -5937,7 +5933,7 @@ TEST_CASE(DartAPI_LibraryGetClassNames) {
"class _B {}\n"
"abstract class _C {}\n"
"\n"
"_compare(String a, String b) => a.compareTo(b);\n"
"int _compare(dynamic a, dynamic b) => a.compareTo(b);\n"
"sort(list) => list.sort(_compare);\n";
Dart_Handle lib = TestCase::LoadTestLibrary("library_url", kLibraryChars);
@@ -5986,7 +5982,7 @@ TEST_CASE(DartAPI_GetFunctionNames) {
" var _D2;\n"
"}\n"
"\n"
"_compare(String a, String b) => a.compareTo(b);\n"
"int _compare(dynamic a, dynamic b) => a.compareTo(b);\n"
"sort(list) => list.sort(_compare);\n";
// Get the functions from a library.
@@ -7268,13 +7264,7 @@ void BusyLoop_start(uword unused) {
Dart_Handle lib;
{
MonitorLocker ml(sync);
char* error = NULL;
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
shared_isolate = Dart_CreateIsolate(
NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, &api_flags, NULL, &error);
TestCase::CreateTestIsolate();
EXPECT(shared_isolate != NULL);
Dart_EnterScope();
Dart_Handle url = NewString(TestCase::url());
@@ -7318,18 +7308,9 @@ VM_UNIT_TEST_CASE(DartAPI_IsolateShutdown) {
Isolate::SetShutdownCallback(IsolateShutdownTestCallback);
saved_callback_data = NULL;
void* my_data = reinterpret_cast<void*>(12345);
// Create an isolate.
char* err;
Dart_Isolate isolate = Dart_CreateIsolate(
NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, my_data, &err);
if (isolate == NULL) {
OS::Print("Creation of isolate failed '%s'\n", err);
free(err);
}
Dart_Isolate isolate = TestCase::CreateTestIsolate(NULL, my_data);
EXPECT(isolate != NULL);
// The shutdown callback has not been called.
@@ -7372,17 +7353,7 @@ VM_UNIT_TEST_CASE(DartAPI_IsolateShutdownRunDartCode) {
"}\n";
// Create an isolate.
char* err;
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
Dart_Isolate isolate = Dart_CreateIsolate(
NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
if (isolate == NULL) {
OS::Print("Creation of isolate failed '%s'\n", err);
free(err);
}
Dart_Isolate isolate = TestCase::CreateTestIsolate();
EXPECT(isolate != NULL);
Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback);
+4 -4
View File
@@ -30,7 +30,7 @@ TEST_CASE(GuardFieldSimpleTest) {
const char* script_chars =
"class A {\n"
" var f1 = 3.0;\n"
" var f2 = 3;\n"
" dynamic f2 = 3;\n"
" var f3 = new List(4);\n"
" foo() {\n"
" f1 = f1 + f1;\n"
@@ -80,7 +80,7 @@ TEST_CASE(GuardFieldFinalListTest) {
const char* script_chars =
"class A {\n"
" var f1 = 3.0;\n"
" var f2 = 3;\n"
" dynamic f2 = 3;\n"
" final f3 = new List(4);\n"
" foo() {\n"
" f1 = f1 + f1;\n"
@@ -132,7 +132,7 @@ TEST_CASE(GuardFieldFinalVariableLengthListTest) {
const char* script_chars =
"class A {\n"
" var f1 = 3.0;\n"
" var f2 = 3;\n"
" dynamic f2 = 3;\n"
" final f3 = new List();\n"
" foo() {\n"
" f1 = f1 + f1;\n"
@@ -185,7 +185,7 @@ TEST_CASE(GuardFieldConstructorTest) {
"import 'dart:typed_data';\n"
"class A {\n"
" var f1 = 3.0;\n"
" var f2 = 3;\n"
" dynamic f2 = 3;\n"
" final f3;\n"
" A(x) : f3 = x;\n"
" foo() {\n"
+1 -1
View File
@@ -867,7 +867,7 @@ TEST_CASE(IsolateReload_ComplexInheritanceChange) {
"class C extends B {\n"
" C(name) : super(name);\n"
"}\n"
"var list = [ new A('a'), new B('b'), new C('c') ];\n"
"var list = <dynamic>[ new A('a'), new B('b'), new C('c') ];\n"
"main() {\n"
" return (list.map((x) {\n"
" return '${x.name} is A(${x is A})/ B(${x is B})/ C(${x is C})';\n"
+1 -5
View File
@@ -14,12 +14,8 @@
namespace dart {
VM_UNIT_TEST_CASE(IsolateCurrent) {
char* error;
Dart_Isolate isolate = Dart_CreateIsolate(
NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, &error);
Dart_Isolate isolate = TestCase::CreateTestIsolate();
EXPECT_EQ(isolate, Dart_CurrentIsolate());
EXPECT_EQ(error, static_cast<char*>(NULL));
Dart_ShutdownIsolate();
EXPECT_EQ(reinterpret_cast<Dart_Isolate>(NULL), Dart_CurrentIsolate());
}
+2 -4
View File
@@ -16,8 +16,7 @@ namespace dart {
#ifndef PRODUCT
VM_UNIT_TEST_CASE(Metric_Simple) {
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
{
Metric metric;
@@ -45,8 +44,7 @@ class MyMetric : public Metric {
};
VM_UNIT_TEST_CASE(Metric_OnDemand) {
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
{
Thread* thread = Thread::Current();
StackZone zone(thread);
+3 -3
View File
@@ -655,7 +655,7 @@ TEST_CASE(Service_EmbedderRootHandler) {
"var x = 7;\n"
"main() {\n"
" x = x * x;\n"
" x = x / 13;\n"
" x = (x / 13).floor();\n"
"}";
Dart_RegisterRootServiceRequestCallback("alpha", alpha_callback, NULL);
@@ -692,7 +692,7 @@ TEST_CASE(Service_EmbedderIsolateHandler) {
"var x = 7;\n"
"main() {\n"
" x = x * x;\n"
" x = x / 13;\n"
" x = (x / 13).floor();\n"
"}";
Dart_RegisterIsolateServiceRequestCallback("alpha", alpha_callback, NULL);
@@ -742,7 +742,7 @@ TEST_CASE(Service_Profile) {
"var x = 7;\n"
"main() {\n"
" x = x * x;\n"
" x = x / 13;\n"
" x = (x / 13).floor();\n"
"}";
Isolate* isolate = thread->isolate();
+1
View File
@@ -1879,6 +1879,7 @@ static void CheckStringInvalid(Dart_Handle dart_string) {
VM_UNIT_TEST_CASE(DartGeneratedMessages) {
static const char* kCustomIsolateScriptCommonChars =
"final int kArrayLength = 10;\n"
"getSmi() {\n"
" return 42;\n"
"}\n"
+6 -2
View File
@@ -279,7 +279,9 @@ TEST_CASE(ValidateNoSuchMethodStackFrameIteration) {
" return 5;"
" }"
" static testMain() {"
" var obj = new StackFrame2Test();"
" /* Declare |obj| dynamic so that noSuchMethod can be"
" * called in strong mode. */"
" dynamic obj = new StackFrame2Test();"
" StackFrame.equals(5, obj.foo(101, 202));"
" }"
"}";
@@ -314,7 +316,9 @@ TEST_CASE(ValidateNoSuchMethodStackFrameIteration) {
" return 5;"
" }"
" static testMain() {"
" var obj = new StackFrame2Test();"
" /* Declare |obj| dynamic so that noSuchMethod can be"
" * called in strong mode. */"
" dynamic obj = new StackFrame2Test();"
" StackFrame.equals(5, obj.foo(101, 202));"
" }"
"}";
+4 -9
View File
@@ -15,9 +15,7 @@ namespace dart {
VM_UNIT_TEST_CASE(Mutex) {
// This unit test case needs a running isolate.
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
Mutex* mutex = new Mutex();
mutex->Lock();
EXPECT_EQ(false, mutex->TryLock());
@@ -36,8 +34,7 @@ VM_UNIT_TEST_CASE(Mutex) {
VM_UNIT_TEST_CASE(Monitor) {
// This unit test case needs a running isolate.
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
OSThread* thread = OSThread::Current();
// Thread interrupter interferes with this test, disable interrupts.
thread->DisableThreadInterrupts();
@@ -368,14 +365,12 @@ TEST_CASE(ThreadRegistry) {
char* orig_str = orig_zone->PrintToString("foo");
Dart_ExitIsolate();
// Create and enter a new isolate.
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
Zone* zone0 = Thread::Current()->zone();
EXPECT(zone0 != orig_zone);
Dart_ShutdownIsolate();
// Create and enter yet another isolate.
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
{
// Create a stack resource this time, and exercise it.
StackZone stack_zone(Thread::Current());
+51 -5
View File
@@ -27,13 +27,27 @@
using dart::bin::Builtin;
using dart::bin::DartUtils;
extern "C" {
extern const uint8_t kPlatformDill[];
extern const uint8_t kPlatformStrongDill[];
extern intptr_t kPlatformDillSize;
extern intptr_t kPlatformStrongDillSize;
}
namespace dart {
const uint8_t* platform_dill = kPlatformDill;
const uint8_t* platform_strong_dill = kPlatformStrongDill;
const intptr_t platform_dill_size = kPlatformDillSize;
const intptr_t platform_strong_dill_size = kPlatformStrongDillSize;
DEFINE_FLAG(bool,
use_dart_frontend,
false,
"Parse scripts with Dart-to-Kernel parser");
DECLARE_FLAG(bool, strong);
TestCaseBase* TestCaseBase::first_ = NULL;
TestCaseBase* TestCaseBase::tail_ = NULL;
@@ -67,21 +81,52 @@ void TestCaseBase::RunAll() {
}
}
Dart_Isolate TestCase::CreateIsolate(const uint8_t* buffer, const char* name) {
static void NoopRelease(uint8_t* data) {}
Dart_Isolate TestCase::CreateIsolate(const uint8_t* data_buffer,
intptr_t len,
const uint8_t* instr_buffer,
const char* name,
void* data) {
char* err;
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
Dart_Isolate isolate =
Dart_CreateIsolate(name, NULL, buffer, NULL, &api_flags, NULL, &err);
Dart_Isolate isolate = NULL;
if (len == 0) {
isolate = Dart_CreateIsolate(name, NULL, data_buffer, instr_buffer,
&api_flags, data, &err);
} else {
kernel::Program* program = reinterpret_cast<kernel::Program*>(
Dart_ReadKernelBinary(data_buffer, len, NoopRelease));
if (program != NULL) {
isolate = Dart_CreateIsolateFromKernel(name, NULL, program, &api_flags,
data, &err);
delete program;
}
}
if (isolate == NULL) {
OS::Print("Creation of isolate failed '%s'\n", err);
OS::PrintErr("Creation of isolate failed '%s'\n", err);
free(err);
}
EXPECT(isolate != NULL);
return isolate;
}
Dart_Isolate TestCase::CreateTestIsolate(const char* name, void* data) {
if (FLAG_use_dart_frontend) {
return CreateIsolate(
FLAG_strong ? platform_strong_dill : platform_dill,
FLAG_strong ? platform_strong_dill_size : platform_dill_size,
NULL, /* There is no instr buffer in case of dill buffers. */
name, data);
} else {
return CreateIsolate(bin::core_isolate_snapshot_data,
0 /* Snapshots have length encoded within them. */,
bin::core_isolate_snapshot_instructions, name, data);
}
}
static const char* kPackageScheme = "package:";
static bool IsPackageSchemeURL(const char* url_name) {
@@ -203,7 +248,8 @@ char* TestCase::CompileTestScriptWithDFE(const char* url,
bool incrementally) {
Zone* zone = Thread::Current()->zone();
Dart_KernelCompilationResult compilation_result = Dart_CompileSourcesToKernel(
url, NULL /* platform binary can be found at the default location */, 0,
url, FLAG_strong ? platform_strong_dill : platform_dill,
FLAG_strong ? platform_strong_dill_size : platform_dill_size,
sourcefiles_count, sourcefiles, incrementally);
if (compilation_result.status != Dart_KernelCompilationStatus_Ok) {
+18 -5
View File
@@ -270,6 +270,11 @@ extern const uint8_t* core_isolate_snapshot_data;
extern const uint8_t* core_isolate_snapshot_instructions;
} // namespace bin
extern const uint8_t* platform_dill;
extern const uint8_t* platform_strong_dill;
extern const intptr_t platform_dill_size;
extern const intptr_t platform_strong_dill_size;
class TestCaseBase {
public:
explicit TestCaseBase(const char* name);
@@ -334,11 +339,10 @@ class TestCase : TestCaseBase {
static const char* url();
static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer,
const char* name = NULL) {
return CreateIsolate(buffer, name);
}
static Dart_Isolate CreateTestIsolate(const char* name = NULL) {
return CreateIsolate(bin::core_isolate_snapshot_data, name);
return CreateIsolate(buffer, 0, NULL, name);
}
static Dart_Isolate CreateTestIsolate(const char* name = NULL,
void* data = NULL);
static Dart_Handle library_handler(Dart_LibraryTag tag,
Dart_Handle library,
Dart_Handle url);
@@ -363,7 +367,16 @@ class TestCase : TestCaseBase {
static const char* GetTestLib(const char* url);
private:
static Dart_Isolate CreateIsolate(const uint8_t* buffer, const char* name);
// |data_buffer| can either be snapshot data, or kernel binary data.
// If |data_buffer| is snapshot data, then |len| should be zero as snapshot
// size is encoded within them. If |len| is non-zero, then |data_buffer|
// will be treated as a kernel binary (but CreateIsolate will not
// take ownership of the buffer) and |instr_buffer| will be ignored.
static Dart_Isolate CreateIsolate(const uint8_t* data_buffer,
intptr_t len,
const uint8_t* instr_buffer,
const char* name,
void* data = NULL);
RunEntry* const run_;
};
+4 -8
View File
@@ -14,8 +14,7 @@ VM_UNIT_TEST_CASE(AllocateZone) {
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
{
@@ -75,8 +74,7 @@ VM_UNIT_TEST_CASE(AllocGeneric_Success) {
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
{
@@ -98,8 +96,7 @@ VM_UNIT_TEST_CASE(AllocGeneric_Overflow) {
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
{
@@ -116,8 +113,7 @@ VM_UNIT_TEST_CASE(ZoneAllocated) {
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
static int marker;
+4
View File
@@ -494,6 +494,10 @@ class VMTestSuite extends TestSuite {
args.insert(0, '--dfe=$buildDir/gen/kernel-service.dart.snapshot');
}
if (configuration.isStrong) {
args.add('--strong');
}
args.add(testName);
var command = Command.process(