author | hseigel |
Wed, 26 Jun 2019 09:06:32 -0400 | |
changeset 55497 | d3a33953b936 |
child 55552 | 9bd13d6dea77 |
permissions | -rw-r--r-- |
55497
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
1 |
/* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
2 |
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
4 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
8 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
13 |
* accompanied this code). |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
14 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
18 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
21 |
* questions. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
22 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
23 |
*/ |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
24 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
25 |
package shared; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
26 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
27 |
import java.io.File; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
28 |
import java.io.FileOutputStream; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
29 |
import java.util.Arrays; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
30 |
import java.util.Map; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
31 |
import java.util.List; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
32 |
import java.util.ArrayList; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
33 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
34 |
/** |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
35 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
36 |
*/ |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
37 |
public abstract class AbstractGenerator { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
38 |
protected final boolean dumpClasses; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
39 |
protected final boolean executeTests; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
40 |
private static int testNum = 0; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
41 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
42 |
protected AbstractGenerator(String[] args) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
43 |
List<String> params = new ArrayList<String>(Arrays.asList(args)); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
44 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
45 |
if (params.contains("--help")) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
46 |
Utils.printHelp(); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
47 |
System.exit(0); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
48 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
49 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
50 |
dumpClasses = params.contains("--dump"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
51 |
executeTests = !params.contains("--noexecute"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
52 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
53 |
params.remove("--dump"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
54 |
params.remove("--noexecute"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
55 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
56 |
Utils.init(params); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
57 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
58 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
59 |
/*******************************************************************/ |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
60 |
public static void writeToFile(File dir, Map<String, byte[]> classes) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
61 |
for (String name : classes.keySet()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
62 |
try { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
63 |
writeToFile(dir, name, classes.get(name)); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
64 |
} catch (Exception e) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
65 |
throw new RuntimeException(e); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
66 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
67 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
68 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
69 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
70 |
/*******************************************************************/ |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
71 |
public static void writeToFile(File dir, String fullName, byte[] classBytecode) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
72 |
if (!dir.isDirectory()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
73 |
throw new RuntimeException("Invalid parameter: dir doesn't point to an existing directory"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
74 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
75 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
76 |
File classFile = |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
77 |
new File( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
78 |
dir.getPath() + File.separator |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
79 |
+ fullName.replaceAll("\\.", File.separator) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
80 |
+ ".class" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
81 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
82 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
83 |
classFile.getParentFile().mkdirs(); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
84 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
85 |
try { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
86 |
FileOutputStream fos = new FileOutputStream(classFile); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
87 |
try { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
88 |
fos.write(classBytecode); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
89 |
} finally { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
90 |
fos.close(); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
91 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
92 |
} catch (Exception e) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
93 |
throw new RuntimeException(e); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
94 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
95 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
96 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
97 |
protected boolean exec(Map<String, byte[]> classes, String description, String calleeClassName, String classNameC, String[] callSites) throws ClassNotFoundException { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
98 |
boolean isPassed = true; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
99 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
100 |
testNum++; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
101 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
102 |
String caseDescription = String.format("%4d| %s", testNum, description); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
103 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
104 |
// Create test executor for a single case |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
105 |
classes.put( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
106 |
ExecutorGenerator.className |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
107 |
, new ExecutorGenerator( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
108 |
caseDescription |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
109 |
, calleeClassName |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
110 |
, classNameC |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
111 |
).generateExecutor(callSites) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
112 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
113 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
114 |
// Dump generated set to disk, if needed |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
115 |
if (dumpClasses) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
116 |
File dir = new File("classes" + File.separator + String.format("%04d", testNum)); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
117 |
dir.mkdirs(); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
118 |
writeToFile(dir, classes); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
119 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
120 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
121 |
ByteArrayClassLoader loader = new ByteArrayClassLoader(classes); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
122 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
123 |
Class paramClass; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
124 |
Class targetClass; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
125 |
Checker checker; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
126 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
127 |
try { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
128 |
paramClass = loader.loadClass(calleeClassName); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
129 |
targetClass = loader.loadClass(classNameC); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
130 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
131 |
checker = getChecker(paramClass, targetClass); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
132 |
} catch (Throwable e) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
133 |
String result = Checker.abbreviateResult(e.getClass().getName()); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
134 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
135 |
System.out.printf(caseDescription); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
136 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
137 |
for (String site : callSites) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
138 |
System.out.printf(" %7s", result); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
139 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
140 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
141 |
System.out.println(""); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
142 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
143 |
return true; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
144 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
145 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
146 |
if (executeTests) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
147 |
// Check runtime behavior |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
148 |
Caller caller = new Caller(loader, checker, paramClass, targetClass); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
149 |
boolean printedCaseDes = false; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
150 |
for (String site : callSites) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
151 |
String callResult = caller.call(site); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
152 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
153 |
if (!caller.isPassed()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
154 |
isPassed = false; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
155 |
if (!printedCaseDes) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
156 |
System.out.printf(caseDescription); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
157 |
printedCaseDes = true; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
158 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
159 |
System.out.printf(" %7s", callResult); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
160 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
161 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
162 |
if (!caller.isPassed()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
163 |
System.out.println(" | FAILED"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
164 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
165 |
} else { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
166 |
for (String site : callSites) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
167 |
String result = checker.check(loader.loadClass(site)); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
168 |
System.out.printf(" %7s", Checker.abbreviateResult(result)); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
169 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
170 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
171 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
172 |
return isPassed; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
173 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
174 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
175 |
protected abstract Checker getChecker(Class paramClass, Class targetClass); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
176 |
} |