diff --git a/runtime/bin/directory_test.cc b/runtime/bin/directory_test.cc index da4a08437e8..de9970e498c 100644 --- a/runtime/bin/directory_test.cc +++ b/runtime/bin/directory_test.cc @@ -11,7 +11,7 @@ namespace dart { -UNIT_TEST_CASE(DirectoryCurrentNoScope) { +VM_UNIT_TEST_CASE(DirectoryCurrentNoScope) { char* current_dir = dart::bin::Directory::CurrentNoScope(); EXPECT_NOTNULL(current_dir); free(current_dir); diff --git a/runtime/bin/eventhandler_test.cc b/runtime/bin/eventhandler_test.cc index 098113d1ca8..cef2b94b9fa 100644 --- a/runtime/bin/eventhandler_test.cc +++ b/runtime/bin/eventhandler_test.cc @@ -9,7 +9,7 @@ namespace dart { namespace bin { -UNIT_TEST_CASE(CircularLinkedList) { +VM_UNIT_TEST_CASE(CircularLinkedList) { CircularLinkedList list; EXPECT(!list.HasHead()); diff --git a/runtime/bin/hashmap_test.cc b/runtime/bin/hashmap_test.cc index bad384b79a3..a0ca5b95751 100644 --- a/runtime/bin/hashmap_test.cc +++ b/runtime/bin/hashmap_test.cc @@ -171,7 +171,7 @@ void TestSet(IntKeyHash hash, int size) { } -UNIT_TEST_CASE(HashMap_Basic) { +VM_UNIT_TEST_CASE(HashMap_Basic) { TestSet(WordHash, 100); TestSet(Hash, 100); TestSet(CollisionHash1, 50); diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc index c6e11b40d35..8d49fe077ba 100644 --- a/runtime/bin/run_vm_tests.cc +++ b/runtime/bin/run_vm_tests.cc @@ -41,6 +41,13 @@ void TestCase::Run() { } +void RawTestCase::Run() { + fprintf(stdout, "Running test: %s\n", name()); + (*run_)(); + fprintf(stdout, "Done: %s\n", name()); +} + + void TestCaseBase::RunTest() { if (strcmp(run_filter, this->name()) == 0) { this->Run(); @@ -90,6 +97,7 @@ static int Main(int argc, const char** argv) { // List all tests and benchmarks and exit without initializing the VM. TestCaseBase::RunAll(); Benchmark::RunAll(argv[0]); + TestCaseBase::RunAllRaw(); fflush(stdout); return 0; } else if (strcmp(argv[1], "--benchmarks") == 0) { @@ -122,6 +130,7 @@ static int Main(int argc, const char** argv) { err_msg = Dart::Cleanup(); ASSERT(err_msg == NULL); + TestCaseBase::RunAllRaw(); // Print a warning message if no tests or benchmarks were matched. if (run_matches == 0) { fprintf(stderr, "No tests matched: %s\n", run_filter); diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status index 1c7d40c724e..3ef43bed19e 100644 --- a/runtime/tests/vm/vm.status +++ b/runtime/tests/vm/vm.status @@ -296,10 +296,6 @@ cc/UseDartApi: Pass,Crash # Issue 28499 dart/spawn_shutdown_test: Skip # We can shutdown an isolate before it reloads. dart/spawn_infinite_loop_test: Skip # We can shutdown an isolate before it reloads. -[ $system == linux ] # Tests are currently flaky and are being rewritten. -cc/BasicMallocHookTest: Pass,Fail -cc/FreeUnseenMemoryMallocHookTest: Pass,Fail - [ $arch == simdbc || $arch == simdbc64 ] cc/Debugger_RewindOneFrame_Unoptimized: Skip # Issue 27878 cc/Debugger_RewindTwoFrames_Unoptimized: Skip # Issue 27878 diff --git a/runtime/vm/allocation_test.cc b/runtime/vm/allocation_test.cc index 146f7f6a8e5..18c37a3b294 100644 --- a/runtime/vm/allocation_test.cc +++ b/runtime/vm/allocation_test.cc @@ -77,7 +77,7 @@ static void StackAllocatedDestructionHelper(int* ptr) { } -UNIT_TEST_CASE(StackAllocatedDestruction) { +VM_UNIT_TEST_CASE(StackAllocatedDestruction) { int data = 1; StackAllocatedDestructionHelper(&data); EXPECT_EQ(4, data); diff --git a/runtime/vm/assert_test.cc b/runtime/vm/assert_test.cc index dc935f1c099..d74b940edb2 100644 --- a/runtime/vm/assert_test.cc +++ b/runtime/vm/assert_test.cc @@ -6,14 +6,14 @@ #include "vm/unit_test.h" -UNIT_TEST_CASE(Assert) { +VM_UNIT_TEST_CASE(Assert) { ASSERT(true); ASSERT(87 == 87); ASSERT(42 != 87); } -UNIT_TEST_CASE(Expect) { +VM_UNIT_TEST_CASE(Expect) { EXPECT(true); EXPECT(87 == 87); EXPECT(42 != 87); @@ -48,16 +48,16 @@ UNIT_TEST_CASE(Expect) { } -UNIT_TEST_CASE(Fail0) { +VM_UNIT_TEST_CASE(Fail0) { FAIL("This test fails"); } -UNIT_TEST_CASE(Fail1) { +VM_UNIT_TEST_CASE(Fail1) { FAIL1("This test fails with one argument: %d", 4); } -UNIT_TEST_CASE(Fail2) { +VM_UNIT_TEST_CASE(Fail2) { FAIL2("This test fails with two arguments: %d, %d", -100, 42); } diff --git a/runtime/vm/atomic_test.cc b/runtime/vm/atomic_test.cc index 3a95a64f60d..922429941f1 100644 --- a/runtime/vm/atomic_test.cc +++ b/runtime/vm/atomic_test.cc @@ -10,7 +10,7 @@ namespace dart { -UNIT_TEST_CASE(FetchAndIncrement) { +VM_UNIT_TEST_CASE(FetchAndIncrement) { uintptr_t v = 42; EXPECT_EQ(static_cast(42), AtomicOperations::FetchAndIncrement(&v)); @@ -18,7 +18,7 @@ UNIT_TEST_CASE(FetchAndIncrement) { } -UNIT_TEST_CASE(FetchAndDecrement) { +VM_UNIT_TEST_CASE(FetchAndDecrement) { uintptr_t v = 42; EXPECT_EQ(static_cast(42), AtomicOperations::FetchAndDecrement(&v)); @@ -26,7 +26,7 @@ UNIT_TEST_CASE(FetchAndDecrement) { } -UNIT_TEST_CASE(FetchAndIncrementSigned) { +VM_UNIT_TEST_CASE(FetchAndIncrementSigned) { intptr_t v = -42; EXPECT_EQ(static_cast(-42), AtomicOperations::FetchAndIncrement(&v)); @@ -34,7 +34,7 @@ UNIT_TEST_CASE(FetchAndIncrementSigned) { } -UNIT_TEST_CASE(FetchAndDecrementSigned) { +VM_UNIT_TEST_CASE(FetchAndDecrementSigned) { intptr_t v = -42; EXPECT_EQ(static_cast(-42), AtomicOperations::FetchAndDecrement(&v)); @@ -42,21 +42,21 @@ UNIT_TEST_CASE(FetchAndDecrementSigned) { } -UNIT_TEST_CASE(IncrementBy) { +VM_UNIT_TEST_CASE(IncrementBy) { intptr_t v = 42; AtomicOperations::IncrementBy(&v, 100); EXPECT_EQ(static_cast(142), v); } -UNIT_TEST_CASE(DecrementBy) { +VM_UNIT_TEST_CASE(DecrementBy) { intptr_t v = 42; AtomicOperations::DecrementBy(&v, 41); EXPECT_EQ(static_cast(1), v); } -UNIT_TEST_CASE(LoadRelaxed) { +VM_UNIT_TEST_CASE(LoadRelaxed) { uword v = 42; EXPECT_EQ(static_cast(42), AtomicOperations::LoadRelaxed(&v)); } diff --git a/runtime/vm/bitfield_test.cc b/runtime/vm/bitfield_test.cc index a9d41c9657a..8404ec9a347 100644 --- a/runtime/vm/bitfield_test.cc +++ b/runtime/vm/bitfield_test.cc @@ -9,7 +9,7 @@ namespace dart { -UNIT_TEST_CASE(BitFields) { +VM_UNIT_TEST_CASE(BitFields) { class TestBitFields : public BitField {}; EXPECT(TestBitFields::is_valid(16)); EXPECT(!TestBitFields::is_valid(256)); diff --git a/runtime/vm/boolfield_test.cc b/runtime/vm/boolfield_test.cc index 1e21b1b30ca..b13001b847b 100644 --- a/runtime/vm/boolfield_test.cc +++ b/runtime/vm/boolfield_test.cc @@ -8,7 +8,7 @@ namespace dart { -UNIT_TEST_CASE(BoolField) { +VM_UNIT_TEST_CASE(BoolField) { class TestBoolField : public BoolField<1> {}; EXPECT(TestBoolField::decode(2)); EXPECT(!TestBoolField::decode(1)); diff --git a/runtime/vm/compiler_test.cc b/runtime/vm/compiler_test.cc index 6e44b6c4a2c..8f3c1119291 100644 --- a/runtime/vm/compiler_test.cc +++ b/runtime/vm/compiler_test.cc @@ -15,7 +15,7 @@ namespace dart { -VM_TEST_CASE(CompileScript) { +ISOLATE_UNIT_TEST_CASE(CompileScript) { const char* kScriptChars = "class A {\n" " static foo() { return 42; }\n" @@ -29,7 +29,7 @@ VM_TEST_CASE(CompileScript) { } -VM_TEST_CASE(CompileFunction) { +ISOLATE_UNIT_TEST_CASE(CompileFunction) { const char* kScriptChars = "class A {\n" " static foo() { return 42; }\n" @@ -69,7 +69,7 @@ VM_TEST_CASE(CompileFunction) { } -VM_TEST_CASE(CompileFunctionOnHelperThread) { +ISOLATE_UNIT_TEST_CASE(CompileFunctionOnHelperThread) { // Create a simple function and compile it without optimization. const char* kScriptChars = "class A {\n" @@ -184,7 +184,7 @@ TEST_CASE(EvalExpression) { } -VM_TEST_CASE(EvalExpressionWithLazyCompile) { +ISOLATE_UNIT_TEST_CASE(EvalExpressionWithLazyCompile) { Library& lib = Library::Handle(Library::CoreLibrary()); const String& expression = String::Handle( @@ -199,7 +199,7 @@ VM_TEST_CASE(EvalExpressionWithLazyCompile) { } -VM_TEST_CASE(EvalExpressionExhaustCIDs) { +ISOLATE_UNIT_TEST_CASE(EvalExpressionExhaustCIDs) { Library& lib = Library::Handle(Library::CoreLibrary()); const String& expression = String::Handle(String::New("3 + 4")); diff --git a/runtime/vm/cpu_test.cc b/runtime/vm/cpu_test.cc index 3b13c0fd981..1adb7483b9c 100644 --- a/runtime/vm/cpu_test.cc +++ b/runtime/vm/cpu_test.cc @@ -9,7 +9,7 @@ namespace dart { -UNIT_TEST_CASE(Id) { +VM_UNIT_TEST_CASE(Id) { #if defined(TARGET_ARCH_IA32) EXPECT_STREQ("ia32", CPU::Id()); #elif defined(TARGET_ARCH_X64) diff --git a/runtime/vm/cpuinfo_test.cc b/runtime/vm/cpuinfo_test.cc index 0b6113b75b9..2d8434e1e47 100644 --- a/runtime/vm/cpuinfo_test.cc +++ b/runtime/vm/cpuinfo_test.cc @@ -9,7 +9,7 @@ namespace dart { -UNIT_TEST_CASE(GetCpuModelTest) { +VM_UNIT_TEST_CASE(GetCpuModelTest) { const char* cpumodel = CpuInfo::GetCpuModel(); EXPECT_NE(strlen(cpumodel), 0UL); // caller is responsible for deleting the returned cpumodel string. diff --git a/runtime/vm/custom_isolate_test.cc b/runtime/vm/custom_isolate_test.cc index cf4c8fafc7b..188e6b8b48b 100644 --- a/runtime/vm/custom_isolate_test.cc +++ b/runtime/vm/custom_isolate_test.cc @@ -315,7 +315,7 @@ static void CustomIsolateImpl_start(Dart_NativeArguments args) { } -UNIT_TEST_CASE(CustomIsolates) { +VM_UNIT_TEST_CASE(CustomIsolates) { bool saved_flag = FLAG_trace_shutdown; FLAG_trace_shutdown = true; FLAG_verify_handles = true; diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc index eb8464594dc..c17c4d2c935 100644 --- a/runtime/vm/dart_api_impl_test.cc +++ b/runtime/vm/dart_api_impl_test.cc @@ -2486,7 +2486,7 @@ TEST_CASE(Float32x4List) { // Unit test for entering a scope, creating a local handle and exiting // the scope. -UNIT_TEST_CASE(EnterExitScope) { +VM_UNIT_TEST_CASE(EnterExitScope) { TestIsolateScope __test_isolate__; Thread* thread = Thread::Current(); @@ -2508,7 +2508,7 @@ UNIT_TEST_CASE(EnterExitScope) { // Unit test for creating and deleting persistent handles. -UNIT_TEST_CASE(PersistentHandles) { +VM_UNIT_TEST_CASE(PersistentHandles) { const char* kTestString1 = "Test String1"; const char* kTestString2 = "Test String2"; TestCase::CreateTestIsolate(); @@ -2577,7 +2577,7 @@ UNIT_TEST_CASE(PersistentHandles) { // Test that we are able to create a persistent handle from a // persistent handle. -UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { +VM_UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { TestIsolateScope __test_isolate__; Isolate* isolate = Isolate::Current(); @@ -2608,7 +2608,7 @@ UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { // Test that we can assign to a persistent handle. -UNIT_TEST_CASE(AssignToPersistentHandle) { +VM_UNIT_TEST_CASE(AssignToPersistentHandle) { const char* kTestString1 = "Test String1"; const char* kTestString2 = "Test String2"; TestIsolateScope __test_isolate__; @@ -2866,7 +2866,7 @@ TEST_CASE(WeakPersistentHandleNoCallback) { } -UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { +VM_UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { TestCase::CreateTestIsolate(); Dart_EnterScope(); Dart_Handle ref = Dart_True(); @@ -3363,7 +3363,7 @@ TEST_CASE(SingleGarbageCollectionCallback) { // Unit test for creating multiple scopes and local handles within them. // Ensure that the local handles get all cleaned out when exiting the // scope. -UNIT_TEST_CASE(LocalHandles) { +VM_UNIT_TEST_CASE(LocalHandles) { TestCase::CreateTestIsolate(); Thread* thread = Thread::Current(); Isolate* isolate = thread->isolate(); @@ -3427,7 +3427,7 @@ UNIT_TEST_CASE(LocalHandles) { // Unit test for creating multiple scopes and allocating objects in the // zone for the scope. Ensure that the memory is freed when the scope // exits. -UNIT_TEST_CASE(LocalZoneMemory) { +VM_UNIT_TEST_CASE(LocalZoneMemory) { TestCase::CreateTestIsolate(); Thread* thread = Thread::Current(); EXPECT(thread != NULL); @@ -3469,7 +3469,7 @@ UNIT_TEST_CASE(LocalZoneMemory) { } -UNIT_TEST_CASE(Isolates) { +VM_UNIT_TEST_CASE(Isolates) { // This test currently assumes that the Dart_Isolate type is an opaque // representation of Isolate*. Dart_Isolate iso_1 = TestCase::CreateTestIsolate(); @@ -3493,7 +3493,7 @@ UNIT_TEST_CASE(Isolates) { } -UNIT_TEST_CASE(CurrentIsolateData) { +VM_UNIT_TEST_CASE(CurrentIsolateData) { intptr_t mydata = 12345; char* err; Dart_Isolate isolate = @@ -3507,7 +3507,7 @@ UNIT_TEST_CASE(CurrentIsolateData) { } -UNIT_TEST_CASE(IsolateSetCheckedMode) { +VM_UNIT_TEST_CASE(IsolateSetCheckedMode) { const char* kScriptChars = "int bad1() {\n" " int foo = 'string';\n" @@ -3574,7 +3574,7 @@ TEST_CASE(DebugName) { static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) {} -UNIT_TEST_CASE(SetMessageCallbacks) { +VM_UNIT_TEST_CASE(SetMessageCallbacks) { Dart_Isolate dart_isolate = TestCase::CreateTestIsolate(); Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback); Isolate* isolate = reinterpret_cast(dart_isolate); @@ -7196,7 +7196,7 @@ TEST_CASE(IllegalPost) { } -UNIT_TEST_CASE(NewNativePort) { +VM_UNIT_TEST_CASE(NewNativePort) { // Create a port with a bogus handler. Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true); EXPECT_EQ(ILLEGAL_PORT, error_port); @@ -7518,12 +7518,12 @@ static void RunLoopTest(bool throw_exception) { } -UNIT_TEST_CASE(RunLoop_Success) { +VM_UNIT_TEST_CASE(RunLoop_Success) { RunLoopTest(false); } -UNIT_TEST_CASE(RunLoop_Exception) { +VM_UNIT_TEST_CASE(RunLoop_Exception) { RunLoopTest(true); } @@ -7616,7 +7616,7 @@ static void IsolateShutdownTestCallback(void* callback_data) { saved_callback_data = callback_data; } -UNIT_TEST_CASE(IsolateShutdown) { +VM_UNIT_TEST_CASE(IsolateShutdown) { Dart_IsolateShutdownCallback saved = Isolate::ShutdownCallback(); Isolate::SetShutdownCallback(IsolateShutdownTestCallback); @@ -7664,7 +7664,7 @@ static void IsolateShutdownRunDartCodeTestCallback(void* callback_data) { Dart_ExitScope(); } -UNIT_TEST_CASE(IsolateShutdownRunDartCode) { +VM_UNIT_TEST_CASE(IsolateShutdownRunDartCode) { const char* kScriptChars = "int add(int a, int b) {\n" " return a + b;\n" diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc index e48ab549a0c..beb26e467b2 100644 --- a/runtime/vm/debugger_api_impl_test.cc +++ b/runtime/vm/debugger_api_impl_test.cc @@ -1414,7 +1414,7 @@ static void TestIsolateID(Dart_IsolateId isolate_id, Dart_IsolateEvent kind) { } -UNIT_TEST_CASE(Debug_IsolateID) { +VM_UNIT_TEST_CASE(Debug_IsolateID) { const char* kScriptChars = "void moo(s) { } \n" "class A { \n" diff --git a/runtime/vm/find_code_object_test.cc b/runtime/vm/find_code_object_test.cc index a47129e8a05..f51cae5074a 100644 --- a/runtime/vm/find_code_object_test.cc +++ b/runtime/vm/find_code_object_test.cc @@ -25,7 +25,7 @@ static const int kLoopCount = 25000; #endif static char scriptChars[kScriptSize]; -VM_TEST_CASE(FindCodeObject) { +ISOLATE_UNIT_TEST_CASE(FindCodeObject) { const int kNumFunctions = 1024; // Get access to the code index table. diff --git a/runtime/vm/flags_test.cc b/runtime/vm/flags_test.cc index d7f95c4e279..5bef9b0be98 100644 --- a/runtime/vm/flags_test.cc +++ b/runtime/vm/flags_test.cc @@ -13,7 +13,7 @@ DEFINE_FLAG(bool, basic_flag, true, "Testing of a basic boolean flag."); DECLARE_FLAG(bool, print_flags); -UNIT_TEST_CASE(BasicFlags) { +VM_UNIT_TEST_CASE(BasicFlags) { EXPECT_EQ(true, FLAG_basic_flag); EXPECT_EQ(false, FLAG_verbose_gc); EXPECT_EQ(false, FLAG_print_flags); @@ -25,7 +25,7 @@ DEFINE_FLAG(charp, string_opt_test, NULL, "Testing: string option."); DEFINE_FLAG(charp, entrypoint_test, "main", "Testing: entrypoint"); DEFINE_FLAG(int, counter, 100, "Testing: int flag"); -UNIT_TEST_CASE(ParseFlags) { +VM_UNIT_TEST_CASE(ParseFlags) { EXPECT_EQ(true, FLAG_parse_flag_bool_test); Flags::Parse("no_parse_flag_bool_test"); EXPECT_EQ(false, FLAG_parse_flag_bool_test); diff --git a/runtime/vm/flow_graph_builder_test.cc b/runtime/vm/flow_graph_builder_test.cc index 9de7a0cb620..122e6d4a834 100644 --- a/runtime/vm/flow_graph_builder_test.cc +++ b/runtime/vm/flow_graph_builder_test.cc @@ -772,7 +772,7 @@ static bool SyntheticRoundTripTest(TokenPosition token_pos) { } -UNIT_TEST_CASE(SourcePosition_SyntheticTokens) { +VM_UNIT_TEST_CASE(SourcePosition_SyntheticTokens) { EXPECT(TokenPosition::kNoSourcePos == -1); EXPECT(TokenPosition::kMinSourcePos == 0); EXPECT(TokenPosition::kMaxSourcePos > 0); diff --git a/runtime/vm/heap_test.cc b/runtime/vm/heap_test.cc index 939225fbb42..b594807cf85 100644 --- a/runtime/vm/heap_test.cc +++ b/runtime/vm/heap_test.cc @@ -313,27 +313,27 @@ void TestBecomeForward(Heap::Space before_space, Heap::Space after_space) { } -VM_TEST_CASE(BecomeFowardOldToOld) { +ISOLATE_UNIT_TEST_CASE(BecomeFowardOldToOld) { TestBecomeForward(Heap::kOld, Heap::kOld); } -VM_TEST_CASE(BecomeFowardNewToNew) { +ISOLATE_UNIT_TEST_CASE(BecomeFowardNewToNew) { TestBecomeForward(Heap::kNew, Heap::kNew); } -VM_TEST_CASE(BecomeFowardOldToNew) { +ISOLATE_UNIT_TEST_CASE(BecomeFowardOldToNew) { TestBecomeForward(Heap::kOld, Heap::kNew); } -VM_TEST_CASE(BecomeFowardNewToOld) { +ISOLATE_UNIT_TEST_CASE(BecomeFowardNewToOld) { TestBecomeForward(Heap::kNew, Heap::kOld); } -VM_TEST_CASE(BecomeForwardRememberedObject) { +ISOLATE_UNIT_TEST_CASE(BecomeForwardRememberedObject) { Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); diff --git a/runtime/vm/isolate_test.cc b/runtime/vm/isolate_test.cc index 43bbd09fc4b..53b63e6ec80 100644 --- a/runtime/vm/isolate_test.cc +++ b/runtime/vm/isolate_test.cc @@ -13,7 +13,7 @@ namespace dart { -UNIT_TEST_CASE(IsolateCurrent) { +VM_UNIT_TEST_CASE(IsolateCurrent) { Dart_Isolate isolate = Dart_CreateIsolate( NULL, NULL, bin::core_isolate_snapshot_data, bin::core_isolate_snapshot_instructions, NULL, NULL, NULL); diff --git a/runtime/vm/malloc_hooks_test.cc b/runtime/vm/malloc_hooks_test.cc index b0c5d361228..5054a5047dd 100644 --- a/runtime/vm/malloc_hooks_test.cc +++ b/runtime/vm/malloc_hooks_test.cc @@ -15,9 +15,6 @@ namespace dart { -// Note: for these tests, there is no need to call MallocHooks::Init() or -// MallocHooks::TearDown() as this is all done by the VM test framework. - static void MallocHookTestBufferInitializer(volatile char* buffer, uintptr_t size) { // Run through the buffer and do something. If we don't do this and the memory @@ -29,10 +26,10 @@ static void MallocHookTestBufferInitializer(volatile char* buffer, UNIT_TEST_CASE(BasicMallocHookTest) { + MallocHooks::InitOnce(); MallocHooks::ResetStats(); EXPECT_EQ(0L, MallocHooks::allocation_count()); EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes()); - const intptr_t buffer_size = 10; char* buffer = new char[buffer_size]; MallocHookTestBufferInitializer(buffer, buffer_size); @@ -44,10 +41,12 @@ UNIT_TEST_CASE(BasicMallocHookTest) { delete[] buffer; EXPECT_EQ(0L, MallocHooks::allocation_count()); EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes()); + MallocHooks::TearDown(); } UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { + MallocHooks::InitOnce(); const intptr_t pre_hook_buffer_size = 3; char* pre_hook_buffer = new char[pre_hook_buffer_size]; MallocHookTestBufferInitializer(pre_hook_buffer, pre_hook_buffer_size); @@ -73,6 +72,7 @@ UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) { delete[] buffer; EXPECT_EQ(0L, MallocHooks::allocation_count()); EXPECT_EQ(0L, MallocHooks::heap_allocated_memory_in_bytes()); + MallocHooks::TearDown(); } }; // namespace dart diff --git a/runtime/vm/memory_region_test.cc b/runtime/vm/memory_region_test.cc index 1f46b18725d..b0134a2cfc6 100644 --- a/runtime/vm/memory_region_test.cc +++ b/runtime/vm/memory_region_test.cc @@ -19,7 +19,7 @@ static void DeleteRegion(const MemoryRegion& region) { } -UNIT_TEST_CASE(NullRegion) { +VM_UNIT_TEST_CASE(NullRegion) { static const uword kSize = 512; MemoryRegion region(NULL, kSize); EXPECT(region.pointer() == NULL); @@ -27,7 +27,7 @@ UNIT_TEST_CASE(NullRegion) { } -UNIT_TEST_CASE(NewRegion) { +VM_UNIT_TEST_CASE(NewRegion) { static const uword kSize = 1024; MemoryRegion region(NewRegion(kSize), kSize); EXPECT_EQ(kSize, region.size()); @@ -40,7 +40,7 @@ UNIT_TEST_CASE(NewRegion) { } -UNIT_TEST_CASE(Subregion) { +VM_UNIT_TEST_CASE(Subregion) { static const uword kSize = 1024; static const uword kSubOffset = 128; static const uword kSubSize = 512; @@ -60,7 +60,7 @@ UNIT_TEST_CASE(Subregion) { } -UNIT_TEST_CASE(ExtendedRegion) { +VM_UNIT_TEST_CASE(ExtendedRegion) { static const uword kSize = 1024; static const uword kSubSize = 512; static const uword kExtendSize = 512; diff --git a/runtime/vm/message_handler_test.cc b/runtime/vm/message_handler_test.cc index 0e636d76c21..926344bfb01 100644 --- a/runtime/vm/message_handler_test.cc +++ b/runtime/vm/message_handler_test.cc @@ -117,7 +117,7 @@ void TestEndFunction(uword data) { } -UNIT_TEST_CASE(MessageHandler_PostMessage) { +VM_UNIT_TEST_CASE(MessageHandler_PostMessage) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); EXPECT_EQ(0, handler.notify_count()); @@ -148,7 +148,7 @@ UNIT_TEST_CASE(MessageHandler_PostMessage) { } -UNIT_TEST_CASE(MessageHandler_HasOOBMessages) { +VM_UNIT_TEST_CASE(MessageHandler_HasOOBMessages) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); @@ -181,7 +181,7 @@ UNIT_TEST_CASE(MessageHandler_HasOOBMessages) { } -UNIT_TEST_CASE(MessageHandler_ClosePort) { +VM_UNIT_TEST_CASE(MessageHandler_ClosePort) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); Message* message1 = new Message(1, NULL, 0, Message::kNormalPriority); @@ -199,7 +199,7 @@ UNIT_TEST_CASE(MessageHandler_ClosePort) { } -UNIT_TEST_CASE(MessageHandler_CloseAllPorts) { +VM_UNIT_TEST_CASE(MessageHandler_CloseAllPorts) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); Message* message1 = new Message(1, NULL, 0, Message::kNormalPriority); @@ -214,7 +214,7 @@ UNIT_TEST_CASE(MessageHandler_CloseAllPorts) { } -UNIT_TEST_CASE(MessageHandler_HandleNextMessage) { +VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); Dart_Port port1 = PortMap::CreatePort(&handler); @@ -240,7 +240,7 @@ UNIT_TEST_CASE(MessageHandler_HandleNextMessage) { } -UNIT_TEST_CASE(MessageHandler_HandleNextMessage_ProcessOOBAfterError) { +VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage_ProcessOOBAfterError) { TestMessageHandler handler; MessageHandler::MessageStatus results[] = { MessageHandler::kError, // oob_message1 @@ -270,7 +270,7 @@ UNIT_TEST_CASE(MessageHandler_HandleNextMessage_ProcessOOBAfterError) { } -UNIT_TEST_CASE(MessageHandler_HandleNextMessage_Shutdown) { +VM_UNIT_TEST_CASE(MessageHandler_HandleNextMessage_Shutdown) { TestMessageHandler handler; MessageHandler::MessageStatus results[] = { MessageHandler::kOK, // oob_message1 @@ -308,7 +308,7 @@ UNIT_TEST_CASE(MessageHandler_HandleNextMessage_Shutdown) { } -UNIT_TEST_CASE(MessageHandler_HandleOOBMessages) { +VM_UNIT_TEST_CASE(MessageHandler_HandleOOBMessages) { TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); Dart_Port port1 = PortMap::CreatePort(&handler); @@ -353,7 +353,7 @@ static void SendMessages(uword param) { } -UNIT_TEST_CASE(MessageHandler_Run) { +VM_UNIT_TEST_CASE(MessageHandler_Run) { ThreadPool pool; TestMessageHandler handler; MessageHandlerTestPeer handler_peer(&handler); diff --git a/runtime/vm/metrics_test.cc b/runtime/vm/metrics_test.cc index 389237218dc..6d2e69c48df 100644 --- a/runtime/vm/metrics_test.cc +++ b/runtime/vm/metrics_test.cc @@ -15,7 +15,7 @@ namespace dart { #ifndef PRODUCT -UNIT_TEST_CASE(Metric_Simple) { +VM_UNIT_TEST_CASE(Metric_Simple) { Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data, bin::core_isolate_snapshot_instructions, NULL, NULL, NULL); { @@ -44,7 +44,7 @@ class MyMetric : public Metric { int64_t LeakyValue() const { return Value(); } }; -UNIT_TEST_CASE(Metric_OnDemand) { +VM_UNIT_TEST_CASE(Metric_OnDemand) { Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data, bin::core_isolate_snapshot_instructions, NULL, NULL, NULL); { diff --git a/runtime/vm/object_graph_test.cc b/runtime/vm/object_graph_test.cc index f840284fde0..0056bee1d41 100644 --- a/runtime/vm/object_graph_test.cc +++ b/runtime/vm/object_graph_test.cc @@ -38,7 +38,7 @@ class CounterVisitor : public ObjectGraph::Visitor { }; -VM_TEST_CASE(ObjectGraph) { +ISOLATE_UNIT_TEST_CASE(ObjectGraph) { Isolate* isolate = thread->isolate(); // Create a simple object graph with objects a, b, c, d: // a+->b+->c diff --git a/runtime/vm/object_id_ring_test.cc b/runtime/vm/object_id_ring_test.cc index cbd34075973..f3081b4ba6a 100644 --- a/runtime/vm/object_id_ring_test.cc +++ b/runtime/vm/object_id_ring_test.cc @@ -50,7 +50,7 @@ class ObjectIdRingTestHelper { // Test that serial number wrapping works. -VM_TEST_CASE(ObjectIdRingSerialWrapTest) { +ISOLATE_UNIT_TEST_CASE(ObjectIdRingSerialWrapTest) { Isolate* isolate = Isolate::Current(); ObjectIdRing* ring = isolate->object_id_ring(); ObjectIdRingTestHelper::SetCapacityAndMaxSerial(ring, 2, 4); @@ -190,7 +190,7 @@ TEST_CASE(ObjectIdRingScavengeMoveTest) { // Test that the ring table is updated with nulls when the old GC collects. -VM_TEST_CASE(ObjectIdRingOldGCTest) { +ISOLATE_UNIT_TEST_CASE(ObjectIdRingOldGCTest) { Isolate* isolate = thread->isolate(); Heap* heap = isolate->heap(); ObjectIdRing* ring = isolate->object_id_ring(); @@ -244,7 +244,7 @@ VM_TEST_CASE(ObjectIdRingOldGCTest) { // Test that the ring table correctly reports an entry as expired when it is // overridden by new entries. -VM_TEST_CASE(ObjectIdRingExpiredEntryTest) { +ISOLATE_UNIT_TEST_CASE(ObjectIdRingExpiredEntryTest) { Isolate* isolate = Isolate::Current(); ObjectIdRing* ring = isolate->object_id_ring(); diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc index f0e9b3fab43..ad24b6b34f7 100644 --- a/runtime/vm/object_test.cc +++ b/runtime/vm/object_test.cc @@ -31,7 +31,7 @@ static RawClass* CreateDummyClass(const String& class_name, } -VM_TEST_CASE(Class) { +ISOLATE_UNIT_TEST_CASE(Class) { // Allocate the class first. const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); const Script& script = Script::Handle(); @@ -139,7 +139,7 @@ VM_TEST_CASE(Class) { } -VM_TEST_CASE(TypeArguments) { +ISOLATE_UNIT_TEST_CASE(TypeArguments) { const Type& type1 = Type::Handle(Type::Double()); const Type& type2 = Type::Handle(Type::StringType()); const TypeArguments& type_arguments1 = @@ -161,7 +161,7 @@ VM_TEST_CASE(TypeArguments) { } -VM_TEST_CASE(TokenStream) { +ISOLATE_UNIT_TEST_CASE(TokenStream) { Zone* zone = Thread::Current()->zone(); String& source = String::Handle(zone, String::New("= ( 9 , .")); String& private_key = String::Handle(zone, String::New("")); @@ -179,7 +179,7 @@ VM_TEST_CASE(TokenStream) { } -VM_TEST_CASE(GenerateExactSource) { +ISOLATE_UNIT_TEST_CASE(GenerateExactSource) { // Verify the exact formatting of generated sources. const char* kScriptChars = "\n" @@ -247,7 +247,7 @@ TEST_CASE(Class_ComputeEndTokenPos) { } -VM_TEST_CASE(InstanceClass) { +ISOLATE_UNIT_TEST_CASE(InstanceClass) { // Allocate the class first. String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); Script& script = Script::Handle(); @@ -293,7 +293,7 @@ VM_TEST_CASE(InstanceClass) { } -VM_TEST_CASE(Smi) { +ISOLATE_UNIT_TEST_CASE(Smi) { const Smi& smi = Smi::Handle(Smi::New(5)); Object& smi_object = Object::Handle(smi.raw()); EXPECT(smi.IsSmi()); @@ -354,7 +354,7 @@ VM_TEST_CASE(Smi) { } -VM_TEST_CASE(StringCompareTo) { +ISOLATE_UNIT_TEST_CASE(StringCompareTo) { const String& abcd = String::Handle(String::New("abcd")); const String& abce = String::Handle(String::New("abce")); EXPECT_EQ(0, abcd.CompareTo(abcd)); @@ -397,7 +397,7 @@ VM_TEST_CASE(StringCompareTo) { } -VM_TEST_CASE(StringEncodeIRI) { +ISOLATE_UNIT_TEST_CASE(StringEncodeIRI) { const char* kInput = "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; const char* kOutput = @@ -409,7 +409,7 @@ VM_TEST_CASE(StringEncodeIRI) { } -VM_TEST_CASE(StringDecodeIRI) { +ISOLATE_UNIT_TEST_CASE(StringDecodeIRI) { const char* kOutput = "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; const char* kInput = @@ -422,7 +422,7 @@ VM_TEST_CASE(StringDecodeIRI) { } -VM_TEST_CASE(StringDecodeIRIInvalid) { +ISOLATE_UNIT_TEST_CASE(StringDecodeIRIInvalid) { String& input = String::Handle(); input = String::New("file%"); String& decoded = String::Handle(); @@ -437,7 +437,7 @@ VM_TEST_CASE(StringDecodeIRIInvalid) { } -VM_TEST_CASE(StringIRITwoByte) { +ISOLATE_UNIT_TEST_CASE(StringIRITwoByte) { const intptr_t kInputLen = 3; const uint16_t kInput[kInputLen] = {'x', '/', 256}; const String& input = String::Handle(String::FromUTF16(kInput, kInputLen)); @@ -452,7 +452,7 @@ VM_TEST_CASE(StringIRITwoByte) { } -VM_TEST_CASE(Mint) { +ISOLATE_UNIT_TEST_CASE(Mint) { // On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot // be allocated if it does fit into a Smi. #if !defined(ARCH_IS_64_BIT) @@ -526,7 +526,7 @@ VM_TEST_CASE(Mint) { } -VM_TEST_CASE(Double) { +ISOLATE_UNIT_TEST_CASE(Double) { { const double dbl_const = 5.0; const Double& dbl = Double::Handle(Double::New(dbl_const)); @@ -610,7 +610,7 @@ VM_TEST_CASE(Double) { } -VM_TEST_CASE(Bigint) { +ISOLATE_UNIT_TEST_CASE(Bigint) { Bigint& b = Bigint::Handle(); EXPECT(b.IsNull()); const char* cstr = "18446744073709551615000"; @@ -649,7 +649,7 @@ VM_TEST_CASE(Bigint) { } -VM_TEST_CASE(Integer) { +ISOLATE_UNIT_TEST_CASE(Integer) { Integer& i = Integer::Handle(); i = Integer::NewCanonical(String::Handle(String::New("12"))); EXPECT(i.IsSmi()); @@ -666,7 +666,7 @@ VM_TEST_CASE(Integer) { } -VM_TEST_CASE(String) { +ISOLATE_UNIT_TEST_CASE(String) { const char* kHello = "Hello World!"; int32_t hello_len = strlen(kHello); const String& str = String::Handle(String::New(kHello)); @@ -813,7 +813,7 @@ VM_TEST_CASE(String) { } -VM_TEST_CASE(StringFormat) { +ISOLATE_UNIT_TEST_CASE(StringFormat) { const char* hello_str = "Hello World!"; const String& str = String::Handle(String::NewFormatted("Hello %s!", "World")); @@ -826,7 +826,7 @@ VM_TEST_CASE(StringFormat) { } -VM_TEST_CASE(StringConcat) { +ISOLATE_UNIT_TEST_CASE(StringConcat) { // Create strings from concatenated 1-byte empty strings. { const String& empty1 = String::Handle(String::New("")); @@ -1357,7 +1357,7 @@ VM_TEST_CASE(StringConcat) { } -VM_TEST_CASE(StringHashConcat) { +ISOLATE_UNIT_TEST_CASE(StringHashConcat) { EXPECT_EQ(String::Handle(String::New("onebyte")).Hash(), String::HashConcat(String::Handle(String::New("one")), String::Handle(String::New("byte")))); @@ -1373,7 +1373,7 @@ VM_TEST_CASE(StringHashConcat) { } -VM_TEST_CASE(StringSubStringDifferentWidth) { +ISOLATE_UNIT_TEST_CASE(StringSubStringDifferentWidth) { // Create 1-byte substring from a 1-byte source string. const char* onechars = "\xC3\xB6\xC3\xB1\xC3\xA9"; @@ -1434,7 +1434,7 @@ VM_TEST_CASE(StringSubStringDifferentWidth) { } -VM_TEST_CASE(StringFromUtf8Literal) { +ISOLATE_UNIT_TEST_CASE(StringFromUtf8Literal) { // Create a 1-byte string from a UTF-8 encoded string literal. { const char* src = @@ -1594,7 +1594,7 @@ VM_TEST_CASE(StringFromUtf8Literal) { } -VM_TEST_CASE(StringEqualsUtf8) { +ISOLATE_UNIT_TEST_CASE(StringEqualsUtf8) { const char* onesrc = "abc"; const String& onestr = String::Handle(String::New(onesrc)); EXPECT(onestr.IsOneByteString()); @@ -1626,7 +1626,7 @@ VM_TEST_CASE(StringEqualsUtf8) { } -VM_TEST_CASE(StringEqualsUTF32) { +ISOLATE_UNIT_TEST_CASE(StringEqualsUTF32) { const String& empty = String::Handle(String::New("")); const String& t_str = String::Handle(String::New("t")); const String& th_str = String::Handle(String::New("th")); @@ -1643,7 +1643,7 @@ VM_TEST_CASE(StringEqualsUTF32) { } -VM_TEST_CASE(ExternalOneByteString) { +ISOLATE_UNIT_TEST_CASE(ExternalOneByteString) { uint8_t characters[] = {0xF6, 0xF1, 0xE9}; intptr_t len = ARRAY_SIZE(characters); @@ -1674,7 +1674,7 @@ VM_TEST_CASE(ExternalOneByteString) { } -VM_TEST_CASE(EscapeSpecialCharactersOneByteString) { +ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersOneByteString) { uint8_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; intptr_t len = ARRAY_SIZE(characters); @@ -1694,7 +1694,7 @@ VM_TEST_CASE(EscapeSpecialCharactersOneByteString) { } -VM_TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { +ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { uint8_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; intptr_t len = ARRAY_SIZE(characters); @@ -1717,7 +1717,7 @@ VM_TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { EXPECT_EQ(escaped_empty_str.Length(), 0); } -VM_TEST_CASE(EscapeSpecialCharactersTwoByteString) { +ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersTwoByteString) { uint16_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; intptr_t len = ARRAY_SIZE(characters); @@ -1740,7 +1740,7 @@ VM_TEST_CASE(EscapeSpecialCharactersTwoByteString) { } -VM_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { +ISOLATE_UNIT_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { uint16_t characters[] = {'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z'}; intptr_t len = ARRAY_SIZE(characters); @@ -1763,7 +1763,7 @@ VM_TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { } -VM_TEST_CASE(ExternalTwoByteString) { +ISOLATE_UNIT_TEST_CASE(ExternalTwoByteString) { uint16_t characters[] = {0x1E6B, 0x1E85, 0x1E53}; intptr_t len = ARRAY_SIZE(characters); @@ -1796,7 +1796,7 @@ VM_TEST_CASE(ExternalTwoByteString) { } -VM_TEST_CASE(Symbol) { +ISOLATE_UNIT_TEST_CASE(Symbol) { const String& one = String::Handle(Symbols::New(thread, "Eins")); EXPECT(one.IsSymbol()); const String& two = String::Handle(Symbols::New(thread, "Zwei")); @@ -1858,7 +1858,7 @@ VM_TEST_CASE(Symbol) { } -VM_TEST_CASE(SymbolUnicode) { +ISOLATE_UNIT_TEST_CASE(SymbolUnicode) { uint16_t monkey_utf16[] = {0xd83d, 0xdc35}; // Unicode Monkey Face. String& monkey = String::Handle(Symbols::FromUTF16(thread, monkey_utf16, 2)); EXPECT(monkey.IsSymbol()); @@ -1881,13 +1881,13 @@ VM_TEST_CASE(SymbolUnicode) { } -VM_TEST_CASE(Bool) { +ISOLATE_UNIT_TEST_CASE(Bool) { EXPECT(Bool::True().value()); EXPECT(!Bool::False().value()); } -VM_TEST_CASE(Array) { +ISOLATE_UNIT_TEST_CASE(Array) { const int kArrayLen = 5; const Array& array = Array::Handle(Array::New(kArrayLen)); EXPECT_EQ(kArrayLen, array.Length()); @@ -2042,7 +2042,7 @@ TEST_CASE(Int8ListLengthMaxElements) { } -VM_TEST_CASE(StringCodePointIterator) { +ISOLATE_UNIT_TEST_CASE(StringCodePointIterator) { const String& str0 = String::Handle(String::New("")); String::CodePointIterator it0(str0); EXPECT(!it0.Next()); @@ -2099,7 +2099,7 @@ VM_TEST_CASE(StringCodePointIterator) { } -VM_TEST_CASE(StringCodePointIteratorRange) { +ISOLATE_UNIT_TEST_CASE(StringCodePointIteratorRange) { const String& str = String::Handle(String::New("foo bar baz")); String::CodePointIterator it0(str, 3, 0); @@ -2116,7 +2116,7 @@ VM_TEST_CASE(StringCodePointIteratorRange) { } -VM_TEST_CASE(GrowableObjectArray) { +ISOLATE_UNIT_TEST_CASE(GrowableObjectArray) { const int kArrayLen = 5; Smi& value = Smi::Handle(); Smi& expected_value = Smi::Handle(); @@ -2238,7 +2238,7 @@ VM_TEST_CASE(GrowableObjectArray) { } -VM_TEST_CASE(InternalTypedData) { +ISOLATE_UNIT_TEST_CASE(InternalTypedData) { uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4}; intptr_t data_length = ARRAY_SIZE(data); @@ -2294,7 +2294,7 @@ VM_TEST_CASE(InternalTypedData) { } -VM_TEST_CASE(ExternalTypedData) { +ISOLATE_UNIT_TEST_CASE(ExternalTypedData) { uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4}; intptr_t data_length = ARRAY_SIZE(data); @@ -2388,7 +2388,7 @@ TEST_CASE(Script) { } -VM_TEST_CASE(EmbeddedScript) { +ISOLATE_UNIT_TEST_CASE(EmbeddedScript) { const char* url_chars = "builtin:test-case"; const char* text = /* 1 */ @@ -2490,7 +2490,7 @@ VM_TEST_CASE(EmbeddedScript) { } -VM_TEST_CASE(Context) { +ISOLATE_UNIT_TEST_CASE(Context) { const int kNumVariables = 5; const Context& parent_context = Context::Handle(Context::New(0)); const Context& context = Context::Handle(Context::New(kNumVariables)); @@ -2513,7 +2513,7 @@ VM_TEST_CASE(Context) { } -VM_TEST_CASE(ContextScope) { +ISOLATE_UNIT_TEST_CASE(ContextScope) { const intptr_t parent_scope_function_level = 0; LocalScope* parent_scope = new LocalScope(NULL, parent_scope_function_level, 0); @@ -2598,7 +2598,7 @@ VM_TEST_CASE(ContextScope) { } -VM_TEST_CASE(Closure) { +ISOLATE_UNIT_TEST_CASE(Closure) { // Allocate the class first. const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); const Script& script = Script::Handle(); @@ -2628,7 +2628,7 @@ VM_TEST_CASE(Closure) { } -VM_TEST_CASE(ObjectPrinting) { +ISOLATE_UNIT_TEST_CASE(ObjectPrinting) { // Simple Smis. EXPECT_STREQ("2", Smi::Handle(Smi::New(2)).ToCString()); EXPECT_STREQ("-15", Smi::Handle(Smi::New(-15)).ToCString()); @@ -2646,7 +2646,7 @@ VM_TEST_CASE(ObjectPrinting) { } -VM_TEST_CASE(CheckedHandle) { +ISOLATE_UNIT_TEST_CASE(CheckedHandle) { // Ensure that null handles have the correct C++ vtable setup. const String& str1 = String::Handle(); EXPECT(str1.IsString()); @@ -2690,7 +2690,7 @@ static RawFunction* CreateFunction(const char* name) { // Test for Code and Instruction object creation. -VM_TEST_CASE(Code) { +ISOLATE_UNIT_TEST_CASE(Code) { extern void GenerateIncrement(Assembler * assembler); Assembler _assembler_; GenerateIncrement(&_assembler_); @@ -2708,7 +2708,7 @@ VM_TEST_CASE(Code) { // Test for immutability of generated instructions. The test crashes with a // segmentation fault when writing into it. -VM_TEST_CASE(CodeImmutability) { +ISOLATE_UNIT_TEST_CASE(CodeImmutability) { extern void GenerateIncrement(Assembler * assembler); Assembler _assembler_; GenerateIncrement(&_assembler_); @@ -2730,7 +2730,7 @@ VM_TEST_CASE(CodeImmutability) { // Test for Embedded String object in the instructions. -VM_TEST_CASE(EmbedStringInCode) { +ISOLATE_UNIT_TEST_CASE(EmbedStringInCode) { extern void GenerateEmbedStringInCode(Assembler * assembler, const char* str); const char* kHello = "Hello World!"; word expected_length = static_cast(strlen(kHello)); @@ -2753,7 +2753,7 @@ VM_TEST_CASE(EmbedStringInCode) { // Test for Embedded Smi object in the instructions. -VM_TEST_CASE(EmbedSmiInCode) { +ISOLATE_UNIT_TEST_CASE(EmbedSmiInCode) { extern void GenerateEmbedSmiInCode(Assembler * assembler, intptr_t value); const intptr_t kSmiTestValue = 5; Assembler _assembler_; @@ -2770,7 +2770,7 @@ VM_TEST_CASE(EmbedSmiInCode) { #if defined(ARCH_IS_64_BIT) // Test for Embedded Smi object in the instructions. -VM_TEST_CASE(EmbedSmiIn64BitCode) { +ISOLATE_UNIT_TEST_CASE(EmbedSmiIn64BitCode) { extern void GenerateEmbedSmiInCode(Assembler * assembler, intptr_t value); const intptr_t kSmiTestValue = DART_INT64_C(5) << 32; Assembler _assembler_; @@ -2786,7 +2786,7 @@ VM_TEST_CASE(EmbedSmiIn64BitCode) { #endif // ARCH_IS_64_BIT -VM_TEST_CASE(ExceptionHandlers) { +ISOLATE_UNIT_TEST_CASE(ExceptionHandlers) { const int kNumEntries = 4; // Add an exception handler table to the code. ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle(); @@ -2824,7 +2824,7 @@ VM_TEST_CASE(ExceptionHandlers) { } -VM_TEST_CASE(PcDescriptors) { +ISOLATE_UNIT_TEST_CASE(PcDescriptors) { DescriptorList* builder = new DescriptorList(0); // kind, pc_offset, deopt_id, token_pos, try_index @@ -2882,7 +2882,7 @@ VM_TEST_CASE(PcDescriptors) { } -VM_TEST_CASE(PcDescriptorsLargeDeltas) { +ISOLATE_UNIT_TEST_CASE(PcDescriptorsLargeDeltas) { DescriptorList* builder = new DescriptorList(0); // kind, pc_offset, deopt_id, token_pos, try_index @@ -2964,7 +2964,7 @@ static RawField* CreateTestField(const char* name) { } -VM_TEST_CASE(ClassDictionaryIterator) { +ISOLATE_UNIT_TEST_CASE(ClassDictionaryIterator) { Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6")); Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4")); Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8")); @@ -3003,7 +3003,7 @@ static RawFunction* GetDummyTarget(const char* name) { } -VM_TEST_CASE(ICData) { +ISOLATE_UNIT_TEST_CASE(ICData) { Function& function = Function::Handle(GetDummyTarget("Bern")); const intptr_t id = 12; const intptr_t num_args_tested = 1; @@ -3076,7 +3076,7 @@ VM_TEST_CASE(ICData) { } -VM_TEST_CASE(SubtypeTestCache) { +ISOLATE_UNIT_TEST_CASE(SubtypeTestCache) { String& class_name = String::Handle(Symbols::New(thread, "EmptyClass")); Script& script = Script::Handle(); const Class& empty_class = @@ -3102,7 +3102,7 @@ VM_TEST_CASE(SubtypeTestCache) { } -VM_TEST_CASE(FieldTests) { +ISOLATE_UNIT_TEST_CASE(FieldTests) { const String& f = String::Handle(String::New("oneField")); const String& getter_f = String::Handle(Field::GetterName(f)); const String& setter_f = String::Handle(Field::SetterName(f)); @@ -3123,7 +3123,7 @@ VM_TEST_CASE(FieldTests) { bool EqualsIgnoringPrivate(const String& name, const String& private_name); -VM_TEST_CASE(EqualsIgnoringPrivate) { +ISOLATE_UNIT_TEST_CASE(EqualsIgnoringPrivate) { String& mangled_name = String::Handle(); String& bare_name = String::Handle(); @@ -3256,7 +3256,7 @@ VM_TEST_CASE(EqualsIgnoringPrivate) { } -VM_TEST_CASE(ArrayNew_Overflow_Crash) { +ISOLATE_UNIT_TEST_CASE(ArrayNew_Overflow_Crash) { Array::Handle(Array::New(Array::kMaxElements + 1)); } @@ -3321,7 +3321,7 @@ TEST_CASE(StackTraceFormat) { } -VM_TEST_CASE(WeakProperty_PreserveCrossGen) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveCrossGen) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); { @@ -3433,7 +3433,7 @@ VM_TEST_CASE(WeakProperty_PreserveCrossGen) { } -VM_TEST_CASE(WeakProperty_PreserveRecurse) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveRecurse) { // This used to end in an infinite recursion. Caused by scavenging the weak // property before scavenging the key. Isolate* isolate = Isolate::Current(); @@ -3456,7 +3456,7 @@ VM_TEST_CASE(WeakProperty_PreserveRecurse) { } -VM_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); String& key = String::Handle(); @@ -3475,7 +3475,7 @@ VM_TEST_CASE(WeakProperty_PreserveOne_NewSpace) { } -VM_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); String& key1 = String::Handle(); @@ -3504,7 +3504,7 @@ VM_TEST_CASE(WeakProperty_PreserveTwo_NewSpace) { } -VM_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); WeakProperty& weak2 = WeakProperty::Handle(); @@ -3531,7 +3531,7 @@ VM_TEST_CASE(WeakProperty_PreserveTwoShared_NewSpace) { } -VM_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); String& key = String::Handle(); @@ -3550,7 +3550,7 @@ VM_TEST_CASE(WeakProperty_PreserveOne_OldSpace) { } -VM_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); String& key1 = String::Handle(); @@ -3579,7 +3579,7 @@ VM_TEST_CASE(WeakProperty_PreserveTwo_OldSpace) { } -VM_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); WeakProperty& weak2 = WeakProperty::Handle(); @@ -3606,7 +3606,7 @@ VM_TEST_CASE(WeakProperty_PreserveTwoShared_OldSpace) { } -VM_TEST_CASE(WeakProperty_ClearOne_NewSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); { @@ -3627,7 +3627,7 @@ VM_TEST_CASE(WeakProperty_ClearOne_NewSpace) { } -VM_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); WeakProperty& weak2 = WeakProperty::Handle(); @@ -3654,7 +3654,7 @@ VM_TEST_CASE(WeakProperty_ClearTwoShared_NewSpace) { } -VM_TEST_CASE(WeakProperty_ClearOne_OldSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearOne_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak = WeakProperty::Handle(); { @@ -3675,7 +3675,7 @@ VM_TEST_CASE(WeakProperty_ClearOne_OldSpace) { } -VM_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { +ISOLATE_UNIT_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { Isolate* isolate = Isolate::Current(); WeakProperty& weak1 = WeakProperty::Handle(); WeakProperty& weak2 = WeakProperty::Handle(); @@ -3702,7 +3702,7 @@ VM_TEST_CASE(WeakProperty_ClearTwoShared_OldSpace) { } -VM_TEST_CASE(MirrorReference) { +ISOLATE_UNIT_TEST_CASE(MirrorReference) { const MirrorReference& reference = MirrorReference::Handle(MirrorReference::New(Object::Handle())); Object& initial_referent = Object::Handle(reference.referent()); @@ -3760,7 +3760,7 @@ static RawClass* GetClass(const Library& lib, const char* name) { } -VM_TEST_CASE(FindClosureIndex) { +ISOLATE_UNIT_TEST_CASE(FindClosureIndex) { // Allocate the class first. const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); const Script& script = Script::Handle(); @@ -3798,7 +3798,7 @@ VM_TEST_CASE(FindClosureIndex) { } -VM_TEST_CASE(FindInvocationDispatcherFunctionIndex) { +ISOLATE_UNIT_TEST_CASE(FindInvocationDispatcherFunctionIndex) { const String& class_name = String::Handle(Symbols::New(thread, "MyClass")); const Script& script = Script::Handle(); const Class& cls = Class::Handle(CreateDummyClass(class_name, script)); @@ -4051,7 +4051,7 @@ TEST_CASE(FunctionWithBreakpointNotInlined) { } -VM_TEST_CASE(SpecialClassesHaveEmptyArrays) { +ISOLATE_UNIT_TEST_CASE(SpecialClassesHaveEmptyArrays) { ObjectStore* object_store = Isolate::Current()->object_store(); Class& cls = Class::Handle(); Object& array = Object::Handle(); @@ -4107,7 +4107,7 @@ class ObjectAccumulator : public ObjectVisitor { }; -VM_TEST_CASE(PrintJSON) { +ISOLATE_UNIT_TEST_CASE(PrintJSON) { Heap* heap = Isolate::Current()->heap(); heap->CollectAllGarbage(); GrowableArray objects; @@ -4121,7 +4121,7 @@ VM_TEST_CASE(PrintJSON) { } -VM_TEST_CASE(PrintJSONPrimitives) { +ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) { char buffer[1024]; Isolate* isolate = Isolate::Current(); @@ -4591,7 +4591,7 @@ static void CheckConcatAll(const String* data[], intptr_t n) { } -VM_TEST_CASE(Symbols_FromConcatAll) { +ISOLATE_UNIT_TEST_CASE(Symbols_FromConcatAll) { { const String* data[3] = {&Symbols::FallThroughError(), &Symbols::Dot(), &Symbols::isPaused()}; @@ -4661,7 +4661,7 @@ struct TestResult { }; -VM_TEST_CASE(String_ScrubName) { +ISOLATE_UNIT_TEST_CASE(String_ScrubName) { TestResult tests[] = { {"(dynamic, dynamic) => void", "(dynamic, dynamic) => void"}, {"_List@915557746", "_List"}, @@ -4688,7 +4688,7 @@ VM_TEST_CASE(String_ScrubName) { } -VM_TEST_CASE(String_EqualsUTF32) { +ISOLATE_UNIT_TEST_CASE(String_EqualsUTF32) { // Regression test for Issue 27433. Checks that comparisons between Strings // and utf32 arrays happens after conversion to utf16 instead of utf32, as // required for proper canonicalization of string literals with a lossy diff --git a/runtime/vm/os_test.cc b/runtime/vm/os_test.cc index 2ecc36b1bf9..2c314176d0d 100644 --- a/runtime/vm/os_test.cc +++ b/runtime/vm/os_test.cc @@ -10,7 +10,7 @@ namespace dart { -UNIT_TEST_CASE(Sleep) { +VM_UNIT_TEST_CASE(Sleep) { // All times measured in microseconds. int64_t start_time = OS::GetCurrentMonotonicMicros(); int64_t sleep_time = 702000; @@ -22,7 +22,7 @@ UNIT_TEST_CASE(Sleep) { } -UNIT_TEST_CASE(SNPrint) { +VM_UNIT_TEST_CASE(SNPrint) { char buffer[256]; int length; length = OS::SNPrint(buffer, 10, "%s", "foo"); @@ -40,14 +40,14 @@ UNIT_TEST_CASE(SNPrint) { // This test is expected to crash when it runs. -UNIT_TEST_CASE(SNPrint_BadArgs) { +VM_UNIT_TEST_CASE(SNPrint_BadArgs) { int width = kMaxInt32; int num = 7; OS::SNPrint(NULL, 0, "%*d%*d", width, num, width, num); } -UNIT_TEST_CASE(OsFuncs) { +VM_UNIT_TEST_CASE(OsFuncs) { EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment())); EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment())); int procs = OS::NumberOfAvailableProcessors(); diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc index 6d5b6e6ecab..a910b545897 100644 --- a/runtime/vm/snapshot_test.cc +++ b/runtime/vm/snapshot_test.cc @@ -1002,7 +1002,7 @@ TEST_CASE(SerializeScript) { #if !defined(PRODUCT) // Uses deferred loading. -UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { +VM_UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { const char* kScriptChars = "\n" "import 'dart:mirrors';" @@ -1121,7 +1121,7 @@ static void IterateScripts(const Library& lib) { } } -VM_TEST_CASE(GenerateSource) { +ISOLATE_UNIT_TEST_CASE(GenerateSource) { Zone* zone = thread->zone(); Isolate* isolate = thread->isolate(); const GrowableObjectArray& libs = @@ -1138,7 +1138,7 @@ VM_TEST_CASE(GenerateSource) { } -UNIT_TEST_CASE(FullSnapshot) { +VM_UNIT_TEST_CASE(FullSnapshot) { const char* kScriptChars = "class Fields {\n" " Fields(int i, int j) : fld1 = i, fld2 = j {}\n" @@ -1212,7 +1212,7 @@ UNIT_TEST_CASE(FullSnapshot) { } -UNIT_TEST_CASE(FullSnapshot1) { +VM_UNIT_TEST_CASE(FullSnapshot1) { // This buffer has to be static for this to compile with Visual Studio. // If it is not static compilation of this file with Visual Studio takes // more than 30 minutes! @@ -1281,7 +1281,7 @@ UNIT_TEST_CASE(FullSnapshot1) { #ifndef PRODUCT -UNIT_TEST_CASE(ScriptSnapshot) { +VM_UNIT_TEST_CASE(ScriptSnapshot) { const char* kLibScriptChars = "library dart_import_lib;" "class LibFields {" @@ -1416,7 +1416,7 @@ UNIT_TEST_CASE(ScriptSnapshot) { } -UNIT_TEST_CASE(ScriptSnapshot1) { +VM_UNIT_TEST_CASE(ScriptSnapshot1) { const char* kScriptChars = "class _SimpleNumEnumerable {" "final Iterable _source;" @@ -1489,7 +1489,7 @@ UNIT_TEST_CASE(ScriptSnapshot1) { } -UNIT_TEST_CASE(ScriptSnapshot2) { +VM_UNIT_TEST_CASE(ScriptSnapshot2) { // The snapshot of this library is always created in production mode, but // loaded and executed in both production and checked modes. // This test verifies that type information is still contained in the snapshot @@ -1605,7 +1605,7 @@ UNIT_TEST_CASE(ScriptSnapshot2) { } -UNIT_TEST_CASE(MismatchedSnapshotKinds) { +VM_UNIT_TEST_CASE(MismatchedSnapshotKinds) { const char* kScriptChars = "main() { print('Hello, world!'); }"; Dart_Handle result; @@ -1781,7 +1781,7 @@ static void CheckStringInvalid(Dart_Handle dart_string) { } -UNIT_TEST_CASE(DartGeneratedMessages) { +VM_UNIT_TEST_CASE(DartGeneratedMessages) { static const char* kCustomIsolateScriptChars = "getSmi() {\n" " return 42;\n" @@ -1929,7 +1929,7 @@ UNIT_TEST_CASE(DartGeneratedMessages) { } -UNIT_TEST_CASE(DartGeneratedListMessages) { +VM_UNIT_TEST_CASE(DartGeneratedListMessages) { const int kArrayLength = 10; static const char* kScriptChars = "final int kArrayLength = 10;\n" @@ -2040,7 +2040,7 @@ UNIT_TEST_CASE(DartGeneratedListMessages) { } -UNIT_TEST_CASE(DartGeneratedArrayLiteralMessages) { +VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessages) { const int kArrayLength = 10; static const char* kScriptChars = "final int kArrayLength = 10;\n" @@ -2261,7 +2261,7 @@ UNIT_TEST_CASE(DartGeneratedArrayLiteralMessages) { } -UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) { +VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) { const int kArrayLength = 10; static const char* kScriptChars = "import 'dart:typed_data';\n" @@ -2481,7 +2481,7 @@ UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) { } -UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) { +VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) { const int kArrayLength = 10; static const char* kScriptChars = "import 'dart:typed_data';\n" @@ -2716,7 +2716,7 @@ static void CheckTypedData(Dart_CObject* object, EXPECT_EQ(len, object->value.as_typed_data.length); } -UNIT_TEST_CASE(DartGeneratedListMessagesWithTypedData) { +VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithTypedData) { static const char* kScriptChars = "import 'dart:typed_data';\n" "getTypedDataList() {\n" @@ -2903,7 +2903,7 @@ UNIT_TEST_CASE(DartGeneratedListMessagesWithTypedData) { } -UNIT_TEST_CASE(PostCObject) { +VM_UNIT_TEST_CASE(PostCObject) { // Create a native port for posting from C to Dart TestIsolateScope __test_isolate__; const char* kScriptChars = diff --git a/runtime/vm/stack_frame_test.cc b/runtime/vm/stack_frame_test.cc index d1ebde651b5..907e94562f1 100644 --- a/runtime/vm/stack_frame_test.cc +++ b/runtime/vm/stack_frame_test.cc @@ -17,7 +17,7 @@ namespace dart { // Unit test for empty stack frame iteration. -VM_TEST_CASE(EmptyStackFrameIteration) { +ISOLATE_UNIT_TEST_CASE(EmptyStackFrameIteration) { StackFrameIterator iterator(StackFrameIterator::kValidateFrames); EXPECT(!iterator.HasNextFrame()); EXPECT(iterator.NextFrame() == NULL); @@ -26,7 +26,7 @@ VM_TEST_CASE(EmptyStackFrameIteration) { // Unit test for empty dart stack frame iteration. -VM_TEST_CASE(EmptyDartStackFrameIteration) { +ISOLATE_UNIT_TEST_CASE(EmptyDartStackFrameIteration) { DartFrameIterator iterator; EXPECT(iterator.NextFrame() == NULL); VerifyPointersVisitor::VerifyPointers(); diff --git a/runtime/vm/thread_barrier_test.cc b/runtime/vm/thread_barrier_test.cc index 9fcdc1cdf3a..d907df112ba 100644 --- a/runtime/vm/thread_barrier_test.cc +++ b/runtime/vm/thread_barrier_test.cc @@ -37,7 +37,7 @@ class FuzzTask : public ThreadPool::Task { }; -UNIT_TEST_CASE(ThreadBarrier) { +VM_UNIT_TEST_CASE(ThreadBarrier) { static const intptr_t kNumTasks = 5; static const intptr_t kNumRounds = 500; diff --git a/runtime/vm/thread_pool_test.cc b/runtime/vm/thread_pool_test.cc index 23d614094d5..7d5e82fb72c 100644 --- a/runtime/vm/thread_pool_test.cc +++ b/runtime/vm/thread_pool_test.cc @@ -12,7 +12,7 @@ namespace dart { DECLARE_FLAG(int, worker_timeout_millis); -UNIT_TEST_CASE(ThreadPool_Create) { +VM_UNIT_TEST_CASE(ThreadPool_Create) { ThreadPool thread_pool; } @@ -43,7 +43,7 @@ class TestTask : public ThreadPool::Task { }; -UNIT_TEST_CASE(ThreadPool_RunOne) { +VM_UNIT_TEST_CASE(ThreadPool_RunOne) { ThreadPool thread_pool; Monitor sync; bool done = true; @@ -64,7 +64,7 @@ UNIT_TEST_CASE(ThreadPool_RunOne) { } -UNIT_TEST_CASE(ThreadPool_RunMany) { +VM_UNIT_TEST_CASE(ThreadPool_RunMany) { const int kTaskCount = 100; ThreadPool thread_pool; Monitor sync[kTaskCount]; @@ -119,7 +119,7 @@ class SleepTask : public ThreadPool::Task { }; -UNIT_TEST_CASE(ThreadPool_WorkerShutdown) { +VM_UNIT_TEST_CASE(ThreadPool_WorkerShutdown) { const int kTaskCount = 10; Monitor sync; int slept_count = 0; @@ -157,7 +157,7 @@ UNIT_TEST_CASE(ThreadPool_WorkerShutdown) { } -UNIT_TEST_CASE(ThreadPool_WorkerTimeout) { +VM_UNIT_TEST_CASE(ThreadPool_WorkerTimeout) { // Adjust the worker timeout so that we timeout quickly. int saved_timeout = FLAG_worker_timeout_millis; FLAG_worker_timeout_millis = 1; @@ -230,7 +230,7 @@ class SpawnTask : public ThreadPool::Task { }; -UNIT_TEST_CASE(ThreadPool_RecursiveSpawn) { +VM_UNIT_TEST_CASE(ThreadPool_RecursiveSpawn) { ThreadPool thread_pool; Monitor sync; const int kTotalTasks = 500; diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc index b2b8d3912fa..74a97fdc9b0 100644 --- a/runtime/vm/thread_test.cc +++ b/runtime/vm/thread_test.cc @@ -13,7 +13,7 @@ namespace dart { -UNIT_TEST_CASE(Mutex) { +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); @@ -35,7 +35,7 @@ UNIT_TEST_CASE(Mutex) { } -UNIT_TEST_CASE(Monitor) { +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); @@ -173,7 +173,7 @@ class TaskWithZoneAllocation : public ThreadPool::Task { }; -VM_TEST_CASE(ManyTasksWithZones) { +ISOLATE_UNIT_TEST_CASE(ManyTasksWithZones) { const int kTaskCount = 100; Monitor sync[kTaskCount]; bool done[kTaskCount]; @@ -554,7 +554,7 @@ TEST_CASE(SafepointTestDart) { // - main thread in VM code, // organized by // - helpers. -VM_TEST_CASE(SafepointTestVM) { +ISOLATE_UNIT_TEST_CASE(SafepointTestVM) { Isolate* isolate = thread->isolate(); Monitor monitor; intptr_t expected_count = 0; @@ -575,7 +575,7 @@ VM_TEST_CASE(SafepointTestVM) { // Test case for recursive safepoint operations. -VM_TEST_CASE(RecursiveSafepointTest1) { +ISOLATE_UNIT_TEST_CASE(RecursiveSafepointTest1) { intptr_t count = 0; { SafepointOperationScope safepoint_scope(thread); @@ -593,7 +593,7 @@ VM_TEST_CASE(RecursiveSafepointTest1) { } -VM_TEST_CASE(ThreadIterator_Count) { +ISOLATE_UNIT_TEST_CASE(ThreadIterator_Count) { intptr_t thread_count_0 = 0; intptr_t thread_count_1 = 0; @@ -621,7 +621,7 @@ VM_TEST_CASE(ThreadIterator_Count) { } -VM_TEST_CASE(ThreadIterator_FindSelf) { +ISOLATE_UNIT_TEST_CASE(ThreadIterator_FindSelf) { OSThread* current = OSThread::Current(); EXPECT(OSThread::IsThreadInList(current->id())); } @@ -682,7 +682,7 @@ TEST_CASE(ThreadIterator_AddFindRemove) { // organized by // - main thread, and // - helpers. -VM_TEST_CASE(SafepointTestVM2) { +ISOLATE_UNIT_TEST_CASE(SafepointTestVM2) { Isolate* isolate = thread->isolate(); Monitor monitor; intptr_t expected_count = 0; @@ -714,7 +714,7 @@ VM_TEST_CASE(SafepointTestVM2) { // Test recursive safepoint operation scopes with other threads trying // to also start a safepoint operation scope. -VM_TEST_CASE(RecursiveSafepointTest2) { +ISOLATE_UNIT_TEST_CASE(RecursiveSafepointTest2) { Isolate* isolate = thread->isolate(); Monitor monitor; intptr_t expected_count = 0; @@ -785,7 +785,7 @@ class AllocAndGCTask : public ThreadPool::Task { }; -VM_TEST_CASE(HelperAllocAndGC) { +ISOLATE_UNIT_TEST_CASE(HelperAllocAndGC) { Monitor done_monitor; bool done = false; Isolate* isolate = thread->isolate(); diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc index cec626875a3..6a9c5f511bf 100644 --- a/runtime/vm/unit_test.cc +++ b/runtime/vm/unit_test.cc @@ -32,7 +32,8 @@ TestCaseBase* TestCaseBase::first_ = NULL; TestCaseBase* TestCaseBase::tail_ = NULL; -TestCaseBase::TestCaseBase(const char* name) : next_(NULL), name_(name) { +TestCaseBase::TestCaseBase(const char* name) + : raw_test_(false), next_(NULL), name_(name) { if (first_ == NULL) { first_ = this; } else { @@ -42,10 +43,23 @@ TestCaseBase::TestCaseBase(const char* name) : next_(NULL), name_(name) { } +void TestCaseBase::RunAllRaw() { + TestCaseBase* test = first_; + while (test != NULL) { + if (test->raw_test_) { + test->RunTest(); + } + test = test->next_; + } +} + + void TestCaseBase::RunAll() { TestCaseBase* test = first_; while (test != NULL) { - test->RunTest(); + if (!test->raw_test_) { + test->RunTest(); + } test = test->next_; } } diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h index 945fd6e8378..40b8adad5e2 100644 --- a/runtime/vm/unit_test.h +++ b/runtime/vm/unit_test.h @@ -21,21 +21,29 @@ #include "vm/simulator.h" #include "vm/zone.h" -// The UNIT_TEST_CASE macro is used for tests that do not need any +// The VM_UNIT_TEST_CASE macro is used for tests that do not need any // default isolate or zone functionality. -#define UNIT_TEST_CASE(name) \ +#define VM_UNIT_TEST_CASE(name) \ void Dart_Test##name(); \ static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ void Dart_Test##name() -// The VM_TEST_CASE macro is used for tests that need an isolate and zone -// in order to test its functionality. This macro is used for tests that +// The UNIT_TEST_CASE macro is used for tests that do not require any +// functionality provided by the VM. Tests declared using this macro will be run +// after the VM is cleaned up. +#define UNIT_TEST_CASE(name) \ + void Dart_Test##name(); \ + static const dart::RawTestCase kRegister##name(Dart_Test##name, #name); \ + void Dart_Test##name() + +// The ISOLATE_UNIT_TEST_CASE macro is used for tests that need an isolate and +// zone in order to test its functionality. This macro is used for tests that // are implemented using the VM code directly and do not use the Dart API // for calling into the VM. The safepoint execution state of threads using // this macro is transitioned from kThreadInNative to kThreadInVM. -#define VM_TEST_CASE(name) \ +#define ISOLATE_UNIT_TEST_CASE(name) \ static void Dart_TestHelper##name(Thread* thread); \ - UNIT_TEST_CASE(name) { \ + VM_UNIT_TEST_CASE(name) { \ TestIsolateScope __test_isolate__; \ Thread* __thread__ = Thread::Current(); \ ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \ @@ -52,7 +60,7 @@ // execution state of threads using this macro remains kThreadNative. #define TEST_CASE(name) \ static void Dart_TestHelper##name(Thread* thread); \ - UNIT_TEST_CASE(name) { \ + VM_UNIT_TEST_CASE(name) { \ TestIsolateScope __test_isolate__; \ Thread* __thread__ = Thread::Current(); \ ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \ @@ -77,7 +85,7 @@ // C++ callee-saved registers are not preserved. Arguments may be passed in. #define ASSEMBLER_TEST_RUN(name, test) \ static void AssemblerTestRun##name(AssemblerTest* test); \ - VM_TEST_CASE(name) { \ + ISOLATE_UNIT_TEST_CASE(name) { \ Assembler __assembler__; \ AssemblerTest test("" #name, &__assembler__); \ AssemblerTestGenerate##name(test.assembler()); \ @@ -100,7 +108,7 @@ // Pass the name of test and the expected results as RawObject. #define CODEGEN_TEST_RUN(name, expected) \ static void CodeGenTestRun##name(const Function& function); \ - VM_TEST_CASE(name) { \ + ISOLATE_UNIT_TEST_CASE(name) { \ CodeGenTest __test__("" #name); \ CodeGenTestGenerate##name(&__test__); \ __test__.Compile(); \ @@ -120,7 +128,7 @@ // and evaluate its result. #define CODEGEN_TEST_RAW_RUN(name, function) \ static void CodeGenTestRun##name(const Function& function); \ - VM_TEST_CASE(name) { \ + ISOLATE_UNIT_TEST_CASE(name) { \ CodeGenTest __test__("" #name); \ CodeGenTestGenerate##name(&__test__); \ __test__.Compile(); \ @@ -133,7 +141,7 @@ // The first one may reference the Function object generated by the second one. #define CODEGEN_TEST2_RUN(name1, name2, expected) \ static void CodeGenTestRun##name1(const Function& function); \ - VM_TEST_CASE(name1) { \ + ISOLATE_UNIT_TEST_CASE(name1) { \ /* Generate code for name2 */ \ CodeGenTest __test2__("" #name2); \ CodeGenTestGenerate##name2(&__test2__); \ @@ -261,6 +269,10 @@ class TestCaseBase { void RunTest(); static void RunAll(); + static void RunAllRaw(); + + protected: + bool raw_test_; private: static TestCaseBase* first_; @@ -323,6 +335,20 @@ class TestCase : TestCaseBase { }; +class RawTestCase : TestCaseBase { + public: + typedef void(RunEntry)(); + + RawTestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) { + raw_test_ = true; + } + virtual void Run(); + + private: + RunEntry* const run_; +}; + + class TestIsolateScope { public: TestIsolateScope() { diff --git a/runtime/vm/utils_test.cc b/runtime/vm/utils_test.cc index 9d5b20ef8ee..7a90388a40d 100644 --- a/runtime/vm/utils_test.cc +++ b/runtime/vm/utils_test.cc @@ -8,7 +8,7 @@ namespace dart { -UNIT_TEST_CASE(Minimum) { +VM_UNIT_TEST_CASE(Minimum) { EXPECT_EQ(0, Utils::Minimum(0, 1)); EXPECT_EQ(0, Utils::Minimum(1, 0)); @@ -23,7 +23,7 @@ UNIT_TEST_CASE(Minimum) { } -UNIT_TEST_CASE(Maximum) { +VM_UNIT_TEST_CASE(Maximum) { EXPECT_EQ(1, Utils::Maximum(0, 1)); EXPECT_EQ(1, Utils::Maximum(1, 0)); @@ -38,7 +38,7 @@ UNIT_TEST_CASE(Maximum) { } -UNIT_TEST_CASE(IsPowerOfTwo) { +VM_UNIT_TEST_CASE(IsPowerOfTwo) { EXPECT(!Utils::IsPowerOfTwo(0)); EXPECT(Utils::IsPowerOfTwo(1)); EXPECT(Utils::IsPowerOfTwo(2)); @@ -51,14 +51,14 @@ UNIT_TEST_CASE(IsPowerOfTwo) { } -UNIT_TEST_CASE(ShiftForPowerOfTwo) { +VM_UNIT_TEST_CASE(ShiftForPowerOfTwo) { EXPECT_EQ(1, Utils::ShiftForPowerOfTwo(2)); EXPECT_EQ(2, Utils::ShiftForPowerOfTwo(4)); EXPECT_EQ(8, Utils::ShiftForPowerOfTwo(256)); } -UNIT_TEST_CASE(IsAligned) { +VM_UNIT_TEST_CASE(IsAligned) { EXPECT(Utils::IsAligned(0, 1)); EXPECT(Utils::IsAligned(1, 1)); @@ -72,7 +72,7 @@ UNIT_TEST_CASE(IsAligned) { } -UNIT_TEST_CASE(RoundDown) { +VM_UNIT_TEST_CASE(RoundDown) { EXPECT_EQ(0, Utils::RoundDown(22, 32)); EXPECT_EQ(32, Utils::RoundDown(33, 32)); EXPECT_EQ(32, Utils::RoundDown(63, 32)); @@ -82,7 +82,7 @@ UNIT_TEST_CASE(RoundDown) { } -UNIT_TEST_CASE(RoundUp) { +VM_UNIT_TEST_CASE(RoundUp) { EXPECT_EQ(32, Utils::RoundUp(22, 32)); EXPECT_EQ(64, Utils::RoundUp(33, 32)); EXPECT_EQ(64, Utils::RoundUp(63, 32)); @@ -92,7 +92,7 @@ UNIT_TEST_CASE(RoundUp) { } -UNIT_TEST_CASE(RoundUpToPowerOfTwo) { +VM_UNIT_TEST_CASE(RoundUpToPowerOfTwo) { EXPECT_EQ(0U, Utils::RoundUpToPowerOfTwo(0)); EXPECT_EQ(1U, Utils::RoundUpToPowerOfTwo(1)); EXPECT_EQ(2U, Utils::RoundUpToPowerOfTwo(2)); @@ -106,7 +106,7 @@ UNIT_TEST_CASE(RoundUpToPowerOfTwo) { } -UNIT_TEST_CASE(CountOneBits) { +VM_UNIT_TEST_CASE(CountOneBits) { EXPECT_EQ(0, Utils::CountOneBits(0)); EXPECT_EQ(1, Utils::CountOneBits(0x00000010)); EXPECT_EQ(1, Utils::CountOneBits(0x00010000)); @@ -117,7 +117,7 @@ UNIT_TEST_CASE(CountOneBits) { } -UNIT_TEST_CASE(CountZeros) { +VM_UNIT_TEST_CASE(CountZeros) { EXPECT_EQ(0, Utils::CountTrailingZeros(0x1)); EXPECT_EQ(kBitsPerWord - 1, Utils::CountLeadingZeros(0x1)); EXPECT_EQ(1, Utils::CountTrailingZeros(0x2)); @@ -134,7 +134,7 @@ UNIT_TEST_CASE(CountZeros) { } -UNIT_TEST_CASE(IsInt) { +VM_UNIT_TEST_CASE(IsInt) { EXPECT(Utils::IsInt(8, 16)); EXPECT(Utils::IsInt(8, 127)); EXPECT(Utils::IsInt(8, -128)); @@ -150,7 +150,7 @@ UNIT_TEST_CASE(IsInt) { } -UNIT_TEST_CASE(IsUint) { +VM_UNIT_TEST_CASE(IsUint) { EXPECT(Utils::IsUint(8, 16)); EXPECT(Utils::IsUint(8, 0)); EXPECT(Utils::IsUint(8, 255)); @@ -166,7 +166,7 @@ UNIT_TEST_CASE(IsUint) { } -UNIT_TEST_CASE(IsAbsoluteUint) { +VM_UNIT_TEST_CASE(IsAbsoluteUint) { EXPECT(Utils::IsAbsoluteUint(8, 16)); EXPECT(Utils::IsAbsoluteUint(8, 0)); EXPECT(Utils::IsAbsoluteUint(8, -128)); @@ -185,7 +185,7 @@ UNIT_TEST_CASE(IsAbsoluteUint) { } -UNIT_TEST_CASE(LowBits) { +VM_UNIT_TEST_CASE(LowBits) { EXPECT_EQ(0xff00, Utils::Low16Bits(0xffff00)); EXPECT_EQ(0xff, Utils::High16Bits(0xffff00)); EXPECT_EQ(0xff00, Utils::Low32Bits(0xff0000ff00LL)); @@ -194,7 +194,7 @@ UNIT_TEST_CASE(LowBits) { } -UNIT_TEST_CASE(Endianity) { +VM_UNIT_TEST_CASE(Endianity) { uint16_t value16be = Utils::HostToBigEndian16(0xf1); EXPECT_EQ(0x0, reinterpret_cast(&value16be)[0]); EXPECT_EQ(0xf1, reinterpret_cast(&value16be)[1]); @@ -237,7 +237,7 @@ UNIT_TEST_CASE(Endianity) { } -UNIT_TEST_CASE(DoublesBitEqual) { +VM_UNIT_TEST_CASE(DoublesBitEqual) { EXPECT(Utils::DoublesBitEqual(1.0, 1.0)); EXPECT(!Utils::DoublesBitEqual(1.0, -1.0)); EXPECT(Utils::DoublesBitEqual(0.0, 0.0)); diff --git a/runtime/vm/verified_memory_test.cc b/runtime/vm/verified_memory_test.cc index 21978e71269..4ba1bdfb109 100644 --- a/runtime/vm/verified_memory_test.cc +++ b/runtime/vm/verified_memory_test.cc @@ -24,7 +24,7 @@ void Shutdown() { } -UNIT_TEST_CASE(VerifiedMemoryReserve) { +VM_UNIT_TEST_CASE(VerifiedMemoryReserve) { Init(); const intptr_t kReservationSize = 64 * KB; VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); @@ -34,7 +34,7 @@ UNIT_TEST_CASE(VerifiedMemoryReserve) { } -UNIT_TEST_CASE(VerifiedMemoryCommit) { +VM_UNIT_TEST_CASE(VerifiedMemoryCommit) { Init(); const intptr_t kReservationSize = 64 * KB; VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); @@ -45,7 +45,7 @@ UNIT_TEST_CASE(VerifiedMemoryCommit) { } -UNIT_TEST_CASE(VerifiedMemoryBasic) { +VM_UNIT_TEST_CASE(VerifiedMemoryBasic) { Init(); const intptr_t kReservationSize = 64 * KB; VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); @@ -68,7 +68,7 @@ UNIT_TEST_CASE(VerifiedMemoryBasic) { } -UNIT_TEST_CASE(VerifiedMemoryAccept) { +VM_UNIT_TEST_CASE(VerifiedMemoryAccept) { Init(); const intptr_t kReservationSize = 64 * KB; VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); @@ -90,7 +90,7 @@ UNIT_TEST_CASE(VerifiedMemoryAccept) { // Negative tests below. -UNIT_TEST_CASE(VerifyImplicit_Crash) { +VM_UNIT_TEST_CASE(VerifyImplicit_Crash) { Init(); const intptr_t kReservationSize = 64 * KB; VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); @@ -103,7 +103,7 @@ UNIT_TEST_CASE(VerifyImplicit_Crash) { } -UNIT_TEST_CASE(VerifyExplicit_Crash) { +VM_UNIT_TEST_CASE(VerifyExplicit_Crash) { Init(); const intptr_t kReservationSize = 64 * KB; VirtualMemory* vm = VerifiedMemory::Reserve(kReservationSize); diff --git a/runtime/vm/virtual_memory_test.cc b/runtime/vm/virtual_memory_test.cc index cc98c035c2a..c652f8c2b61 100644 --- a/runtime/vm/virtual_memory_test.cc +++ b/runtime/vm/virtual_memory_test.cc @@ -18,7 +18,7 @@ bool IsZero(char* begin, char* end) { } -UNIT_TEST_CASE(AllocateVirtualMemory) { +VM_UNIT_TEST_CASE(AllocateVirtualMemory) { const intptr_t kVirtualMemoryBlockSize = 64 * KB; VirtualMemory* vm = VirtualMemory::Reserve(kVirtualMemoryBlockSize); EXPECT(vm != NULL); @@ -52,7 +52,7 @@ UNIT_TEST_CASE(AllocateVirtualMemory) { } -UNIT_TEST_CASE(FreeVirtualMemory) { +VM_UNIT_TEST_CASE(FreeVirtualMemory) { // Reservations should always be handed back to OS upon destruction. const intptr_t kVirtualMemoryBlockSize = 10 * MB; const intptr_t kIterations = 900; // Enough to exhaust 32-bit address space. @@ -89,7 +89,7 @@ UNIT_TEST_CASE(FreeVirtualMemory) { } -UNIT_TEST_CASE(VirtualMemoryCommitPartial) { +VM_UNIT_TEST_CASE(VirtualMemoryCommitPartial) { const intptr_t kVirtualMemoryBlockSize = 3 * MB; VirtualMemory* vm = VirtualMemory::Reserve(kVirtualMemoryBlockSize); EXPECT(vm != NULL); diff --git a/runtime/vm/zone_test.cc b/runtime/vm/zone_test.cc index 21b50c0076c..d491e1f6bfb 100644 --- a/runtime/vm/zone_test.cc +++ b/runtime/vm/zone_test.cc @@ -10,7 +10,7 @@ namespace dart { -UNIT_TEST_CASE(AllocateZone) { +VM_UNIT_TEST_CASE(AllocateZone) { #if defined(DEBUG) FLAG_trace_zones = true; #endif @@ -72,7 +72,7 @@ UNIT_TEST_CASE(AllocateZone) { } -UNIT_TEST_CASE(AllocGeneric_Success) { +VM_UNIT_TEST_CASE(AllocGeneric_Success) { #if defined(DEBUG) FLAG_trace_zones = true; #endif @@ -96,7 +96,7 @@ UNIT_TEST_CASE(AllocGeneric_Success) { // This test is expected to crash. -UNIT_TEST_CASE(AllocGeneric_Overflow) { +VM_UNIT_TEST_CASE(AllocGeneric_Overflow) { #if defined(DEBUG) FLAG_trace_zones = true; #endif @@ -115,7 +115,7 @@ UNIT_TEST_CASE(AllocGeneric_Overflow) { } -UNIT_TEST_CASE(ZoneAllocated) { +VM_UNIT_TEST_CASE(ZoneAllocated) { #if defined(DEBUG) FLAG_trace_zones = true; #endif @@ -171,7 +171,7 @@ TEST_CASE(PrintToString) { #ifndef PRODUCT -UNIT_TEST_CASE(PrintZoneMemoryInfoToJSON) { +VM_UNIT_TEST_CASE(PrintZoneMemoryInfoToJSON) { #if defined(DEBUG) FLAG_trace_zones = true; #endif @@ -229,7 +229,7 @@ UNIT_TEST_CASE(PrintZoneMemoryInfoToJSON) { #endif -UNIT_TEST_CASE(NativeScopeZoneAllocation) { +VM_UNIT_TEST_CASE(NativeScopeZoneAllocation) { ASSERT(ApiNativeScope::Current() == NULL); ASSERT(Thread::Current() == NULL); EXPECT_EQ(0, ApiNativeScope::current_memory_usage());