[test] Move cctest/test-atomicops to unittests/

... base/atomicops-unittest.

Bug: v8:12781
Change-Id: Iac23576cca9c50c2281a2d7e781dde4750e54c03
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3711344
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#81394}
This commit is contained in:
jameslahm 2022-06-18 17:03:46 +08:00 committed by V8 LUCI CQ
parent 114a03ac82
commit 471e739b93
3 changed files with 13 additions and 26 deletions

View File

@ -173,7 +173,6 @@ v8_source_set("cctest_sources") {
"test-api-typed-array.cc",
"test-api.cc",
"test-api.h",
"test-atomicops.cc",
"test-code-stub-assembler.cc",
"test-constantpool.cc",
"test-cpu-profiler.cc",

View File

@ -224,6 +224,7 @@ v8_source_set("unittests_sources") {
"api/v8-script-unittest.cc",
"base/address-region-unittest.cc",
"base/atomic-utils-unittest.cc",
"base/atomicops-unittest.cc",
"base/bignum-dtoa-unittest.cc",
"base/bignum-unittest.cc",
"base/bits-unittest.cc",

View File

@ -25,10 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "src/init/v8.h"
#include "src/base/atomicops.h"
#include "test/cctest/cctest.h"
#include "src/init/v8.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace base {
@ -38,7 +39,6 @@ namespace base {
#define NUM_BITS(T) (sizeof(T) * 8)
template <class AtomicType>
static void TestAtomicIncrement() {
// For now, we just test the single-threaded execution.
@ -107,7 +107,6 @@ static void TestAtomicIncrement() {
CHECK_EQU(s.next_word, next_word_value);
}
template <class AtomicType>
static void TestCompareAndSwap() {
AtomicType value = 0;
@ -130,7 +129,6 @@ static void TestCompareAndSwap() {
CHECK_EQU(k_test_val, prev);
}
template <class AtomicType>
static void TestAtomicExchange() {
AtomicType value = 0;
@ -153,7 +151,6 @@ static void TestAtomicExchange() {
CHECK_EQU(k_test_val, new_value);
}
template <class AtomicType>
static void TestAtomicIncrementBounds() {
// Test at 32-bit boundary for 64-bit atomic type.
@ -176,7 +173,6 @@ static AtomicType TestFillValue() {
return val;
}
// This is a simple sanity check to ensure that values are correct.
// Not testing atomicity.
template <class AtomicType>
@ -197,7 +193,6 @@ static void TestStore() {
CHECK_EQU(kVal2, value);
}
// Merge this test with TestStore as soon as we have Atomic8 acquire
// and release stores.
static void TestStoreAtomic8() {
@ -212,7 +207,6 @@ static void TestStoreAtomic8() {
CHECK_EQU(kVal2, value);
}
// This is a simple sanity check to ensure that values are correct.
// Not testing atomicity.
template <class AtomicType>
@ -233,7 +227,6 @@ static void TestLoad() {
CHECK_EQU(kVal2, Acquire_Load(&value));
}
// Merge this test with TestLoad as soon as we have Atomic8 acquire
// and release loads.
static void TestLoadAtomic8() {
@ -248,45 +241,39 @@ static void TestLoadAtomic8() {
CHECK_EQU(kVal2, Relaxed_Load(&value));
}
TEST(AtomicIncrement) {
TEST(Atomicops, AtomicIncrement) {
TestAtomicIncrement<Atomic32>();
TestAtomicIncrement<AtomicWord>();
}
TEST(CompareAndSwap) {
TEST(Atomicops, CompareAndSwap) {
TestCompareAndSwap<Atomic32>();
TestCompareAndSwap<AtomicWord>();
}
TEST(AtomicExchange) {
TEST(Atomicops, AtomicExchange) {
TestAtomicExchange<Atomic32>();
TestAtomicExchange<AtomicWord>();
}
TEST(AtomicIncrementBounds) {
TEST(Atomicops, AtomicIncrementBounds) {
TestAtomicIncrementBounds<Atomic32>();
TestAtomicIncrementBounds<AtomicWord>();
}
TEST(Store) {
TEST(Atomicops, Store) {
TestStoreAtomic8();
TestStore<Atomic32>();
TestStore<AtomicWord>();
}
TEST(Load) {
TEST(Atomicops, Load) {
TestLoadAtomic8();
TestLoad<Atomic32>();
TestLoad<AtomicWord>();
}
TEST(Relaxed_Memmove) {
TEST(Atomicops, Relaxed_Memmove) {
constexpr size_t kLen = 6;
Atomic8 arr[kLen];
{
@ -303,7 +290,7 @@ TEST(Relaxed_Memmove) {
}
}
TEST(Relaxed_Memcmp) {
TEST(Atomicops, Relaxed_Memcmp) {
constexpr size_t kLen = 50;
Atomic8 arr1[kLen];
Atomic8 arr1_same[kLen];