You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Externalizes the logic to wait for the Jacoco data file into `DataFileWatch`, which should handle the cases when the data file does not already exist (aka `JacococConfig.reuseDataFile==false`) and if it already exists (aka `JacocoConfig.reuseDataFile==true`).
`DataFileWatch` remembers the "initial file size", which is the file size _before_ Jacoco runs. If the file does not already exists, the file size is `-1L`. The implementation waits basically "inifinitely" as long as the file size of the data file changes, which is interpreted as "data file is being updated by Jacoco". If the data file size stays at its "initial file size" for 10 seconds and the Jacoco shutdown hook's not running, the wait's aborted. If the "wait for Jacoco data file" has timed out, an additional message is printed to `stderr`.
Also changes the "jacoco running" detection from inspecting the running threads to checking whether the Jacoco MBean is (still) registered.
If the "wait for Jacoco data file" has timed out, an additional message is printed to `stderr`.
The previous code also registered one shutdown-hook to create the report from the Jacoco data file for every _test case_ being executed. This lead to `number-of-test-cases` shutdown hooks to generate the same Jacoco report from the same Jacoco data file. The correct behavior is to generate one report when the JVM terminates. This is implemented by setting a system property, because every _test class_ results in a new Quarkus class loader running a different class instance of `JacocoProcessor`, using a static field in `JacocoProcessor` would still cause `number-of-test-classes` shutdown hooks.
Fixes: quarkusio#30264
0 commit comments