| Index: runtime/vm/unit_test.h
|
| diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
|
| index a8b063a2b6c8df56febdb2779c2e75da9e224a64..8e6267ee413e822832173d2298d2fb32960fb2ab 100644
|
| --- a/runtime/vm/unit_test.h
|
| +++ b/runtime/vm/unit_test.h
|
| @@ -27,8 +27,29 @@
|
| 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
|
| +// 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) \
|
| + static void Dart_TestHelper##name(Thread* thread); \
|
| + UNIT_TEST_CASE(name) \
|
| + { \
|
| + TestIsolateScope __test_isolate__; \
|
| + Thread* __thread__ = Thread::Current(); \
|
| + ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \
|
| + TransitionNativeToVM transition(__thread__); \
|
| + StackZone __zone__(__thread__); \
|
| + HandleScope __hs__(__thread__); \
|
| + Dart_TestHelper##name(__thread__); \
|
| + } \
|
| + static void Dart_TestHelper##name(Thread* thread)
|
| +
|
| // The TEST_CASE macro is used for tests that need an isolate and zone
|
| -// in order to test its functionality.
|
| +// in order to test its functionality. This macro is used for tests that
|
| +// are implemented using the Dart API for calling into the VM. The safepoint
|
| +// execution state of threads using this macro remains kThreadNative.
|
| #define TEST_CASE(name) \
|
| static void Dart_TestHelper##name(Thread* thread); \
|
| UNIT_TEST_CASE(name) \
|
| @@ -57,7 +78,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); \
|
| - TEST_CASE(name) { \
|
| + VM_TEST_CASE(name) { \
|
| Assembler __assembler__; \
|
| AssemblerTest test(""#name, &__assembler__); \
|
| AssemblerTestGenerate##name(test.assembler()); \
|
| @@ -80,7 +101,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); \
|
| - TEST_CASE(name) { \
|
| + VM_TEST_CASE(name) { \
|
| CodeGenTest __test__(""#name); \
|
| CodeGenTestGenerate##name(&__test__); \
|
| __test__.Compile(); \
|
| @@ -100,7 +121,7 @@
|
| // and evaluate its result.
|
| #define CODEGEN_TEST_RAW_RUN(name, function) \
|
| static void CodeGenTestRun##name(const Function& function); \
|
| - TEST_CASE(name) { \
|
| + VM_TEST_CASE(name) { \
|
| CodeGenTest __test__(""#name); \
|
| CodeGenTestGenerate##name(&__test__); \
|
| __test__.Compile(); \
|
| @@ -113,7 +134,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); \
|
| - TEST_CASE(name1) { \
|
| + VM_TEST_CASE(name1) { \
|
| /* Generate code for name2 */ \
|
| CodeGenTest __test2__(""#name2); \
|
| CodeGenTestGenerate##name2(&__test2__); \
|
|
|