Wed, 21 May 2014 10:56:41 -0700
Added tag jdk8u20-b15 for changeset 8c785f9bde6f
duke@435 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | /** |
duke@435 | 26 | * @test * @bug 0000000 |
duke@435 | 27 | * @summary This is just an exercise of various JDI elements for use in |
duke@435 | 28 | * testing the SA/JDI client |
duke@435 | 29 | * |
duke@435 | 30 | * @author jjh |
duke@435 | 31 | * |
duke@435 | 32 | * @run build TestScaffold VMConnection TargetListener TargetAdapter sagdoit |
duke@435 | 33 | * @run compile -g -source 1.5 sagtarg.java |
duke@435 | 34 | * @run main sagtest |
duke@435 | 35 | */ |
duke@435 | 36 | import com.sun.jdi.*; |
duke@435 | 37 | import com.sun.jdi.event.*; |
duke@435 | 38 | import com.sun.jdi.request.*; |
duke@435 | 39 | |
duke@435 | 40 | import java.util.*; |
duke@435 | 41 | |
duke@435 | 42 | /********** target program **********/ |
duke@435 | 43 | |
duke@435 | 44 | // The target program is sagtarg.java |
duke@435 | 45 | |
duke@435 | 46 | /********** test program **********/ |
duke@435 | 47 | |
duke@435 | 48 | public class sagtest extends TestScaffold { |
duke@435 | 49 | ReferenceType targetClass; |
duke@435 | 50 | ThreadReference mainThread; |
duke@435 | 51 | |
duke@435 | 52 | sagtest (String args[]) { |
duke@435 | 53 | super(args); |
duke@435 | 54 | } |
duke@435 | 55 | |
duke@435 | 56 | public static void main(String[] args) throws Exception { |
duke@435 | 57 | new sagtest(args).startTests(); |
duke@435 | 58 | } |
duke@435 | 59 | |
duke@435 | 60 | /********** event handlers **********/ |
duke@435 | 61 | |
duke@435 | 62 | |
duke@435 | 63 | /********** test core **********/ |
duke@435 | 64 | |
duke@435 | 65 | protected void runTests() throws Exception { |
duke@435 | 66 | /* |
duke@435 | 67 | * Get to the top of main() |
duke@435 | 68 | * to determine targetClass and mainThread |
duke@435 | 69 | */ |
duke@435 | 70 | BreakpointEvent bpe = startToMain("sagtarg"); |
duke@435 | 71 | targetClass = bpe.location().declaringType(); |
duke@435 | 72 | mainThread = bpe.thread(); |
duke@435 | 73 | EventRequestManager erm = vm().eventRequestManager(); |
duke@435 | 74 | stepOverLine(mainThread); //stop on 18 |
duke@435 | 75 | stepOverLine(mainThread); //stop on 19 |
duke@435 | 76 | stepOverLine(mainThread); //stop on 20 |
duke@435 | 77 | stepOverLine(mainThread); //stop on 21 |
duke@435 | 78 | stepOverLine(mainThread); //stop on 22 |
duke@435 | 79 | |
duke@435 | 80 | sagdoit mine = new sagdoit(vm()); |
duke@435 | 81 | mine.doAll(); |
duke@435 | 82 | |
duke@435 | 83 | if (!testFailed) { |
duke@435 | 84 | println("sagtest: passed"); |
duke@435 | 85 | } else { |
duke@435 | 86 | throw new Exception("sagtest: failed"); |
duke@435 | 87 | } |
duke@435 | 88 | } |
duke@435 | 89 | } |