RFR: 8240222: [TESTBUG] gtest/jfr/test_networkUtilization.cpp failed when the number of tests is greater than or equal to 2
David Holmes
david.holmes at oracle.com
Fri Feb 28 13:16:26 UTC 2020
Hi Jia,
On 28/02/2020 11:08 pm, Jia Huang wrote:
> Hi all,
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8240222
> Webrev: http://cr.openjdk.java.net/~jiahuang/8240222/webrev.00/
>
> gtest/jfr/test_networkUtilization.cpp failed when the number of tests is
> greater than or equal to 2.
> As shown in the following code, the test failed because "traceid id" is
> a static local variable.
> When the test runs a second time, "id" continues to grow, resulting in
> the return value of "i" being "_interfaces.end()".
Interesting! I'm not at all familiar with the details of gtest and how
it actually runs things. But I would expect that we have many tests that
rely on starting from a cleanly initialized VM state, or test state, and
so can't simply be repeated (it would be like editing an arbitrary test
and putting the body of main into a for-loop!).
So I'm not sure what the right way to fix this is:
- don't use REPEAT?
- declare the test as not repeatable somehow?
- change the test to make it repeatable?
Cheers,
David
> ----------------------------------------------------------------------------
>
> test/hotspot/gtest/jfr/test_networkUtilization.cpp
>
> static const MockNetworkInterface& get_interface(traceid id) {
> std::list<MockNetworkInterface>::const_iterator i = _interfaces.begin();
> for (; i != _interfaces.end(); ++i) {
> if (i->id == id) {
> break;
> }
> }
> return *i;
> }
> ----------------------------------------------------------------------------
>
>
>
> Testing:
> - make run-test TEST=gtest:JfrTestNetworkUtilization GTEST=REPEAT=2
> CONF=server-release
> - make run-test TEST=gtest:JfrTestNetworkUtilization GTEST=REPEAT=2
> CONF=server-fastdebug
>
> Thanks a lot
>
> Best regards,
> Jia
>
More information about the hotspot-dev
mailing list