[jdk8u-dev] RFR: 8305329: [8u] Unify test libraries into single test library - step 1

Andrew John Hughes andrew at openjdk.org
Sat Aug 12 12:56:59 UTC 2023


On Thu, 30 Mar 2023 21:12:59 GMT, Zdenek Zambersky <zzambers at openjdk.org> wrote:

> I would like to start effort to unify test libraries in openjdk 8 into one unified library. This is first step of that effort, which moves newest copy of jdk test library (added with jfr backport) from `jdk/test/lib` to `test/lib`. For more details please continue reading. 
> 
> **Problem:**
> Test libraries in jdk8 are a bit messy.
> There are currently 3 different test libraries:
> - hotspot testlibrary - placed in [hotspot/test/testlibrary](https://github.com/openjdk/jdk8u-dev/tree/89aeae16e85ddfbd581cb86d0b0480b1e2d50e99/hotspot/test/testlibrary), (pkgs `com.oracle.java.testlibrary`, `sun.hotspot...` ), includes testlibrary tests in [hotspot/test/testlibrary_tests](https://github.com/openjdk/jdk8u-dev/tree/89aeae16e85ddfbd581cb86d0b0480b1e2d50e99/hotspot/test/testlibrary_tests)
> - jdk testlibrary (old) - placed in [jdk/test/lib/testlibrary](https://github.com/openjdk/jdk8u-dev/tree/master/jdk/test/lib/testlibrary), (pkgs `jdk.testlibrary`, `com.oracle.testlibrary.jsr292`)
> - jdk test lib - placed directly in [jdk/test/lib](https://github.com/openjdk/jdk8u-dev/tree/master/jdk/test/lib), was added with [jfr backport](https://github.com/openjdk/jdk8u-dev/commit/df7e09043392d5952d522a28702c6e5ec3e8492e), (pkgs `jdk.test.lib` `sun.hotspot...`)
> 
> Many test library classes exist in multiple different copies (using different pkgs). Few examples:
> - Platform.java - 3 copies ([hs](https://github.com/openjdk/jdk8u-dev/blob/89aeae16e85ddfbd581cb86d0b0480b1e2d50e99/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java), [jdk (old)](https://github.com/openjdk/jdk8u-dev/blob/master/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java), [jdk (jfr)](https://github.com/openjdk/jdk8u-dev/blob/master/jdk/test/lib/jdk/test/lib/Platform.java))
> - OutputAnalyzer.java - 3 copies ([hs](https://github.com/openjdk/jdk8u-dev/blob/89aeae16e85ddfbd581cb86d0b0480b1e2d50e99/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java), [jdk (old)](https://github.com/openjdk/jdk8u-dev/blob/master/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java), [jdk (jfr)](https://github.com/openjdk/jdk8u-dev/blob/master/jdk/test/lib/jdk/test/lib/process/OutputAnalyzer.java))
> - WhiteBox.java - 2 copies ([hotspot](https://github.com/openjdk/jdk8u-dev/blob/89aeae16e85ddfbd581cb86d0b0480b1e2d50e99/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java), [jdk (jfr)](https://github.com/openjdk/jdk8u-dev/blob/master/jdk/test/lib/sun/hotspot/WhiteBox.java))
> 
> Few additional obse...

Should have put my above comment under a review...

This is something I'm aware of and I've thought about tackling it in a similar way to you a few times. Thanks for finding the time to do so which has eluded me so far.

I don't have any real issue with this PR, but then I guess this is the easy one. I'm a bit concerned about steps 2 & 3, because you seem to be suggesting that the existing HotSpot & JDK test libraries should be migrated to work with the ones from the JFR library. This seems like the wrong direction to me and a lot more work than migrating the JFR ones to work with the existing libraries (which is what the JFR backport should have done in the first place).

As you say yourself, some of the JFR imported library code doesn't even compile and it includes stuff for newer JDKs which isn't appropriate in 8u. This PR would seem like a good opportunity to remove rather than move any of these files that don't compile (which presumably also means they aren't being used by the JFR tests).

Have you verified that all the moved files actually compile? And if not, can we check that and delete any that don't?

Then, in the HotSpot stage, we can merge in the HotSpot library and replace any duplicates with the 8u versions, and see what (if anything) breaks in the JFR tests.

-------------

PR Review: https://git.openjdk.org/jdk8u-dev/pull/294#pullrequestreview-1575109615
PR Comment: https://git.openjdk.org/jdk8u-dev/pull/294#issuecomment-1675897397


More information about the jdk8u-dev mailing list