1 /*
   2  * Copyright (c) 2017, 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  *
  28  * @summary converted from VM Testbase nsk/jdwp/EventRequest/Set/set002.
  29  * VM Testbase keywords: [quick, jpda, jdwp]
  30  * VM Testbase readme:
  31  * DESCRIPTION
  32  *     This test performs checking for
  33  *         command set: EventRequest
  34  *         command: Set
  35  *         event kind: VM_START
  36  *     Test checks that debuggee accepts tested command and replies
  37  *     with no error code for VM_START event request. The tests also
  38  *     checks that requested VM_START event is never received after
  39  *     initial automatically generated VM_START event.
  40  *     Test consists of two compoments:
  41  *         debugger: set002
  42  *         debuggee: set002a
  43  *     First, debugger uses nsk.share support classes to launch debuggee
  44  *     and obtain Transport object, that represents JDWP transport channel.
  45  *     Then, debugger creates creates command packet for command
  46  *     EventRequest.Set with VM_START event and no event modifiers;
  47  *     and sends it to debuggee. After reply packet is received
  48  *     debuggeer checks if it has no errors and valid requestID.
  49  *     Then, debugger lets debuggee to run and exit and waits for any event
  50  *     is received. If VM_START event is received, then debugger complains
  51  *     error and removes event request. Otherwise, if event is VM_DEATH
  52  *     the test passes.
  53  *     Finally, debugger disconnectes debuggee, waits for it exits
  54  *     and exits too with proper exit code.
  55  * COMMENTS
  56  *     Test fixed due to test bug:
  57  *     4909273 TEST_BUG: Fix nsk/jdwp/EventRequest/Set/set002
  58  *     Test fixed due to test bug:
  59  *     4973741 nsk/jdwp/EventRequest/Set/set002 expects request for VMStart event to fail
  60  *
  61  * @library /vmTestbase /test/hotspot/jtreg/vmTestbase
  62  *          /test/lib
  63  * @build nsk.jdwp.EventRequest.Set.set002
  64  *        nsk.jdwp.EventRequest.Set.set002a
  65  * @run main/othervm PropertyResolvingWrapper
  66  *      nsk.jdwp.EventRequest.Set.set002
  67  *      -arch=${os.family}-${os.simpleArch}
  68  *      -verbose
  69  *      -waittime=5
  70  *      -debugee.vmkind=java
  71  *      -transport.address=dynamic
  72  *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
  73  */
  74