Loading... (original) (raw)

Currently there are test libraries both in hotspot and in jdk, which provide the same functionality. This approach has the expected drawbacks with code duplication, there are now differences in them and there is a maintenance cost associated with it. To improve this, the hotspot and jdk test libraries should be merged and moved to top-level repository.

This does not mean that all test libraries shall go into top repo, there can still be repo local and test folder local test libraries. The idea is to give a home for the test libraries that make sense to share.

The best thing is if this new common location has the same layout as other things, lets use the java.base as an example. There is an addition however - it should also include the test folder for the test library tests.

Here are some examples of the suggested folder structure, basically making the test library a project of its own.
/test/lib/share/classes/ (package root)
/test/lib/share/conf/
/test/lib/share/native/

/test/lib-test // <test src root, same layout as lib, but without native redirection>

Package jdk.test.lib is the main package for all test libraries. Few things go at top level, but some will.

Package jdk.test.lib.processtools is the package for utilities for launching processes and analyzing the output.
/test/lib/share/classes/jdk/test/lib/processtools/OutputAnalyzer.java
/test/lib/share/classes/jdk/test/lib/processtools/OutputBuffer.java
/test/lib/share/classes/jdk/test/lib/processtools/ProcessTools.java
/test/lib/share/classes/jdk/test/lib/processtools/StreamPumper.java
/test/lib/share/classes/jdk/test/lib/processtools/JDKToolFinder.java
/test/lib/share/classes/jdk/test/lib/processtools/JDKToolLauncher.java

/test/lib-test/jdk/test/lib/processtools/OutputAnalyzerTest.java

Asserts can stay at top level.
/test/lib/share/classes/jdk/test/lib/Asserts.java
/test/lib-test/jdk/test/lib/AssertsTest.java

For VM specific info, it would have vm package. Note that the whitebox API moves here.
/test/lib/share/classes/jdk/test/lib/vm/InputArguments.java
/test/lib/share/classes/jdk/test/lib/vm/Platform.java

Ok, so then there are the stuff which just is a bucket of stuff and fluff.
A later exercise could be to break this class into better named and placed classes, but this is a start:
/test/lib/share/classes/jdk/test/lib/misc/Utils.java