author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58312 | ce960527ecee |
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) 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 |
/* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
26 |
* @test |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
27 |
* @bug 8224137 |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
28 |
* @summary Run invokespecial invocation tests |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
29 |
* @library /test/lib |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
30 |
* @modules java.base/jdk.internal.org.objectweb.asm |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
31 |
* java.base/jdk.internal.misc |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
32 |
* @compile shared/AbstractGenerator.java shared/AccessCheck.java shared/AccessType.java |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
33 |
* shared/Caller.java shared/ExecutorGenerator.java shared/Utils.java |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
34 |
* shared/ByteArrayClassLoader.java shared/Checker.java shared/GenericClassGenerator.java |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
35 |
* @compile invokespecial/Checker.java invokespecial/ClassGenerator.java invokespecial/Generator.java |
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 |
* @run main/othervm/timeout=1800 invokespecialTests |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
38 |
*/ |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
39 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
40 |
import jdk.test.lib.process.ProcessTools; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
41 |
import jdk.test.lib.process.OutputAnalyzer; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
42 |
import jdk.test.lib.compiler.InMemoryJavaCompiler; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
43 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
44 |
public class invokespecialTests { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
45 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
46 |
public static void runTest(String classFileVersion, String option) throws Exception { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
47 |
System.out.println("\ninvokespecial invocation tests, option: " + option + |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
48 |
", class file version: " + classFileVersion); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
49 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(false, "-Xmx128M", option, |
58312
ce960527ecee
8231413: Several test/hotspot/jtreg/runtime tests updates to run with --illegal-access=deny
alanb
parents:
55497
diff
changeset
|
50 |
"--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", |
55497
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
51 |
"invokespecial.Generator", "--classfile_version=" + classFileVersion); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
52 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
53 |
try { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
54 |
output.shouldContain("EXECUTION STATUS: PASSED"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
55 |
output.shouldHaveExitValue(0); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
56 |
} catch (Throwable e) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
57 |
System.out.println( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
58 |
"\nNote that an entry such as 'B.m/C.m' in the failure chart means that" + |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
59 |
" the test case failed because method B.m was invoked but the test " + |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
60 |
"expected method C.m to be invoked. Similarly, a result such as 'AME/C.m'" + |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
61 |
" means that an AbstractMethodError exception was thrown but the test" + |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
62 |
" case expected method C.m to be invoked."); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
63 |
System.out.println( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
64 |
"\nAlso note that passing --dump to invokespecial.Generator will" + |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
65 |
" dump the generated classes (for debugging purposes).\n"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
66 |
System.exit(1); |
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 |
public static void main(String args[]) throws Throwable { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
71 |
// Get current major class file version and test with it. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
72 |
byte klassbuf[] = InMemoryJavaCompiler.compile("blah", "public class blah { }"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
73 |
int major_version = klassbuf[6] << 8 | klassbuf[7]; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
74 |
runTest(String.valueOf(major_version), "-Xint"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
75 |
runTest(String.valueOf(major_version), "-Xcomp"); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
76 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
77 |
// Test old class file version. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
78 |
runTest("51", "-Xint"); // JDK-7 |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
79 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
80 |
} |