changeset 9654:e50f30dcb83b

Merge
author jbachorik
date Fri, 04 Dec 2015 16:19:09 +0000
parents 59dc9c7ae6cf 938d03bdca22
children e9b9b2fc83c8 56c7249c720f
files
diffstat 10 files changed, 59 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test/serviceability/dcmd/gc/RunFinalizationTest.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/serviceability/dcmd/gc/RunFinalizationTest.java	Fri Dec 04 16:19:09 2015 +0000
@@ -23,20 +23,22 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
 
-import jdk.test.lib.OutputAnalyzer;
-import jdk.test.lib.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
 
 /*
  * @test
  * @summary Test of diagnostic command GC.run_finalization
  * @library /testlibrary
+ * @library /test/lib/share/classes
  * @modules java.base/sun.misc
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
  * @build jdk.test.lib.*
  * @build jdk.test.lib.dcmd.*
+ * @build jdk.test.lib.process.*
  * @build RunFinalizationTest FinalizationRunner
  * @run main RunFinalizationTest
  */
@@ -50,8 +52,21 @@
         javaArgs.add(TEST_APP_NAME);
         ProcessBuilder testAppPb = ProcessTools.createJavaProcessBuilder(javaArgs.toArray(new String[javaArgs.size()]));
 
-        OutputAnalyzer out = ProcessTools.executeProcess(testAppPb);
-        out.stderrShouldNotMatch("^" + FinalizationRunner.FAILED + ".*")
-           .stdoutShouldMatch("^" + FinalizationRunner.PASSED + ".*");
+        final AtomicBoolean failed = new AtomicBoolean();
+        final AtomicBoolean passed = new AtomicBoolean();
+
+        Process runner = ProcessTools.startProcess(
+            "FinalizationRunner",
+            testAppPb,
+            l -> {
+                failed.compareAndSet(false, l.contains(FinalizationRunner.FAILED));
+                passed.compareAndSet(false, l.contains(FinalizationRunner.PASSED));
+            }
+        );
+        runner.waitFor();
+
+        if (failed.get() || !passed.get()) {
+            throw new Error("RunFinalizationTest failed");
+        }
     }
 }
--- a/test/testlibrary/jdk/test/lib/Asserts.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/Asserts.java	Fri Dec 04 16:19:09 2015 +0000
@@ -41,7 +41,10 @@
  * multiple times, then the line number won't provide enough context to
  * understand the failure.
  * </pre>
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  */
+@Deprecated
 public class Asserts {
 
     /**
--- a/test/testlibrary/jdk/test/lib/JDKToolFinder.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/JDKToolFinder.java	Fri Dec 04 16:19:09 2015 +0000
@@ -27,6 +27,11 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
+ */
+@Deprecated
 public final class JDKToolFinder {
 
     private JDKToolFinder() {
--- a/test/testlibrary/jdk/test/lib/JDKToolLauncher.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/JDKToolLauncher.java	Fri Dec 04 16:19:09 2015 +0000
@@ -46,7 +46,10 @@
  * Process p = pb.start();
  * }
  * </pre>
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  */
+@Deprecated
 public class JDKToolLauncher {
     private final String executable;
     private final List<String> vmArgs = new ArrayList<String>();
--- a/test/testlibrary/jdk/test/lib/OutputAnalyzer.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/OutputAnalyzer.java	Fri Dec 04 16:19:09 2015 +0000
@@ -41,7 +41,11 @@
    *
    * @param process Process to analyze
    * @throws IOException If an I/O error occurs.
+   *
+   * @deprecated This class is deprecated. Use the one from
+   *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
    */
+  @Deprecated
   public OutputAnalyzer(Process process) throws IOException {
     OutputBuffer output = ProcessTools.getOutput(process);
     exitValue = process.exitValue();
--- a/test/testlibrary/jdk/test/lib/OutputBuffer.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/OutputBuffer.java	Fri Dec 04 16:19:09 2015 +0000
@@ -23,6 +23,11 @@
 
 package jdk.test.lib;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ */
+@Deprecated
 public class OutputBuffer {
   private final String stdout;
   private final String stderr;
--- a/test/testlibrary/jdk/test/lib/Platform.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/Platform.java	Fri Dec 04 16:19:09 2015 +0000
@@ -25,6 +25,11 @@
 
 import java.util.regex.Pattern;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
+ */
+@Deprecated
 public class Platform {
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
--- a/test/testlibrary/jdk/test/lib/ProcessTools.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/ProcessTools.java	Fri Dec 04 16:19:09 2015 +0000
@@ -31,6 +31,11 @@
 import java.util.Collections;
 import java.util.List;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ */
+@Deprecated
 public final class ProcessTools {
 
   private ProcessTools() {
--- a/test/testlibrary/jdk/test/lib/StreamPumper.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/StreamPumper.java	Fri Dec 04 16:19:09 2015 +0000
@@ -27,6 +27,11 @@
 import java.io.InputStream;
 import java.io.IOException;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ */
+@Deprecated
 public final class StreamPumper implements Runnable {
 
   private static final int BUF_SIZE = 256;
--- a/test/testlibrary/jdk/test/lib/Utils.java	Fri Dec 04 13:39:59 2015 +0300
+++ b/test/testlibrary/jdk/test/lib/Utils.java	Fri Dec 04 16:19:09 2015 +0000
@@ -55,7 +55,11 @@
 
 /**
  * Common library for various test helper functions.
+ *
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  */
+@Deprecated
 public final class Utils {
 
     /**