HeapDumpTest.java revision 2362
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff/*
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff *
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * This code is free software; you can redistribute it and/or modify it
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * under the terms of the GNU General Public License version 2 only, as
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * published by the Free Software Foundation.
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff *
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * This code is distributed in the hope that it will be useful, but WITHOUT
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * version 2 for more details (a copy is included in the LICENSE file that
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * accompanied this code).
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff *
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * You should have received a copy of the GNU General Public License version
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * 2 along with this work; if not, write to the Free Software Foundation,
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff *
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * or visit www.oracle.com if you need additional information or have any
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * questions.
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff */
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff/* @test
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle * @bug 5012882 6299047
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle * @summary Test jvmti hprof
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle *
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle * @compile -g:source HelloWorld.java ../DemoRun.java
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * @build HeapDumpTest
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff * @run main HeapDumpTest HelloWorld
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff */
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienlepublic class HeapDumpTest {
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle public static void main(String args[]) throws Exception {
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle DemoRun hprof;
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle /* Run JVMTI hprof agent with heap=dump */
c96652ffdb237d5167f5a00a771bf3e298bdbb22Chad Kienle hprof = new DemoRun("hprof", "heap=dump");
ad17b15404fe8bbc97c620669f32311567a9ab84Andi Egloff hprof.runit(args[0]);
9abe33608be5ecedc64fcc7727c885fd04ac5558Andi Egloff
9abe33608be5ecedc64fcc7727c885fd04ac5558Andi Egloff /* Make sure patterns in output look ok */
9abe33608be5ecedc64fcc7727c885fd04ac5558Andi Egloff if (hprof.output_contains("ERROR")) {
9abe33608be5ecedc64fcc7727c885fd04ac5558Andi Egloff throw new RuntimeException("Test failed - ERROR seen in output");
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle }
9abe33608be5ecedc64fcc7727c885fd04ac5558Andi Egloff
9abe33608be5ecedc64fcc7727c885fd04ac5558Andi Egloff /* Must be a pass. */
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle System.out.println("Test passed - cleanly terminated");
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle }
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle}
894623f06f0b765163c8593164cf1cdd2f725819Chad Kienle