1 /* 2 * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 25 /* 26 * @test 27 * @modules java.base/jdk.internal.misc:+open 28 * 29 * @summary converted from VM Testbase nsk/jdi/VMDisconnectEvent/_itself_/disconnect001. 30 * VM Testbase keywords: [quick, jpda, jdi] 31 * VM Testbase readme: 32 * DESCRIPTION 33 * The test exercises com.sun.jdi.event.VMDisconnectEvent interface. 34 * The test checks the following assertions: 35 * - VMDisconnectEvent is received by debugger when target VM 36 * terminates before disconnection, 37 * - VMDeathEvent is received without creating any EventRequest. 38 * A debugger class - nsk.jdi.VMDisconnectEvent._itself_.disconnect001 ; 39 * a debuggee class - nsk.jdi.VMDisconnectEvent._itself_.disconnect001a . 40 * The test uses supporting nsk/jdi/share classes for launching debuggee 41 * and for creating communication pipe between debugger and debuggee. The 42 * debugger and debugee communicates with special commands. 43 * The debugger starts special thread <EventHandler> for listening events 44 * delivered from debuggee. 45 * The debuggee waits for <QUIT> command from debugger and completes 46 * upon receiving. 47 * The debugger switches <EventHandler> to to listen the event during 48 * the time specified by <waittime> parameter. 49 * If the debugger receives VMDisconnectEvent, it checks all assertions 50 * of the test. Since debugee may been terminated this time, 51 * debugger carefully handles VMDisconnectedException. 52 * The test fails if any of the checks failed. 53 * COMMENTS 54 * Test fixed due to bug: 55 * 4455653 VMDisconnectedException on resume 56 * Test was fixed according to test bug: 57 * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming 58 * - initial IOPipe synchronization is used before starting event handling loop 59 * 60 * @library /vmTestbase 61 * /test/lib 62 * @build nsk.jdi.VMDisconnectEvent._itself_.disconnect001 63 * nsk.jdi.VMDisconnectEvent._itself_.disconnect001a 64 * @run main/othervm 65 * nsk.jdi.VMDisconnectEvent._itself_.disconnect001 66 * -verbose 67 * -arch=${os.family}-${os.simpleArch} 68 * -waittime=5 69 * -debugee.vmkind=java 70 * -transport.address=dynamic 71 * -debugee.vmkeys="${test.vm.opts} ${test.java.opts}" 72 */ 73 74