author | yan |
Tue, 23 Jun 2015 11:59:27 +0300 | |
changeset 31448 | 1066345d2a8a |
parent 5506 | 202f599c92aa |
child 34413 | bbed9966db6e |
permissions | -rw-r--r-- |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
1 |
/* |
31448
1066345d2a8a
8076468: Add @modules to tests in jdk_desktop test group
yan
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 2004, 2015, 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 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
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 |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
26 |
* @bug 4931668 |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
27 |
* @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
|
28 |
* @author Denis Mikhalkin: area=awt.xembed |
31448
1066345d2a8a
8076468: Add @modules to tests in jdk_desktop test group
yan
parents:
5506
diff
changeset
|
29 |
* @modules java.desktop/sun.awt |
443
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
30 |
* @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
|
31 |
* @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
|
32 |
*/ |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
33 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
import java.io.*; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
39 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
super(false); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
46 |
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
|
47 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
48 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
49 |
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
|
50 |
try { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
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
|
63 |
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
|
64 |
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
|
65 |
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
|
66 |
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
|
67 |
} else { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
68 |
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
|
69 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
70 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
71 |
Process proc = Runtime.getRuntime().exec(java_home + |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
72 |
"/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient " |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
73 |
+ test.getName() + " " + window + buf, |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
74 |
enva); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
try { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
80 |
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
|
81 |
} 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
|
82 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
83 |
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
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
88 |
return proc; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
89 |
} 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
|
90 |
ex1.printStackTrace(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
91 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
92 |
return null; |
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 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
95 |
public static void main(String[] args) throws Throwable { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
96 |
if (System.getProperty("os.name").toLowerCase().startsWith("win")) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
97 |
return; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
98 |
} |
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 |
// Enabled XEmbed |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
101 |
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
|
102 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
if (!res) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
109 |
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
|
110 |
} else { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
111 |
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
|
112 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
113 |
} else { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
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
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
if (!res) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
123 |
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
|
124 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
125 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
126 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
127 |
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
|
128 |
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
|
129 |
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
|
130 |
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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
135 |
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
|
136 |
} else { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
137 |
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
|
138 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
139 |
} |
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 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
142 |
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
|
143 |
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
|
144 |
test.addClient(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
145 |
test.dispose(); |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
146 |
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
|
147 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
148 |
|
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
149 |
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
|
150 |
return passed; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
151 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
152 |
} |
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 |
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
|
155 |
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
|
156 |
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
|
157 |
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
|
158 |
start(); |
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 |
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
|
161 |
while (!interrupted()) { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
162 |
try { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
} else { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
167 |
try { |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
168 |
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
|
169 |
} 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
|
170 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
171 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
172 |
} 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
|
173 |
break; |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
174 |
} |
b49bc385fa7e
6686273: Some AWT reg. tests should be moved to open repository (for CRs 6444769, 6480547, and 6560348)
volk
parents:
diff
changeset
|
175 |
} |
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 |
} |