Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
8
-
b02
Description
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, (pkgs com.oracle.java.testlibrary, sun.hotspot... ), includes testlibrary tests in hotspot/test/testlibrary_tests
- jdk testlibrary (old) - placed in jdk/test/lib/testlibrary, (pkgs jdk.testlibrary, com.oracle.testlibrary.jsr292)
- jdk test lib - placed directly in jdk/test/lib, was added with jfr backport, (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, jdk (old), jdk (jfr))
- OutputAnalyzer.java - 3 copies (hs, jdk (old), jdk (jfr))
- WhiteBox.java - 2 copies (hotspot, jdk (jfr))
Few additional observations:
- classes in jdk test lib (jfr) use java packages compatible with newer jdks, other 2 don't (other 2 are actually not even compatible with each other)
- test lib added with jfr has newest classes, but some of them are NOT JDK8 compatible, some of them do not even compile on 8 (see e.g. SecurityTools.java, InMemoryJavaCompiler.java ...) , some whitebox stuff in sun.hotspot also seem incompatible with 8 (e.g. NMethod.java (compare to NMethod.java from hs))
- most jdk tests (with exception of jfr ones) use old testlibrary, but few tests already started using test lib added with jfr
- paths to test lib as specified @library jtreg tag is different from newer jdks (for all 3 test libraries)
This situation complicates backporting and leads to confusion. (What is correct library path? What package test lib classes use? Which library to use and to which one do backports? Which part are broken and why? etc...)
Solution:
Proposed solution is to have single test library placed in test/lib directory (+ test library tests in test/lib-test) by fixing/merging test libraries. (same locations are used in newer jdks)
Goal is following:
- single test library, removed code duplication
- all test lib classes compatible with JDK8
- locations of test lib files and java packages (used by test library classes) same as in later jdks
- path as specified by @library jtreg tag compatible with later jdks (@library /test/lib)
- only test lib is moved. Tests and TEST.ROOT files are not moved, so this should not break existing CIs.
Because this is big change it should be performed in steps:
- move jdk test library added by jfr to test/lib and do necessary modifications to tests (add external.lib.roots to TEST.ROOT files, modify @library tag of affected test)
- Fix test lib in new location to work with hotspot tests (fix/merge with hotspot testlibrary), modify hotpot tests to use it, remove hotspot testlibrary
- continue with jdk tests, doing more fixes to test lib, if necessary (fix/merge with jdk testlibrary), eventually migrating all tests and removing jdk testlibrary (old)
Changes in this PR:
This is just the first step and consist of:
- moved test lib classes jdk/test/lib -> test/lib (excluding testlibrary, security dirs belonging to the old jdk testlibrary)
- added appropriate external.lib.roots to TEST.ROOT files of jdk and hotspot
- modified affected tests to use moved library (just modifications of @library, with excpetion of TestNative.sh)
Testing:
tier1: passed (see Checks)
jdk_core: OK (no regressions to master)
jdk_jfr: OK (no regressions to master)
Problem:
Test libraries in jdk8 are a bit messy.
There are currently 3 different test libraries:
- hotspot testlibrary - placed in hotspot/test/testlibrary, (pkgs com.oracle.java.testlibrary, sun.hotspot... ), includes testlibrary tests in hotspot/test/testlibrary_tests
- jdk testlibrary (old) - placed in jdk/test/lib/testlibrary, (pkgs jdk.testlibrary, com.oracle.testlibrary.jsr292)
- jdk test lib - placed directly in jdk/test/lib, was added with jfr backport, (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, jdk (old), jdk (jfr))
- OutputAnalyzer.java - 3 copies (hs, jdk (old), jdk (jfr))
- WhiteBox.java - 2 copies (hotspot, jdk (jfr))
Few additional observations:
- classes in jdk test lib (jfr) use java packages compatible with newer jdks, other 2 don't (other 2 are actually not even compatible with each other)
- test lib added with jfr has newest classes, but some of them are NOT JDK8 compatible, some of them do not even compile on 8 (see e.g. SecurityTools.java, InMemoryJavaCompiler.java ...) , some whitebox stuff in sun.hotspot also seem incompatible with 8 (e.g. NMethod.java (compare to NMethod.java from hs))
- most jdk tests (with exception of jfr ones) use old testlibrary, but few tests already started using test lib added with jfr
- paths to test lib as specified @library jtreg tag is different from newer jdks (for all 3 test libraries)
This situation complicates backporting and leads to confusion. (What is correct library path? What package test lib classes use? Which library to use and to which one do backports? Which part are broken and why? etc...)
Solution:
Proposed solution is to have single test library placed in test/lib directory (+ test library tests in test/lib-test) by fixing/merging test libraries. (same locations are used in newer jdks)
Goal is following:
- single test library, removed code duplication
- all test lib classes compatible with JDK8
- locations of test lib files and java packages (used by test library classes) same as in later jdks
- path as specified by @library jtreg tag compatible with later jdks (@library /test/lib)
- only test lib is moved. Tests and TEST.ROOT files are not moved, so this should not break existing CIs.
Because this is big change it should be performed in steps:
- move jdk test library added by jfr to test/lib and do necessary modifications to tests (add external.lib.roots to TEST.ROOT files, modify @library tag of affected test)
- Fix test lib in new location to work with hotspot tests (fix/merge with hotspot testlibrary), modify hotpot tests to use it, remove hotspot testlibrary
- continue with jdk tests, doing more fixes to test lib, if necessary (fix/merge with jdk testlibrary), eventually migrating all tests and removing jdk testlibrary (old)
Changes in this PR:
This is just the first step and consist of:
- moved test lib classes jdk/test/lib -> test/lib (excluding testlibrary, security dirs belonging to the old jdk testlibrary)
- added appropriate external.lib.roots to TEST.ROOT files of jdk and hotspot
- modified affected tests to use moved library (just modifications of @library, with excpetion of TestNative.sh)
Testing:
tier1: passed (see Checks)
jdk_core: OK (no regressions to master)
jdk_jfr: OK (no regressions to master)
Attachments
Issue Links
- relates to
-
JDK-8327993 [8u] Unify test libraries into single test library - step 2
- New