RFR (XS) 8217321: [TESTBUG] utilities/test_globalDefinitions.cpp should use _LP64, not LP64
Aleksey Shipilev
shade at redhat.com
Thu Jan 17 23:20:12 UTC 2019
On 1/17/19 11:12 PM, David Holmes wrote:
> When we build hotspot we set LP64 (whereas _LP64 presumably comes from the compiler). Shouldn't the
> gtests get compiled with the same flags as the product code?
Yes, I think so, and that is what happens here? Everywhere else in Hotspot we use "#ifdef _LP64",
and this patch makes use of the same in gtests as well.
I already pushed the patch under triviality rule , and this is current jdk/jdk:
$ ack "ifdef LP64" src/hotspot/ | wc -l
0
$ ack "ifdef _LP64" src/hotspot/ | wc -l
523
$ ack "ifdef LP64" test/hotspot/ | wc -l
0
$ ack "ifdef _LP64" test/hotspot/ | wc -l
3
Anyhow, if you revert the check to old (broken) thing, then gtest would not run the block on my
Linux x86_64, while it should. This is the same head-scratcher I had when debugging the test in
JDK-8217315. Look:
$ vi ...
:wq
$ hg diff
diff -r 61b6e5a0b321 test/hotspot/gtest/utilities/test_globalDefinitions.cpp
--- a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp Thu Jan 17 20:35:43 2019 +0100
+++ b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp Fri Jan 18 00:17:16 2019 +0100
@@ -124,6 +124,7 @@
EXPECT_EQ(M + 1, byte_size_in_exact_unit(M + 1));
EXPECT_EQ(K + 1, byte_size_in_exact_unit(M + K));
#ifdef _LP64
+ ShouldNotReachHere();
EXPECT_EQ(G - 1, byte_size_in_exact_unit(G - 1));
EXPECT_EQ(1u, byte_size_in_exact_unit(G));
EXPECT_EQ(G + 1, byte_size_in_exact_unit(G + 1));
$ CONF=linux-x86_64-server-fastdebug make images run-test TEST=gtest:globalDefinitions
<TEST FAILED with ShouldNotReachHere()>
$ vi ...
:wq
$ hg diff
diff -r 61b6e5a0b321 test/hotspot/gtest/utilities/test_globalDefinitions.cpp
--- a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp Thu Jan 17 20:35:43 2019 +0100
+++ b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp Fri Jan 18 00:16:05 2019 +0100
@@ -123,7 +123,8 @@
EXPECT_EQ(1u, byte_size_in_exact_unit(M));
EXPECT_EQ(M + 1, byte_size_in_exact_unit(M + 1));
EXPECT_EQ(K + 1, byte_size_in_exact_unit(M + K));
-#ifdef _LP64
+#ifdef LP64
+ ShouldNotReachHere();
EXPECT_EQ(G - 1, byte_size_in_exact_unit(G - 1));
EXPECT_EQ(1u, byte_size_in_exact_unit(G));
EXPECT_EQ(G + 1, byte_size_in_exact_unit(G + 1));
$ CONF=linux-x86_64-server-fastdebug make images run-test TEST=gtest:globalDefinitions
<TEST SUCCESS> <--- Say what.
-Aleksey
More information about the hotspot-dev
mailing list