JDK-8004748 : TEST_BUG: clean up @build tags in RMI tests
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2012-12-08
  • Updated: 2013-12-17
  • Resolved: 2012-12-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u21Fixed 8 b69Fixed
Related Reports
Relates :  
The @build tags are used quite haphazardly in the RMI regression tests. Several things need to be done.

1) Tests that uses TestLibrary should list TestLibrary first. This is because of order dependencies in jtreg that might cause subsequent tests to break. See CODETOOLS-7900024. Briefly, if a test uses library classes, jtreg is supposed to compile those library classes and store the results in a place where they can be reused by subsequent tests. Unfortunately, if the test's @build tags compile test classes first, the library classes get compiled implicitly and get stored in the wrong location. Apparently jtreg remembers that it compiled them but since they're in the wrong location, subsequent tests may fail with NoClassDefFoundError. The workaround is to list library classes first in @build directives.

2) Classes that are explicitly depended upon by the test should be listed in @build, but not second-level dependencies in the library (e.g. StreamPipe).

3) It is not necessary to list the main test class in a @build tag, since the @run tag will build it implicitly.

4) Several classes should be consolidated onto a single @build line where possible, as this seems to speed up the test run a bit.

5) Every test should have a @run tag. This isn't strictly necessary, but it helps to avoid errors. If a test has no @run tag, jtreg will implicitly just run it. But if a maintainer were to add a @build tag (shorthand for @run build) the build step will be executed and jtreg's implicit run behavior will  not occur. Thus the test will not be run!
There is a bit of speedup, perhaps a minute or less off a 15-minute run of the RMI tests. Several of the tests require the main test class to be listed in the @build line. This is because the file contains not only the main test class but also interfaces required by test helper classes. The latter cannot be compiled separately from the main test class plus its interfaces.