Gtest: CreateVM is not called when isolated tests are run?

Thomas Stüfe thomas.stuefe at gmail.com
Wed Dec 7 10:52:43 UTC 2016


Hi all,

I am writing a metaspace-related gtest and was noticing my test to assert
in Thread::current() because the test thread was not attached to the VM.
When executed together with all other tests, it works.

Some other tests are affected as well, e.g. LogStream tests:

./hotspot/variant-server/libjvm/gtest/gtestLauncher.exe -jdk ./images/jdk/
--gtest_filter=LogStream*

[ RUN      ] LogStreamTest.from_log
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=\runtime/thread.hpp:662
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error
(c:\d031900\openjdk\jdk9-hs2\source\hotspot\src\share\vm\runtime/thread.hpp:662),
pid=17512, tid=7260
#  assert(current != 0LL) failed: Thread::current() called on detached
thread

Did anyone else notice this behaviour?

I see that when I run all tests (when omitting the filter argument),
Thread::create_vm is called, but not when the test is run isolated. So, the
VM is not initialized and all but the most primitive tests will fail.

Is this intended or would this be a bug?

Kind Regards, Thomas


More information about the hotspot-dev mailing list