Mercurial > hg > truffle
annotate test/serviceability/sa/jmap-hashcode/Test8028623.java @ 21205:f34ae5c01864
include reexecute, rethrow_exception and return_oop info when disassembling debug scopes
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 04 May 2015 10:39:12 +0200 |
parents | 09f19d3de485 |
children |
rev | line source |
---|---|
17681
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
1 /* |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
4 * |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
8 * |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
13 * accompanied this code). |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
14 * |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
18 * |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
21 * questions. |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
22 */ |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
23 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
24 /* |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
25 * @test |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
26 * @bug 8028623 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
27 * @summary Test hashing of extended characters in Serviceability Agent. |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
28 * @library /testlibrary |
17974
09f19d3de485
8043915: Tests get ClassNotFoundException: com.oracle.java.testlibrary.StreamPumper
ykantser
parents:
17682
diff
changeset
|
29 * @build com.oracle.java.testlibrary.* |
17682
fa69b0d09549
8032466: serviceability/sa/jmap-hashcode/Test8028623.java fails with compilation errors
kevinw
parents:
17681
diff
changeset
|
30 * @compile -encoding utf8 Test8028623.java |
fa69b0d09549
8032466: serviceability/sa/jmap-hashcode/Test8028623.java fails with compilation errors
kevinw
parents:
17681
diff
changeset
|
31 * @run main Test8028623 |
17681
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
32 */ |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
33 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
34 import com.oracle.java.testlibrary.JDKToolLauncher; |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
35 import com.oracle.java.testlibrary.OutputBuffer; |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
36 import com.oracle.java.testlibrary.ProcessTools; |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
37 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
38 import java.io.File; |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
39 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
40 public class Test8028623 { |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
41 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
42 public static int à = 1; |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
43 public static String dumpFile = "heap.out"; |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
44 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
45 public static void main (String[] args) { |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
46 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
47 System.out.println(Ã); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
48 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
49 try { |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
50 int pid = ProcessTools.getProcessId(); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
51 JDKToolLauncher jmap = JDKToolLauncher.create("jmap") |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
52 .addToolArg("-F") |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
53 .addToolArg("-dump:live,format=b,file=" + dumpFile) |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
54 .addToolArg(Integer.toString(pid)); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
55 ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
56 OutputBuffer output = ProcessTools.getOutput(pb); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
57 Process p = pb.start(); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
58 int e = p.waitFor(); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
59 System.out.println("stdout:"); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
60 System.out.println(output.getStdout()); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
61 System.out.println("stderr:"); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
62 System.out.println(output.getStderr()); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
63 |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
64 if (e != 0) { |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
65 throw new RuntimeException("jmap returns: " + e); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
66 } |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
67 if (! new File(dumpFile).exists()) { |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
68 throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
69 } |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
70 } catch (Throwable t) { |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
71 t.printStackTrace(); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
72 throw new RuntimeException("Test failed with: " + t); |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
73 } |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
74 } |
6037db01f9dd
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
75 } |