Sun, 14 Oct 2018 20:31:03 -0400
8068440: Test6857159.java times out
Summary: Replace shell script with Java-only code
Reviewed-by: kvn, iignatyev
test/compiler/6857159/Test6857159.java | file | annotate | diff | comparison | revisions |
1.1 --- a/test/compiler/6857159/Test6857159.java Thu Sep 22 12:17:24 2016 +0200 1.2 +++ b/test/compiler/6857159/Test6857159.java Sun Oct 14 20:31:03 2018 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -26,15 +26,24 @@ 1.11 * @test 1.12 * @bug 6857159 1.13 * @summary local schedule failed with checkcast of Thread.currentThread() 1.14 - * 1.15 - * @run shell Test6857159.sh 1.16 + * @library /testlibrary 1.17 */ 1.18 1.19 -public class Test6857159 extends Thread { 1.20 - static class ct0 extends Test6857159 { 1.21 - public void message() { 1.22 - // System.out.println("message"); 1.23 - } 1.24 +import com.oracle.java.testlibrary.*; 1.25 + 1.26 +public class Test6857159 { 1.27 + public static void main(String[] args) throws Exception { 1.28 + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbatch", "-XX:+PrintCompilation", 1.29 + "-XX:CompileOnly=Test$ct.run", "Test"); 1.30 + OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); 1.31 + analyzer.shouldNotContain("COMPILE SKIPPED"); 1.32 + analyzer.shouldContain("Test$ct0::run (16 bytes)"); 1.33 + } 1.34 +} 1.35 + 1.36 +class Test extends Thread { 1.37 + static class ct0 extends Test { 1.38 + public void message() { } 1.39 1.40 public void run() { 1.41 message(); 1.42 @@ -43,14 +52,10 @@ 1.43 } 1.44 } 1.45 static class ct1 extends ct0 { 1.46 - public void message() { 1.47 - // System.out.println("message"); 1.48 - } 1.49 + public void message() { } 1.50 } 1.51 static class ct2 extends ct0 { 1.52 - public void message() { 1.53 - // System.out.println("message"); 1.54 - } 1.55 + public void message() { } 1.56 } 1.57 1.58 public static void main(String[] args) throws Exception {