Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8129386

[TESTBUG] - com/sun/jdi/cds/*.java missing @build tag for libraries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b74

      Backports

        Description

        The affected tests are:

        com/sun/jdi/cds/CDSBreakpointTest.java
        com/sun/jdi/cds/CDSDeleteAllBkptsTest.java
        com/sun/jdi/cds/CDSFieldWatchpoints.java

        I first ran these tests in JTREG with -compilejdk set to JDK8. It tried compiling CDSBreakpointTest.java with some source path settings to include jdk/testlibrary as well. So Javac will implicitly build jdk/testlibrary/ProcessTool.java, even though it's not explicitly given in the command line.

        However, ProcessTools.java failed to compile because it calls Process.getPid() which exists only on JDK9.
                ^
        C:\\iklam\\jdk9_rt\\jdk\\test\\lib\\testlibrary\\jdk\\testlibrary\\ProcessTools.java:520: error: cannot find symbol
                    return p.getPid();
                            ^
        Nevertheless, javac has already created CDSBreakpointTest.class and decided to leave it in the file system.

        Now, I ran JTREG again with -compilejdk set to JDK9. Because CDSBreakpointTest.class already exists, it not compiled again. When the test is executed, it gets this error:

        ----------System.err:(20/1162)----------
        java.lang.NoClassDefFoundError: jdk/testlibrary/ProcessTools
            at CDSJDITest.runTest(CDSJDITest.java:71)
            at CDSBreakpointTest.main(CDSBreakpointTest.java:55)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:502)
            at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
            at java.lang.Thread.run(Thread.java:745)

        If @build jdk.testlibrary.* was specified in CDSBreakpointTest.java, then the second execution of JTREG would have tried to make sure all classes in jdk/testlibrary/*.java are compiled, so ProcessTools.class would have been available at run time.

        So the morale of the story is (besides "why is JTREG so dumb!") is you should always add @build <library_path>.* "just in case".

        Also, these tests have the tag "@library ..". I am not sure how this should be handled.


          Attachments

            Issue Links

              Activity

                People

                Assignee:
                cjplummer Chris Plummer
                Reporter:
                iklam Ioi Lam
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: