Gtest: CreateVM is not called when isolated tests are run?
Thomas Stüfe
thomas.stuefe at gmail.com
Wed Dec 7 13:23:43 UTC 2016
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