JDK-8202572 : 80% line coverage for native code
  • Type: Sub-task
  • Component: other-libs
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-05-03
  • Updated: 2018-05-18
  • Resolved: 2018-05-18
Description
Should JEP be introducing new or changing existing native code, it is expected that the code would be covered by tests for at least 80%.
A native code coverage tool, such as grove, could be used to obtain this information.
This task should normally provide a link to a code coverage report.
Comments
Ran the JDK with gcov using: --with-extra-cflags='-fprofile-arcs -ftest-coverage' --with-extra-cxxflags='-fprofile-arcs -ftest-coverage' --with-extra-ldflags='-fprofile-arcs -ftest-coverage' (though really you don't need both flags everywhere...) and on slowdebug. The percentages below are from the tool and anything with "-->" was a manual inspection of the coverage Here are the notes from a gcov run using the http://cr.openjdk.java.net/~jcbeyler/8171119/heap_event.18/ webrev. All our code changes are covered by the current tests at almost 100%. I will either attach the data if we accept webrev heap_event.18 as ok for the coverage or rerun it when we are closer to a final webrev and attached here. But we can consider this a trivial item to close now. Over 80% on the file level. File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp' Lines executed:83.66% of 257 Creating 'threadLocalAllocBuffer.cpp.gcov' -> Our code 100% File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp' Lines executed:94.87% of 39 Creating 'threadLocalAllocBuffer.hpp.gcov' -> 50% if you look but the call site of the method is inlined, so actually 100% File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiManageCapabilities.cpp' Lines executed:87.50% of 144 Creating 'jvmtiManageCapabilities.cpp.gcov' -> 50% our code, we miss a one line in the print method, not important in my mind File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/runtime/mutexLocker.cpp' Lines executed:86.24% of 109 Creating 'mutexLocker.cpp.gcov' ---------------------------------------------------------------- File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/gc/shared/collectedHeap.hpp' Lines executed:54.55% of 55 Creating 'collectedHeap.hpp.gcov' --> we only added a definition, so 0% File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/gc/shared/collectedHeap.inline.hpp' Lines executed:77.32% of 97 Creating 'collectedHeap.inline.hpp.gcov' --> 99% is covered from our change File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/gc/shared/collectedHeap.cpp' Lines executed:67.24% of 232 Creating 'collectedHeap.cpp.gcov' --> 100% our code File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiEnv.cpp' Lines executed:10.68% of 1432 Creating 'jvmtiEnv.cpp.gcov' --> 100% our code File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiEventController.cpp' Lines executed:47.00% of 400 Creating 'jvmtiEventController.cpp.gcov' --> 100% our code File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiExport.cpp' Lines executed:23.91% of 1280 Creating 'jvmtiExport.cpp.gcov' --> 100% our code File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiExport.hpp' Lines executed:79.22% of 77 Creating 'jvmtiExport.hpp.gcov' --> 100% our code File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiThreadState.hpp' Lines executed:19.57% of 46 Creating 'jvmtiThreadState.hpp.gcov' --> 100% our code (but actually 50% declared, the getter gets inlined, if I compile the JDK with -O0, it will show 100%, not sure it is important the callers are covered) File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/prims/jvmtiThreadState.cpp' Lines executed:41.18% of 153 Creating 'jvmtiThreadState.cpp.gcov' --> 100% our code File '/usr/local/google/home/jcbeyler/mercurial/jdk-heap-event-cov/src/hotspot/share/runtime/thread.hpp' Lines executed:68.79% of 346 Creating 'thread.hpp.gcov' --> 100% our code
08-05-2018