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

CTW runner closes standard output on exit

    Details

    • Subcomponent:
    • Resolved In Build:
      b10

      Backports

        Description

        Try this:
        $ JAVA_OPTIONS="-XX:+CITime" ./ctw.sh test.jar

        ...and get no output. This is because internal tty shares the fd with System.out, which CTW runner closes on exit.

        Bandaid fix:

        diff -r 560b2becbe87 test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
        --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java Thu Jan 30 12:00:38 2020 -0800
        +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java Fri Jan 31 23:08:18 2020 +0100
        @@ -97,13 +97,15 @@
                             System.currentTimeMillis() - start));
                     passed = true;
                 } catch (Throwable t){
                     t.printStackTrace(ERR);
                 } finally {
        - try {
        - OUT.close();
        - } catch (Throwable ignore) {
        + if (OUT != System.out) {
        + try {
        + OUT.close();
        + } catch (Throwable ignore) {
        + }
                     }
                     // <clinit> might have started new threads
                     System.exit(passed ? 0 : 1);
                 }
             }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  shade Aleksey Shipilev
                  Reporter:
                  shade Aleksey Shipilev
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: