test/jdk/java/awt/xembed/server/RunTestXEmbed.java
author eosterlund
Wed, 21 Mar 2018 14:38:32 +0100
changeset 49484 ee8fa73b90f9
parent 47216 71c04702a3d5
permissions -rw-r--r--
8198949: Modularize arraycopy stub routine GC barriers Reviewed-by: rkennke, pliden
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 36915
diff changeset
     2
 * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     4
 *
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     8
 *
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    13
 * accompanied this code).
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    14
 *
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 443
diff changeset
    21
 * questions.
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    22
 */
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    23
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    24
/**
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    25
 * @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 36915
diff changeset
    26
 * @key headful
34413
bbed9966db6e 7146533: [TEST BUG] [macosx] skip java/awt/xembed/server/RunTestXEmbed.java for Mac OS X
kshefov
parents: 31448
diff changeset
    27
 * @bug 4931668 7146533
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    28
 * @summary Tests XEmbed server/client functionality
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    29
 * @author Denis Mikhalkin: area=awt.xembed
34413
bbed9966db6e 7146533: [TEST BUG] [macosx] skip java/awt/xembed/server/RunTestXEmbed.java for Mac OS X
kshefov
parents: 31448
diff changeset
    30
 * @requires (!(os.family=="mac") & !(os.family=="windows"))
45709
841996818446 8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform
iignatyev
parents: 40261
diff changeset
    31
 * @library /test/lib
36915
2258afe73d4c 8150535: [TEST_BUG] fix @library for test/java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java
yan
parents: 34413
diff changeset
    32
 * @modules java.desktop/sun.awt
45709
841996818446 8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform
iignatyev
parents: 40261
diff changeset
    33
 * @build jdk.test.lib.Platform
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    34
 * @compile JavaClient.java TesterClient.java TestXEmbedServer.java
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    35
 * @run main/timeout=6000 RunTestXEmbed
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    36
 */
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    37
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    38
import java.awt.Rectangle;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    39
import java.lang.reflect.Method;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    40
import java.util.logging.*;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    41
import java.util.*;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    42
import java.io.*;
45709
841996818446 8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform
iignatyev
parents: 40261
diff changeset
    43
import jdk.test.lib.Platform;
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    44
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    45
public class RunTestXEmbed extends TestXEmbedServer {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    46
    private static final Logger log = Logger.getLogger("test.xembed");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    47
    private Method test;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    48
    private boolean passed = false;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    49
    public RunTestXEmbed(Method test) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    50
        super(false);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    51
        this.test = test;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    52
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    53
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    54
    public Process startClient(Rectangle bounds[], long window) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    55
        try {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    56
            String java_home = System.getProperty("java.home");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    57
            StringBuilder buf = new StringBuilder();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    58
            for (int i = 0; i < bounds.length; i++) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    59
                buf.append(" " + bounds[i].x);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    60
                buf.append(" " + bounds[i].y);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    61
                buf.append(" " + bounds[i].width);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    62
                buf.append(" " + bounds[i].height);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    63
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    64
            Map envs = System.getenv();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    65
            String enva[] = new String[envs.size()];
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    66
            int ind = 0;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    67
            Iterator iter = envs.entrySet().iterator();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    68
            while (iter.hasNext()) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    69
                Map.Entry entry = (Map.Entry)iter.next();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    70
                if (!"AWT_TOOLKIT".equals(entry.getKey())) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    71
                    enva[ind++] = entry.getKey() + "=" + entry.getValue();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    72
                } else {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    73
                    enva[ind++] = "AWT_TOOLKIT=sun.awt.X11.XToolkit";
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    74
                }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    75
            }
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39056
diff changeset
    76
            Process proc = Runtime.getRuntime().
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39056
diff changeset
    77
                exec(java_home +
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39056
diff changeset
    78
                     "/bin/java --add-exports java.desktop/sun.awt.X11=ALL-UNNAMED -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient "
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39056
diff changeset
    79
                     + test.getName() + " " + window + buf,
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 39056
diff changeset
    80
                     enva);
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    81
            System.err.println("Test for " + test.getName() + " has started.");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    82
            log.fine("Test for " + test.getName() + " has started.");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    83
            new InputReader(proc.getInputStream());
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    84
            new InputReader(proc.getErrorStream());
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    85
            try {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    86
                passed = (proc.waitFor() == 0);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    87
            } catch (InterruptedException ie) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    88
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    89
            log.fine("Test for " + test.getName() + " has finished.");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    90
            File logFile = new File("java3.txt");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    91
            if (logFile.exists()) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    92
                logFile.renameTo(new File(test.getName() + ".txt"));
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    93
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    94
            return proc;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    95
        } catch (IOException ex1) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    96
            ex1.printStackTrace();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    97
        }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    98
        return null;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
    99
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   100
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   101
    public static void main(String[] args) throws Throwable {
34413
bbed9966db6e 7146533: [TEST BUG] [macosx] skip java/awt/xembed/server/RunTestXEmbed.java for Mac OS X
kshefov
parents: 31448
diff changeset
   102
        if (Platform.isWindows() || Platform.isOSX()) {
443
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   103
            return;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   104
        }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   105
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   106
        // Enabled XEmbed
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   107
        System.setProperty("sun.awt.xembedserver", "true");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   108
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   109
        if (args.length == 1) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   110
            Class cl = Class.forName("sun.awt.X11.XEmbedServerTester");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   111
            Method meth = cl.getMethod(args[0], new Class[0]);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   112
            System.err.println("Performing single test " + args[0]);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   113
            boolean res = performTest(meth);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   114
            if (!res) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   115
                System.err.println("Test " + args[0] + " has failed");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   116
            } else {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   117
                System.err.println("Test " + args[0] + " has passed");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   118
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   119
        } else {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   120
            Class cl = Class.forName("sun.awt.X11.XEmbedServerTester");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   121
            Method[] meths = cl.getMethods();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   122
            LinkedList failed = new LinkedList();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   123
            for (int i = 0; i < meths.length; i++) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   124
                Method meth = meths[i];
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   125
                if (meth.getReturnType() == Void.TYPE && meth.getName().startsWith("test") && meth.getParameterTypes().length == 0) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   126
                    System.err.println("Performing " + meth.getName());
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   127
                    boolean res = performTest(meth);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   128
                    if (!res) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   129
                        failed.add(meth);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   130
                    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   131
                }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   132
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   133
            log.info("Testing finished.");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   134
            if (failed.size() != 0) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   135
                System.err.println("Some tests have failed:");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   136
                Iterator iter = failed.iterator();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   137
                while(iter.hasNext()) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   138
                    Method meth = (Method)iter.next();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   139
                    System.err.println(meth.getName());
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   140
                }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   141
                throw new RuntimeException("TestFAILED: some of the testcases are failed");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   142
            } else {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   143
                System.err.println("All PASSED");
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   144
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   145
        }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   146
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   147
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   148
    private static boolean performTest(Method meth) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   149
        RunTestXEmbed test = new RunTestXEmbed(meth);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   150
        test.addClient();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   151
        test.dispose();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   152
        return test.isPassed();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   153
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   154
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   155
    public boolean isPassed() {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   156
        return passed;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   157
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   158
}
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   159
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   160
class InputReader extends Thread {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   161
    private InputStream stream;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   162
    public InputReader(InputStream stream) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   163
        this.stream = stream;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   164
        start();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   165
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   166
    public void run() {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   167
        while (!interrupted()) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   168
            try {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   169
                int inp = stream.read();
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   170
                if (inp != -1) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   171
                    System.out.write(inp);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   172
                } else {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   173
                    try {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   174
                        Thread.sleep(100);
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   175
                    } catch (Exception iie) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   176
                    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   177
                }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   178
            } catch (IOException ie) {
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   179
                break;
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   180
            }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   181
        }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   182
    }
b49bc385fa7e 6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff changeset
   183
}