[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/+/3682881 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: 王澳 <wangao.james@bytedance.com> Cr-Commit-Position: refs/heads/main@{#80882}
This commit is contained in:
parent
a9a44a3126
commit
9d12255c1e
@ -210,7 +210,6 @@ v8_source_set("cctest_sources") {
|
||||
"test-liveedit.cc",
|
||||
"test-local-handles.cc",
|
||||
"test-lockers.cc",
|
||||
"test-managed.cc",
|
||||
"test-mementos.cc",
|
||||
"test-orderedhashtable.cc",
|
||||
"test-parsing.cc",
|
||||
|
@ -794,7 +794,6 @@
|
||||
'test-heap/Regress538257': [SKIP],
|
||||
'test-heap/ReinitializeStringHashSeed': [SKIP],
|
||||
'test-lockers/*': [SKIP],
|
||||
'test-managed/*': [SKIP],
|
||||
'test-mark-compact/RegressJoinThreadsOnIsolateDeinit': [SKIP],
|
||||
'test-memory-measurement/RandomizedTimeout': [SKIP],
|
||||
'test-random-number-generator/*': [SKIP],
|
||||
@ -1055,7 +1054,6 @@
|
||||
'test-heap/WeakMapInPolymorphicStoreIC': [SKIP],
|
||||
'test-js-weak-refs/TestJSWeakRef': [SKIP],
|
||||
'test-js-weak-refs/TestJSWeakRefKeepDuringJob': [SKIP],
|
||||
'test-managed/GCCausesDestruction': [SKIP],
|
||||
'test-run-wasm/RunWasmInterpreter_I32AddOnDifferentRegisters': [SKIP],
|
||||
'test-run-wasm/RunWasmInterpreter_I32DivSOnDifferentRegisters': [SKIP],
|
||||
'test-run-wasm/RunWasmInterpreter_I32DivUOnDifferentRegisters': [SKIP],
|
||||
|
@ -411,6 +411,7 @@ v8_source_set("unittests_sources") {
|
||||
"objects/concurrent-string-unittest.cc",
|
||||
"objects/concurrent-transition-array-unittest.cc",
|
||||
"objects/elements-kind-unittest.cc",
|
||||
"objects/managed-unittest.cc",
|
||||
"objects/modules-unittest.cc",
|
||||
"objects/object-unittest.cc",
|
||||
"objects/representation-unittest.cc",
|
||||
|
@ -8,11 +8,14 @@
|
||||
|
||||
#include "src/objects/managed-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 internal {
|
||||
|
||||
using ManagedTest = TestWithIsolate;
|
||||
|
||||
class DeleteCounter {
|
||||
public:
|
||||
explicit DeleteCounter(int* deleted) : deleted_(deleted) { *deleted_ = 0; }
|
||||
@ -25,19 +28,18 @@ class DeleteCounter {
|
||||
int* deleted_;
|
||||
};
|
||||
|
||||
TEST(GCCausesDestruction) {
|
||||
Isolate* isolate = CcTest::InitIsolateOnce();
|
||||
TEST_F(ManagedTest, GCCausesDestruction) {
|
||||
int deleted1 = 0;
|
||||
int deleted2 = 0;
|
||||
DeleteCounter* d1 = new DeleteCounter(&deleted1);
|
||||
DeleteCounter* d2 = new DeleteCounter(&deleted2);
|
||||
{
|
||||
HandleScope scope(isolate);
|
||||
auto handle = Managed<DeleteCounter>::FromRawPtr(isolate, 0, d1);
|
||||
HandleScope scope(isolate());
|
||||
auto handle = Managed<DeleteCounter>::FromRawPtr(isolate(), 0, d1);
|
||||
USE(handle);
|
||||
}
|
||||
|
||||
CcTest::CollectAllAvailableGarbage();
|
||||
CollectAllAvailableGarbage();
|
||||
|
||||
CHECK_EQ(1, deleted1);
|
||||
CHECK_EQ(0, deleted2);
|
||||
@ -45,10 +47,9 @@ TEST(GCCausesDestruction) {
|
||||
CHECK_EQ(1, deleted2);
|
||||
}
|
||||
|
||||
TEST(DisposeCausesDestruction1) {
|
||||
TEST_F(ManagedTest, DisposeCausesDestruction1) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator =
|
||||
CcTest::InitIsolateOnce()->array_buffer_allocator();
|
||||
create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
|
||||
|
||||
v8::Isolate* isolate = v8::Isolate::New(create_params);
|
||||
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
@ -65,10 +66,9 @@ TEST(DisposeCausesDestruction1) {
|
||||
CHECK_EQ(1, deleted1);
|
||||
}
|
||||
|
||||
TEST(DisposeCausesDestruction2) {
|
||||
TEST_F(ManagedTest, DisposeCausesDestruction2) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator =
|
||||
CcTest::InitIsolateOnce()->array_buffer_allocator();
|
||||
create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
|
||||
|
||||
v8::Isolate* isolate = v8::Isolate::New(create_params);
|
||||
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
@ -92,10 +92,9 @@ TEST(DisposeCausesDestruction2) {
|
||||
CHECK_EQ(1, deleted2);
|
||||
}
|
||||
|
||||
TEST(DisposeWithAnotherSharedPtr) {
|
||||
TEST_F(ManagedTest, DisposeWithAnotherSharedPtr) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator =
|
||||
CcTest::InitIsolateOnce()->array_buffer_allocator();
|
||||
create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
|
||||
|
||||
v8::Isolate* isolate = v8::Isolate::New(create_params);
|
||||
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
@ -118,10 +117,9 @@ TEST(DisposeWithAnotherSharedPtr) {
|
||||
CHECK_EQ(1, deleted1);
|
||||
}
|
||||
|
||||
TEST(DisposeAcrossIsolates) {
|
||||
TEST_F(ManagedTest, DisposeAcrossIsolates) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator =
|
||||
CcTest::InitIsolateOnce()->array_buffer_allocator();
|
||||
create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
|
||||
|
||||
int deleted = 0;
|
||||
DeleteCounter* delete_counter = new DeleteCounter(&deleted);
|
||||
@ -153,10 +151,9 @@ TEST(DisposeAcrossIsolates) {
|
||||
CHECK_EQ(1, deleted);
|
||||
}
|
||||
|
||||
TEST(CollectAcrossIsolates) {
|
||||
TEST_F(ManagedTest, CollectAcrossIsolates) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator =
|
||||
CcTest::InitIsolateOnce()->array_buffer_allocator();
|
||||
create_params.array_buffer_allocator = isolate()->array_buffer_allocator();
|
||||
|
||||
int deleted = 0;
|
||||
DeleteCounter* delete_counter = new DeleteCounter(&deleted);
|
@ -173,11 +173,14 @@
|
||||
'ValueSerializerTest.DecodeArrayBufferOOM': [SKIP],
|
||||
'LogExternalLogEventListenerInnerFunctionTest.ExternalLogEventListenerInnerFunctions': [SKIP],
|
||||
'LogInterpretedFramesNativeStackWithSerializationTest.LogInterpretedFramesNativeStackWithSerialization': [SKIP],
|
||||
'ManagedTest.*': [SKIP],
|
||||
|
||||
# Performs GC
|
||||
'APIExceptionTest.ExceptionMessageDoesNotKeepContextAlive': [SKIP],
|
||||
'LocalHeapTest.GCEpilogue': [SKIP],
|
||||
'UnifiedHeapDetachedTest.AllocationBeforeConfigureHeap': [SKIP],
|
||||
'UnifiedHeapTest.FindingV8ToBlinkReference': [SKIP],
|
||||
'ManagedTest.GCCausesDestruction': [SKIP],
|
||||
|
||||
# CodeRange tests
|
||||
'CodePagesTest.LargeCodeObjectWithSignalHandler': [SKIP],
|
||||
|
Loading…
Reference in New Issue
Block a user