diff --git a/eclipse.platform.releng/bundles/org.eclipse.test.performance/.classpath b/eclipse.platform.releng/bundles/org.eclipse.test.performance/.classpath index d27357c0fa2..a29b56b56e2 100644 --- a/eclipse.platform.releng/bundles/org.eclipse.test.performance/.classpath +++ b/eclipse.platform.releng/bundles/org.eclipse.test.performance/.classpath @@ -1,7 +1,11 @@ - + + + + + diff --git a/eclipse.platform.releng/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF b/eclipse.platform.releng/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF index ece19e7ddd8..1097a3d99ed 100644 --- a/eclipse.platform.releng/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF +++ b/eclipse.platform.releng/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF @@ -6,18 +6,18 @@ Bundle-Version: 3.20.300.qualifier Bundle-Activator: org.eclipse.test.internal.performance.PerformanceTestPlugin Bundle-Vendor: %Plugin.providerName Bundle-Localization: plugin +Import-Package: org.junit.jupiter.api, + org.junit.platform.suite.api, + org.eclipse.test Export-Package: org.eclipse.perfmsr.core, - org.eclipse.test, - org.eclipse.test.internal;x-internal:=true, org.eclipse.test.internal.performance, org.eclipse.test.internal.performance.data, org.eclipse.test.internal.performance.db, org.eclipse.test.internal.performance.eval, org.eclipse.test.internal.performance.tests, org.eclipse.test.performance -Import-Package: org.junit.jupiter.api, - org.junit.platform.suite.api Require-Bundle: org.eclipse.core.runtime, + org.eclipse.test;visibility:=reexport, org.junit Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java b/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java deleted file mode 100644 index b9c4628465b..00000000000 --- a/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/AwtScreenshot.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.test.internal; - -import java.awt.AWTException; -import java.awt.HeadlessException; -import java.awt.Rectangle; -import java.awt.Robot; -import java.awt.Toolkit; -import java.awt.image.BufferedImage; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintStream; -import java.net.URISyntaxException; -import java.net.URL; - -import javax.imageio.ImageIO; - -public class AwtScreenshot { - - private static final int TIMEOUT_SECONDS = 15; - - public static void main(String[] args) { - try { - System.setProperty("java.awt.headless", "false"); - Robot robot = new Robot(); - Rectangle rect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); - BufferedImage image = robot.createScreenCapture(rect); - File file = new File(args[0]); - ImageIO.write(image, "png", file); - - System.out.println("AWT screenshot saved to: " + file.getAbsolutePath()); - } catch (HeadlessException | AWTException | IOException e) { - e.printStackTrace(); - } - } - - static class StreamForwarder extends Thread { - - private InputStream fProcessOutput; - - private PrintStream fStream; - - public StreamForwarder(InputStream processOutput, PrintStream stream) { - fProcessOutput = processOutput; - fStream = stream; - } - - @Override - public void run() { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(fProcessOutput))) { - String line = null; - while ((line = reader.readLine()) != null) { - fStream.println(line); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - public static void dumpAwtScreenshot(String screenshotFile) { - try { - URL location = AwtScreenshot.class.getProtectionDomain().getCodeSource().getLocation(); - String cp = location.toURI().getPath(); - if (new File(cp).isDirectory() && !cp.endsWith(File.separatorChar + "bin" + File.separatorChar)) { - cp += "bin" + File.separatorChar; - } - String javaHome = System.getProperty("java.home"); - String javaExe = javaHome + File.separatorChar + "bin" + File.separatorChar + "java"; - if (File.separatorChar == '\\') { - javaExe += ".exe"; // assume it's Windows - } - String[] args = new String[] { javaExe, "-cp", cp, AwtScreenshot.class.getName(), screenshotFile }; - // System.out.println("Start process: " + Arrays.asList(args)); - ProcessBuilder processBuilder = new ProcessBuilder(args); - if ("Mac OS X".equals(System.getProperty("os.name"))) { - processBuilder.environment().put("AWT_TOOLKIT", "CToolkit"); - } - Process process = processBuilder.start(); - - @SuppressWarnings("resource") // never close process streams - InputStream errorStream = process.getErrorStream(); - - @SuppressWarnings("resource") // never close process streams - InputStream inputStream = process.getInputStream(); - - new StreamForwarder(errorStream, System.out).start(); - new StreamForwarder(inputStream, System.out).start(); - long end = System.currentTimeMillis() + TIMEOUT_SECONDS * 1000; - boolean done = false; - do { - try { - process.exitValue(); - done = true; - } catch (IllegalThreadStateException e) { - try { - Thread.sleep(100); - } catch (InterruptedException e1) { - // continue - } - } - } while (!done && System.currentTimeMillis() < end); - - if (done) { - int exitCode = process.exitValue(); - if (exitCode != 0) { - System.out.println("AwtScreenshot VM finished with exit code " + exitCode + "."); - } - } else { - process.destroy(); - System.out.println("Killed AwtScreenshot VM after " + TIMEOUT_SECONDS + " seconds."); - } - } catch (URISyntaxException | IOException e) { - e.printStackTrace(); - } - } -} diff --git a/eclipse.platform.releng/bundles/org.eclipse.test/META-INF/MANIFEST.MF b/eclipse.platform.releng/bundles/org.eclipse.test/META-INF/MANIFEST.MF index 023bf7a2f30..f2ab114d6cf 100644 --- a/eclipse.platform.releng/bundles/org.eclipse.test/META-INF/MANIFEST.MF +++ b/eclipse.platform.releng/bundles/org.eclipse.test/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.apache.ant, org.eclipse.ui;bundle-version="[3.112.0,4.0.0)", org.eclipse.core.runtime, org.eclipse.ui.ide.application, - org.eclipse.equinox.app + org.eclipse.equinox.app, + org.junit Import-Package: org.junit.jupiter.api, org.junit.platform.engine, org.junit.platform.engine.discovery, diff --git a/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/AwtScreenshot.java b/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/AwtScreenshot.java index 3145589ff51..7f0558beb57 100644 --- a/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/AwtScreenshot.java +++ b/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/AwtScreenshot.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 IBM Corporation and others. + * Copyright (c) 2015, 2016 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,6 +11,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ + package org.eclipse.test; import java.awt.AWTException; @@ -19,26 +20,114 @@ import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.net.URISyntaxException; +import java.net.URL; import javax.imageio.ImageIO; public class AwtScreenshot { - public static void main(String[] args) { - try { - System.setProperty("java.awt.headless", "false"); - Robot robot = new Robot(); - Rectangle rect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); - BufferedImage image = robot.createScreenCapture(rect); - File file = new File(args[0]); - ImageIO.write(image, "png", file); - - System.out.println("AWT screenshot saved to: " + file.getAbsolutePath()); - } catch (HeadlessException | AWTException | IOException e) { - e.printStackTrace(); - } - } + private static final int TIMEOUT_SECONDS = 15; + + public static void main(String[] args) { + try { + System.setProperty("java.awt.headless", "false"); + Robot robot = new Robot(); + Rectangle rect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); + BufferedImage image = robot.createScreenCapture(rect); + File file = new File(args[0]); + ImageIO.write(image, "png", file); + + System.out.println("AWT screenshot saved to: " + file.getAbsolutePath()); + } catch (HeadlessException | AWTException | IOException e) { + e.printStackTrace(); + } + } + + static class StreamForwarder extends Thread { + + private InputStream fProcessOutput; + + private PrintStream fStream; + + public StreamForwarder(InputStream processOutput, PrintStream stream) { + fProcessOutput = processOutput; + fStream = stream; + } + + @Override + public void run() { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(fProcessOutput))) { + String line = null; + while ((line = reader.readLine()) != null) { + fStream.println(line); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static void dumpAwtScreenshot(String screenshotFile) { + try { + URL location = AwtScreenshot.class.getProtectionDomain().getCodeSource().getLocation(); + String cp = location.toURI().getPath(); + if (new File(cp).isDirectory() && !cp.endsWith(File.separatorChar + "bin" + File.separatorChar)) { + cp += "bin" + File.separatorChar; + } + String javaHome = System.getProperty("java.home"); + String javaExe = javaHome + File.separatorChar + "bin" + File.separatorChar + "java"; + if (File.separatorChar == '\\') { + javaExe += ".exe"; // assume it's Windows + } + String[] args = new String[] { javaExe, "-cp", cp, AwtScreenshot.class.getName(), screenshotFile }; + // System.out.println("Start process: " + Arrays.asList(args)); + ProcessBuilder processBuilder = new ProcessBuilder(args); + if ("Mac OS X".equals(System.getProperty("os.name"))) { + processBuilder.environment().put("AWT_TOOLKIT", "CToolkit"); + } + Process process = processBuilder.start(); + + @SuppressWarnings("resource") // never close process streams + InputStream errorStream = process.getErrorStream(); + + @SuppressWarnings("resource") // never close process streams + InputStream inputStream = process.getInputStream(); + + new StreamForwarder(errorStream, System.out).start(); + new StreamForwarder(inputStream, System.out).start(); + long end = System.currentTimeMillis() + TIMEOUT_SECONDS * 1000; + boolean done = false; + do { + try { + process.exitValue(); + done = true; + } catch (IllegalThreadStateException e) { + try { + Thread.sleep(100); + } catch (InterruptedException e1) { + // continue + } + } + } while (!done && System.currentTimeMillis() < end); + if (done) { + int exitCode = process.exitValue(); + if (exitCode != 0) { + System.out.println("AwtScreenshot VM finished with exit code " + exitCode + "."); + } + } else { + process.destroy(); + System.out.println("Killed AwtScreenshot VM after " + TIMEOUT_SECONDS + " seconds."); + } + } catch (URISyntaxException | IOException e) { + e.printStackTrace(); + } + } } diff --git a/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/OrderedTestSuite.java b/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/OrderedTestSuite.java similarity index 100% rename from eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/OrderedTestSuite.java rename to eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/OrderedTestSuite.java diff --git a/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/Screenshots.java b/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/Screenshots.java similarity index 98% rename from eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/Screenshots.java rename to eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/Screenshots.java index a385da8b90a..f834f03f69d 100644 --- a/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/Screenshots.java +++ b/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/Screenshots.java @@ -16,7 +16,6 @@ import java.io.File; import org.eclipse.core.runtime.Platform; -import org.eclipse.test.internal.AwtScreenshot; /** * Helper class to take screenshots from running tests. diff --git a/eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/TracingSuite.java b/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/TracingSuite.java similarity index 100% rename from eclipse.platform.releng/bundles/org.eclipse.test.performance/src/org/eclipse/test/TracingSuite.java rename to eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/TracingSuite.java