Commit 6faa6d55 authored by jameslahm's avatar jameslahm Committed by V8 LUCI CQ

[test] Move cctest/test-roots to unittests

... /objects/roots-unittest.

Bug: v8:12781
Change-Id: Id76a0e1ffaea18849866fa0f55c9a056dbdf6e2b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3612670
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80579}
parent 3ac00bff
......@@ -229,7 +229,6 @@ v8_source_set("cctest_sources") {
"test-property-details.cc",
"test-ptr-compr-cage.cc",
"test-random-number-generator.cc",
"test-roots.cc",
"test-sampler-api.cc",
"test-serialize.cc",
"test-shared-strings.cc",
......
......@@ -759,9 +759,6 @@
# Read data from read_only_space->pages()
'test-serialize/CodeSerializerExternalScriptName': [SKIP],
'test-serialize/CodeSerializerThreeBigStrings': [SKIP],
# Access chunk metadata
'test-roots/TestHeapRootsNotReadOnly': [SKIP],
'test-roots/TestReadOnlyRoots': [SKIP],
# Requires heap::SimulateFullSpace
'test-invalidated-slots/InvalidatedSlotsAfterTrimming': [SKIP],
'test-invalidated-slots/InvalidatedSlotsAllInvalidatedRanges': [SKIP],
......
......@@ -404,6 +404,7 @@ v8_source_set("unittests_sources") {
"objects/modules-unittest.cc",
"objects/object-unittest.cc",
"objects/representation-unittest.cc",
"objects/roots-unittest.cc",
"objects/swiss-hash-table-helpers-unittest.cc",
"objects/value-serializer-unittest.cc",
"objects/weakarraylist-unittest.cc",
......
......@@ -9,11 +9,14 @@
#include "src/objects/feedback-cell.h"
#include "src/objects/script.h"
#include "src/roots/roots-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 RootsTest = TestWithIsolate;
namespace {
AllocationSpace GetSpaceFromObject(Object object) {
DCHECK(object.IsHeapObject());
......@@ -30,8 +33,8 @@ AllocationSpace GetSpaceFromObject(Object object) {
// The following tests check that all the roots accessible via ReadOnlyRoots are
// in RO_SPACE.
TEST(TestReadOnlyRoots) {
ReadOnlyRoots roots(CcTest::i_isolate());
TEST_F(RootsTest, TestReadOnlyRoots) {
ReadOnlyRoots roots(i_isolate());
READ_ONLY_ROOT_LIST(CHECK_IN_RO_SPACE)
}
......@@ -75,16 +78,16 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) {
Handle<Object> name = factory->name(); \
CHECK_EQ(*name, heap->name()); \
if (name->IsHeapObject() && IsInitiallyMutable(factory, name.address()) && \
!name->IsUndefined(CcTest::i_isolate())) { \
!name->IsUndefined(i_isolate())) { \
CHECK_NE(RO_SPACE, GetSpaceFromObject(HeapObject::cast(*name))); \
}
// The following tests check that all the roots accessible via public Heap
// accessors are not in RO_SPACE with the exception of the objects listed in
// INITIALLY_READ_ONLY_ROOT_LIST.
TEST(TestHeapRootsNotReadOnly) {
Factory* factory = CcTest::i_isolate()->factory();
Heap* heap = CcTest::i_isolate()->heap();
TEST_F(RootsTest, TestHeapRootsNotReadOnly) {
Factory* factory = i_isolate()->factory();
Heap* heap = i_isolate()->heap();
MUTABLE_ROOT_LIST(CHECK_NOT_IN_RO_SPACE)
}
......
......@@ -177,6 +177,9 @@
'CodePagesTest.Sorted': [SKIP],
'CodePagesTest.CodeRangeCorrectContents': [SKIP],
# Access chunk metadata
'RootsTest.TestHeapRootsNotReadOnly': [SKIP],
'RootsTest.TestReadOnlyRoots': [SKIP],
}], # third_party_heap
##############################################################################
......
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