Commit 9d12255c authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[test] Move cctest/test-managed to unittests/objects/

... managed-unittest.

Bug: v8:12781
Change-Id: Ic9dea14ffd0f8ca944c39d791c2b66aa1f76bcfe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3682881Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#80882}
parent a9a44a31
...@@ -210,7 +210,6 @@ v8_source_set("cctest_sources") { ...@@ -210,7 +210,6 @@ v8_source_set("cctest_sources") {
"test-liveedit.cc", "test-liveedit.cc",
"test-local-handles.cc", "test-local-handles.cc",
"test-lockers.cc", "test-lockers.cc",
"test-managed.cc",
"test-mementos.cc", "test-mementos.cc",
"test-orderedhashtable.cc", "test-orderedhashtable.cc",
"test-parsing.cc", "test-parsing.cc",
......
...@@ -794,7 +794,6 @@ ...@@ -794,7 +794,6 @@
'test-heap/Regress538257': [SKIP], 'test-heap/Regress538257': [SKIP],
'test-heap/ReinitializeStringHashSeed': [SKIP], 'test-heap/ReinitializeStringHashSeed': [SKIP],
'test-lockers/*': [SKIP], 'test-lockers/*': [SKIP],
'test-managed/*': [SKIP],
'test-mark-compact/RegressJoinThreadsOnIsolateDeinit': [SKIP], 'test-mark-compact/RegressJoinThreadsOnIsolateDeinit': [SKIP],
'test-memory-measurement/RandomizedTimeout': [SKIP], 'test-memory-measurement/RandomizedTimeout': [SKIP],
'test-random-number-generator/*': [SKIP], 'test-random-number-generator/*': [SKIP],
...@@ -1055,7 +1054,6 @@ ...@@ -1055,7 +1054,6 @@
'test-heap/WeakMapInPolymorphicStoreIC': [SKIP], 'test-heap/WeakMapInPolymorphicStoreIC': [SKIP],
'test-js-weak-refs/TestJSWeakRef': [SKIP], 'test-js-weak-refs/TestJSWeakRef': [SKIP],
'test-js-weak-refs/TestJSWeakRefKeepDuringJob': [SKIP], 'test-js-weak-refs/TestJSWeakRefKeepDuringJob': [SKIP],
'test-managed/GCCausesDestruction': [SKIP],
'test-run-wasm/RunWasmInterpreter_I32AddOnDifferentRegisters': [SKIP], 'test-run-wasm/RunWasmInterpreter_I32AddOnDifferentRegisters': [SKIP],
'test-run-wasm/RunWasmInterpreter_I32DivSOnDifferentRegisters': [SKIP], 'test-run-wasm/RunWasmInterpreter_I32DivSOnDifferentRegisters': [SKIP],
'test-run-wasm/RunWasmInterpreter_I32DivUOnDifferentRegisters': [SKIP], 'test-run-wasm/RunWasmInterpreter_I32DivUOnDifferentRegisters': [SKIP],
......
...@@ -411,6 +411,7 @@ v8_source_set("unittests_sources") { ...@@ -411,6 +411,7 @@ v8_source_set("unittests_sources") {
"objects/concurrent-string-unittest.cc", "objects/concurrent-string-unittest.cc",
"objects/concurrent-transition-array-unittest.cc", "objects/concurrent-transition-array-unittest.cc",
"objects/elements-kind-unittest.cc", "objects/elements-kind-unittest.cc",
"objects/managed-unittest.cc",
"objects/modules-unittest.cc", "objects/modules-unittest.cc",
"objects/object-unittest.cc", "objects/object-unittest.cc",
"objects/representation-unittest.cc", "objects/representation-unittest.cc",
......
...@@ -8,11 +8,14 @@ ...@@ -8,11 +8,14 @@
#include "src/objects/managed-inl.h" #include "src/objects/managed-inl.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
#include "test/cctest/cctest.h" #include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
using ManagedTest = TestWithIsolate;
class DeleteCounter { class DeleteCounter {
public: public:
explicit DeleteCounter(int* deleted) : deleted_(deleted) { *deleted_ = 0; } explicit DeleteCounter(int* deleted) : deleted_(deleted) { *deleted_ = 0; }
...@@ -25,19 +28,18 @@ class DeleteCounter { ...@@ -25,19 +28,18 @@ class DeleteCounter {
int* deleted_; int* deleted_;
}; };
TEST(GCCausesDestruction) { TEST_F(ManagedTest, GCCausesDestruction) {
Isolate* isolate = CcTest::InitIsolateOnce();
int deleted1 = 0; int deleted1 = 0;
int deleted2 = 0; int deleted2 = 0;
DeleteCounter* d1 = new DeleteCounter(&deleted1); DeleteCounter* d1 = new DeleteCounter(&deleted1);
DeleteCounter* d2 = new DeleteCounter(&deleted2); DeleteCounter* d2 = new DeleteCounter(&deleted2);
{ {
HandleScope scope(isolate); HandleScope scope(isolate());
auto handle = Managed<DeleteCounter>::FromRawPtr(isolate, 0, d1); auto handle = Managed<DeleteCounter>::FromRawPtr(isolate(), 0, d1);
USE(handle); USE(handle);
} }
CcTest::CollectAllAvailableGarbage(); CollectAllAvailableGarbage();
CHECK_EQ(1, deleted1); CHECK_EQ(1, deleted1);
CHECK_EQ(0, deleted2); CHECK_EQ(0, deleted2);
...@@ -45,10 +47,9 @@ TEST(GCCausesDestruction) { ...@@ -45,10 +47,9 @@ TEST(GCCausesDestruction) {
CHECK_EQ(1, deleted2); CHECK_EQ(1, deleted2);
} }
TEST(DisposeCausesDestruction1) { TEST_F(ManagedTest, DisposeCausesDestruction1) {
v8::Isolate::CreateParams create_params; v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
CcTest::InitIsolateOnce()->array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params); v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
...@@ -65,10 +66,9 @@ TEST(DisposeCausesDestruction1) { ...@@ -65,10 +66,9 @@ TEST(DisposeCausesDestruction1) {
CHECK_EQ(1, deleted1); CHECK_EQ(1, deleted1);
} }
TEST(DisposeCausesDestruction2) { TEST_F(ManagedTest, DisposeCausesDestruction2) {
v8::Isolate::CreateParams create_params; v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
CcTest::InitIsolateOnce()->array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params); v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
...@@ -92,10 +92,9 @@ TEST(DisposeCausesDestruction2) { ...@@ -92,10 +92,9 @@ TEST(DisposeCausesDestruction2) {
CHECK_EQ(1, deleted2); CHECK_EQ(1, deleted2);
} }
TEST(DisposeWithAnotherSharedPtr) { TEST_F(ManagedTest, DisposeWithAnotherSharedPtr) {
v8::Isolate::CreateParams create_params; v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
CcTest::InitIsolateOnce()->array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params); v8::Isolate* isolate = v8::Isolate::New(create_params);
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
...@@ -118,10 +117,9 @@ TEST(DisposeWithAnotherSharedPtr) { ...@@ -118,10 +117,9 @@ TEST(DisposeWithAnotherSharedPtr) {
CHECK_EQ(1, deleted1); CHECK_EQ(1, deleted1);
} }
TEST(DisposeAcrossIsolates) { TEST_F(ManagedTest, DisposeAcrossIsolates) {
v8::Isolate::CreateParams create_params; v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
CcTest::InitIsolateOnce()->array_buffer_allocator();
int deleted = 0; int deleted = 0;
DeleteCounter* delete_counter = new DeleteCounter(&deleted); DeleteCounter* delete_counter = new DeleteCounter(&deleted);
...@@ -153,10 +151,9 @@ TEST(DisposeAcrossIsolates) { ...@@ -153,10 +151,9 @@ TEST(DisposeAcrossIsolates) {
CHECK_EQ(1, deleted); CHECK_EQ(1, deleted);
} }
TEST(CollectAcrossIsolates) { TEST_F(ManagedTest, CollectAcrossIsolates) {
v8::Isolate::CreateParams create_params; v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
CcTest::InitIsolateOnce()->array_buffer_allocator();
int deleted = 0; int deleted = 0;
DeleteCounter* delete_counter = new DeleteCounter(&deleted); DeleteCounter* delete_counter = new DeleteCounter(&deleted);
......
...@@ -173,11 +173,14 @@ ...@@ -173,11 +173,14 @@
'ValueSerializerTest.DecodeArrayBufferOOM': [SKIP], 'ValueSerializerTest.DecodeArrayBufferOOM': [SKIP],
'LogExternalLogEventListenerInnerFunctionTest.ExternalLogEventListenerInnerFunctions': [SKIP], 'LogExternalLogEventListenerInnerFunctionTest.ExternalLogEventListenerInnerFunctions': [SKIP],
'LogInterpretedFramesNativeStackWithSerializationTest.LogInterpretedFramesNativeStackWithSerialization': [SKIP], 'LogInterpretedFramesNativeStackWithSerializationTest.LogInterpretedFramesNativeStackWithSerialization': [SKIP],
'ManagedTest.*': [SKIP],
# Performs GC # Performs GC
'APIExceptionTest.ExceptionMessageDoesNotKeepContextAlive': [SKIP], 'APIExceptionTest.ExceptionMessageDoesNotKeepContextAlive': [SKIP],
'LocalHeapTest.GCEpilogue': [SKIP], 'LocalHeapTest.GCEpilogue': [SKIP],
'UnifiedHeapDetachedTest.AllocationBeforeConfigureHeap': [SKIP], 'UnifiedHeapDetachedTest.AllocationBeforeConfigureHeap': [SKIP],
'UnifiedHeapTest.FindingV8ToBlinkReference': [SKIP], 'UnifiedHeapTest.FindingV8ToBlinkReference': [SKIP],
'ManagedTest.GCCausesDestruction': [SKIP],
# CodeRange tests # CodeRange tests
'CodePagesTest.LargeCodeObjectWithSignalHandler': [SKIP], 'CodePagesTest.LargeCodeObjectWithSignalHandler': [SKIP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment