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

Thomas Stüfe thomas.stuefe at gmail.com
Wed Dec 7 13:31:07 UTC 2016


Thanks again! This was quick and helpful :)

..Thomas

On Wed, Dec 7, 2016 at 2:29 PM, Igor Ignatyev <igor.ignatyev at oracle.com>
wrote:

> Hi Thomas,
>
> I’m glad that helped. when I wrote TEST/TEST_VM, I actually meant the
> whole macro family: TEST, TEST_F, TEST_P etc, sorry if it confused you.
>
> if TearDown function cleans up resources and restores JVM’s global state,
> e.g. flags, TEST_VM macro family is fine.
>
> Thanks,
> — Igor
>
> > On Dec 7, 2016, at 4:23 PM, Thomas Stüfe <thomas.stuefe at gmail.com>
> wrote:
> >
> > Hi Igor,
> >
> > excellent, thank you, that helped! Had to use TEST_VM_F because I am
> using a fixture.
> >
> > About TEST_VM and TEST_OTHER_VM, when using a fixture holding resources,
> as long as I cleanup those resources in TearDown() it should be fine
> sharing the VM with others, right?
> >
> > Kind Regards, Thomas
> >
> >
> > On Wed, Dec 7, 2016 at 1:20 PM, Igor Ignatyev <igor.ignatyev at oracle.com>
> wrote:
> > Dear Thomas,
> >
> > I guess you are using TEST macro to define your tests. TEST is meant to
> be used for normal unit tests which does not depend on JVM, hence we do not
> call CreateVM, and your tests fail. you should use either TEST_VM or, if a
> test changes JVM state so it can’t be reused by other tests, TEST_OTHER_VM.
> >
> > regarding LogStream tests, it’s a bug. these tests depend on JVM and
> should be changed to TEST_VM.
> >
> > Thanks,
> > — Igor
> >
> > > On Dec 7, 2016, at 1:52 PM, Thomas Stüfe <thomas.stuefe at gmail.com>
> wrote:
> > >
> > > 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