RFR: 8240222: [TESTBUG] gtest/jfr/test_networkUtilization.cpp failed when the number of tests is greater than or equal to 2

Jia Huang huangjia at loongson.cn
Fri Feb 28 13:08:14 UTC 2020


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()".

----------------------------------------------------------------------------
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