8048892: TEST_BUG: shell script tests need to be change to not use retired @debuggeeVMOptions mechanism
authorykantser
Tue, 01 Jul 2014 21:23:54 +0200
changeset 25217 2d687ea8608a
parent 25216 291541db1e11
child 25218 4d6cbcbcc437
8048892: TEST_BUG: shell script tests need to be change to not use retired @debuggeeVMOptions mechanism Reviewed-by: sla, jbachorik
jdk/test/com/sun/jdi/PrivateTransportTest.sh
jdk/test/com/sun/jdi/ShellScaffold.sh
jdk/test/com/sun/jdi/SuspendNoFlagTest.java
jdk/test/com/sun/jdi/SuspendNoFlagTest.sh
jdk/test/com/sun/jdi/VMConnection.java
--- a/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Wed Jul 02 09:48:32 2014 +0800
+++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Tue Jul 01 21:23:54 2014 +0200
@@ -82,12 +82,7 @@
 echo "JDK under test is: $TESTJAVA"
 
 # Get flags being sent to debuggee
-DEBUGGEEFLAGS=
-if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
-   DEBUGGEEFLAGS=`cat $TESTCLASSES/@debuggeeVMOptions`
-elif [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-   DEBUGGEEFLAGS=`cat $TESTCLASSES/../@debuggeeVMOptions`
-fi
+DEBUGGEEFLAGS=$TESTVMOPTS $TESTJAVAOPTS
 
 # Figure out what the libarch path is
 os=`uname -s`
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh	Wed Jul 02 09:48:32 2014 +0800
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh	Tue Jul 01 21:23:54 2014 +0200
@@ -882,15 +882,10 @@
 
 startDebuggee()
 {
-    args=
-    # Note that @debuggeeVMOptions is unique to a test run instead of
-    # a test in a run.  It is not modified during a test run.
-    if [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-       args=`cat $TESTCLASSES/../@debuggeeVMOptions`
-    fi
+    args=$TESTVMOPTS $TESTJAVAOPTS
 
     if [ ! -z "$args" ] ; then
-       echo "--Starting debuggee with args from @debuggeeVMOptions: $args"
+       echo "--Starting debuggee with args from TESTVMOPTS and/or TESTJAVAOPTS: $args"
     else
        echo "--Starting debuggee"
     fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/SuspendNoFlagTest.java	Tue Jul 01 21:23:54 2014 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+
+/* @test
+ * @bug 4914611
+ * @summary Test for JDWP: -agentlib:jdwp=suspend=n hanging
+ * @library /lib/testlibrary
+ * @build jdk.testlibarary.*
+ * @compile -g HelloWorld.java
+ * @run driver SuspendNoFlagTest
+ */
+public class SuspendNoFlagTest {
+
+    private static final String TEST_CLASSES = System.getProperty(
+            "test.classes", ".");
+
+    public static void main(String[] args) throws Throwable {
+        OutputAnalyzer output = ProcessTools.executeTestJvm("-classpath",
+                TEST_CLASSES,
+                "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n",
+                "HelloWorld");
+        output.shouldHaveExitValue(0);
+    }
+
+}
--- a/jdk/test/com/sun/jdi/SuspendNoFlagTest.sh	Wed Jul 02 09:48:32 2014 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#!/bin/ksh -p
-
-#
-# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-#   @test       SuspendNoFlagTest.sh
-#   @bug        4914611
-#   @summary    Test for JDWP: -agentlib:jdwp=suspend=n hanging
-#   @author     Kelly O'Hair
-#   Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
-#
-#   @run compile -g HelloWorld.java
-#   @run shell/timeout=60 SuspendNoFlagTest.sh
-#
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail() 
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass() 
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-TARGETCLASS="HelloWorld"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-         TESTJAVA=$1
-      else
-         TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "${TESTCLASSES}" -g \
-            ${TARGETCLASS}.java
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath \"${TESTCLASSES}\""
-#
-DEBUGEEFLAGS=
-if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
-   DEBUGEEFLAGS=`cat $TESTCLASSES/@debuggeeVMOptions`
-elif [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-   DEBUGEEFLAGS=`cat $TESTCLASSES/../@debuggeeVMOptions`
-fi
-DEBUGEEFLAGS="$DEBUGEEFLAGS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n"
-
-java=java
-echo ${TESTJAVA}/bin/$java ${DEBUGEEFLAGS} ${CP} ${TARGETCLASS}
-eval ${TESTJAVA}/bin/$java ${DEBUGEEFLAGS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ] ;
-   then pass "status = 0 and no timeout occured"
-
-   else fail "unspecified test failure (timed out or hung)"
-fi
--- a/jdk/test/com/sun/jdi/VMConnection.java	Wed Jul 02 09:48:32 2014 +0800
+++ b/jdk/test/com/sun/jdi/VMConnection.java	Tue Jul 01 21:23:54 2014 +0200
@@ -44,8 +44,7 @@
     /**
      * Return a String containing VM Options to pass to the debugee
      * or an empty string if there are none.
-     * These are read from the first non-comment line
-     * in file @debuggeeVMOptions in the test.classes dir
+     * These are read from TESTVMOPTS and/or TESTJAVAOPTS.
      */
     static public String getDebuggeeVMOptions() {
         String retVal = "";