Skip to content

Commit

Permalink
8318525: Atomic gtest should run as TEST_VM to access VM capabilities
Browse files Browse the repository at this point in the history
Reviewed-by: stefank, stuefe
  • Loading branch information
shipilev committed Oct 20, 2023
1 parent 8099261 commit 744f206
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions test/hotspot/gtest/runtime/test_atomic.cpp
Expand Up @@ -53,22 +53,22 @@ struct AtomicAddTestSupport {
}
};

TEST(AtomicAddTest, int32) {
TEST_VM(AtomicAddTest, int32) {
using Support = AtomicAddTestSupport<int32_t>;
Support().test_add();
Support().test_fetch_add();
}

// 64bit Atomic::add is only supported on 64bit platforms.
#ifdef _LP64
TEST(AtomicAddTest, int64) {
TEST_VM(AtomicAddTest, int64) {
using Support = AtomicAddTestSupport<int64_t>;
Support().test_add();
Support().test_fetch_add();
}
#endif // _LP64

TEST(AtomicAddTest, ptr) {
TEST_VM(AtomicAddTest, ptr) {
uint _test_values[10] = {};
uint* volatile _test_value{};

Expand Down Expand Up @@ -103,14 +103,14 @@ struct AtomicXchgTestSupport {
}
};

TEST(AtomicXchgTest, int32) {
TEST_VM(AtomicXchgTest, int32) {
using Support = AtomicXchgTestSupport<int32_t>;
Support().test();
}

// 64bit Atomic::xchg is only supported on 64bit platforms.
#ifdef _LP64
TEST(AtomicXchgTest, int64) {
TEST_VM(AtomicXchgTest, int64) {
using Support = AtomicXchgTestSupport<int64_t>;
Support().test();
}
Expand All @@ -136,12 +136,12 @@ struct AtomicCmpxchgTestSupport {
}
};

TEST(AtomicCmpxchgTest, int32) {
TEST_VM(AtomicCmpxchgTest, int32) {
using Support = AtomicCmpxchgTestSupport<int32_t>;
Support().test();
}

TEST(AtomicCmpxchgTest, int64) {
TEST_VM(AtomicCmpxchgTest, int64) {
using Support = AtomicCmpxchgTestSupport<int64_t>;
Support().test();
}
Expand Down Expand Up @@ -186,7 +186,7 @@ struct AtomicCmpxchg1ByteStressSupport {
}
};

TEST(AtomicCmpxchg1Byte, stress) {
TEST_VM(AtomicCmpxchg1Byte, stress) {
AtomicCmpxchg1ByteStressSupport support;
support.test();
}
Expand Down Expand Up @@ -224,7 +224,7 @@ namespace AtomicEnumTestUnscoped { // Scope the enumerators.
enum TestEnum { A, B, C };
}

TEST(AtomicEnumTest, unscoped_enum) {
TEST_VM(AtomicEnumTest, unscoped_enum) {
using namespace AtomicEnumTestUnscoped;
using Support = AtomicEnumTestSupport<TestEnum>;

Expand All @@ -235,7 +235,7 @@ TEST(AtomicEnumTest, unscoped_enum) {

enum class AtomicEnumTestScoped { A, B, C };

TEST(AtomicEnumTest, scoped_enum) {
TEST_VM(AtomicEnumTest, scoped_enum) {
const AtomicEnumTestScoped B = AtomicEnumTestScoped::B;
const AtomicEnumTestScoped C = AtomicEnumTestScoped::C;
using Support = AtomicEnumTestSupport<AtomicEnumTestScoped>;
Expand Down Expand Up @@ -329,28 +329,28 @@ const T AtomicBitopsTestSupport<T>::_old_value;
template<typename T>
const T AtomicBitopsTestSupport<T>::_change_value;

TEST(AtomicBitopsTest, int8) {
TEST_VM(AtomicBitopsTest, int8) {
AtomicBitopsTestSupport<int8_t>()();
}

TEST(AtomicBitopsTest, uint8) {
TEST_VM(AtomicBitopsTest, uint8) {
AtomicBitopsTestSupport<uint8_t>()();
}

TEST(AtomicBitopsTest, int32) {
TEST_VM(AtomicBitopsTest, int32) {
AtomicBitopsTestSupport<int32_t>()();
}

TEST(AtomicBitopsTest, uint32) {
TEST_VM(AtomicBitopsTest, uint32) {
AtomicBitopsTestSupport<uint32_t>()();
}

#ifdef _LP64
TEST(AtomicBitopsTest, int64) {
TEST_VM(AtomicBitopsTest, int64) {
AtomicBitopsTestSupport<int64_t>()();
}

TEST(AtomicBitopsTest, uint64) {
TEST_VM(AtomicBitopsTest, uint64) {
AtomicBitopsTestSupport<uint64_t>()();
}
#endif // _LP64

3 comments on commit 744f206

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shipilev
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u

@openjdk
Copy link

@openjdk openjdk bot commented on 744f206 Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shipilev Could not automatically backport 744f206f to openjdk/jdk21u due to conflicts in the following files:

  • test/hotspot/gtest/runtime/test_atomic.cpp

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk21u. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk21u.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b shipilev-backport-744f206f

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git 744f206fefb7e2eff17737a34da264f2eebbae09

# Backport the commit
$ git cherry-pick --no-commit 744f206fefb7e2eff17737a34da264f2eebbae09
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 744f206fefb7e2eff17737a34da264f2eebbae09'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk21u with the title Backport 744f206fefb7e2eff17737a34da264f2eebbae09.

Please sign in to comment.