Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
32285 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 802862326* @summary Test hashing of extended characters in Serviceability Agent.27* @library /testlibrary28* @build com.oracle.java.testlibrary.*29* @compile -encoding utf8 Test8028623.java30* @run main Test802862331*/3233import com.oracle.java.testlibrary.JDKToolLauncher;34import com.oracle.java.testlibrary.OutputBuffer;35import com.oracle.java.testlibrary.Platform;36import com.oracle.java.testlibrary.ProcessTools;3738import java.io.File;3940public class Test8028623 {4142public static int \u00CB = 1;43public static String dumpFile = "heap.out";4445public static void main (String[] args) {4647System.out.println(\u00CB);4849try {50if (!Platform.shouldSAAttach()) {51System.out.println("SA attach not expected to work - test skipped.");52return;53}54int pid = ProcessTools.getProcessId();55JDKToolLauncher jmap = JDKToolLauncher.create("jmap")56.addToolArg("-F")57.addToolArg("-dump:live,format=b,file=" + dumpFile)58.addToolArg(Integer.toString(pid));59ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());60OutputBuffer output = ProcessTools.getOutput(pb);61Process p = pb.start();62int e = p.waitFor();63System.out.println("stdout:");64System.out.println(output.getStdout());65System.out.println("stderr:");66System.out.println(output.getStderr());6768if (e != 0) {69throw new RuntimeException("jmap returns: " + e);70}71if (! new File(dumpFile).exists()) {72throw new RuntimeException("dump file NOT created: '" + dumpFile + "'");73}74} catch (Throwable t) {75t.printStackTrace();76throw new RuntimeException("Test failed with: " + t);77}78}79}808182