8183377: Refactor java/lang/ClassLoader/deadlock shell tests to java
authoramlu
Wed, 26 Jul 2017 09:20:59 +0800
changeset 45943 f259efd4f8df
parent 45942 129bcaa6c5ab
child 45944 882cea808912
8183377: Refactor java/lang/ClassLoader/deadlock shell tests to java Reviewed-by: mchung
jdk/test/java/lang/ClassLoader/deadlock/Alice.java
jdk/test/java/lang/ClassLoader/deadlock/Bob.java
jdk/test/java/lang/ClassLoader/deadlock/DelegateTest.java
jdk/test/java/lang/ClassLoader/deadlock/DelegatingLoader.java
jdk/test/java/lang/ClassLoader/deadlock/Starter.java
jdk/test/java/lang/ClassLoader/deadlock/SupAlice.java
jdk/test/java/lang/ClassLoader/deadlock/SupBob.java
jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh
jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
jdk/test/java/lang/ClassLoader/deadlock/src/comSA/Alice.java
jdk/test/java/lang/ClassLoader/deadlock/src/comSA/SupBob.java
jdk/test/java/lang/ClassLoader/deadlock/src/comSB/Bob.java
jdk/test/java/lang/ClassLoader/deadlock/src/comSB/SupAlice.java
--- a/jdk/test/java/lang/ClassLoader/deadlock/Alice.java	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-package comSA;
-
-public class Alice extends comSB.SupAlice {
-    static {
-        System.out.println("comSA.Alice loaded");
-    }
-}
--- a/jdk/test/java/lang/ClassLoader/deadlock/Bob.java	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-package comSB;
-
-public class Bob extends comSA.SupBob {
-    static {
-        System.out.println("comSB.Bob loaded");
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/deadlock/DelegateTest.java	Wed Jul 26 09:20:59 2017 +0800
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2009, 2017, 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
+ * @bug 4735126
+ * @summary (cl) ClassLoader.loadClass locks all instances in chain when delegating
+ * @modules java.base/java.lang:open
+ *          jdk.compiler
+ * @library /test/lib
+ * @build jdk.test.lib.compiler.CompilerUtils
+ * @run main/othervm -Xlog:class+load DelegateTest one-way
+ * @run main/othervm -Xlog:class+load DelegateTest cross
+ */
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import jdk.test.lib.compiler.CompilerUtils;
+
+public class DelegateTest implements Runnable {
+
+    private static final Path TEST_DIR = Paths.get(System.getProperty("user.dir", "."));
+    private static final Path SRC_DIR = Paths.get(System.getProperty("test.src"), "src");
+
+    private String id;
+    private DelegatingLoader dl;
+    private String startClass;
+
+    private static DelegatingLoader saLoader, sbLoader;
+
+    public static void log(String line) {
+        System.out.println(line);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (!CompilerUtils.compile(SRC_DIR, TEST_DIR)) {
+            throw new RuntimeException("Failed to compile "
+                    + SRC_DIR.toAbsolutePath().toString());
+        }
+
+        URL[] url = new URL[1];
+        try {
+            url[0] = new URL("file://" + TEST_DIR + File.separator);
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        // Set up Classloader delegation hierarchy
+        saLoader = new DelegatingLoader(url);
+        sbLoader = new DelegatingLoader(url);
+
+        String[] saClasses = { "comSA.SupBob", "comSA.Alice" };
+        String[] sbClasses = { "comSB.SupAlice", "comSB.Bob" };
+
+        saLoader.setDelegate(sbClasses, sbLoader);
+        sbLoader.setDelegate(saClasses, saLoader);
+
+        // test one-way delegate
+        String testType = args[0];
+        if (testType.equals("one-way")) {
+            test("comSA.Alice", "comSA.SupBob");
+        } else if (testType.equals("cross")) {
+            // test cross delegate
+            test("comSA.Alice", "comSB.Bob");
+        } else {
+            System.out.println("ERROR: unsupported - " + testType);
+        }
+    }
+
+    private static void test(String clsForSA, String clsForSB) throws InterruptedException {
+        DelegateTest ia = new DelegateTest("SA", saLoader, clsForSA);
+        DelegateTest ib = new DelegateTest("SB", sbLoader, clsForSB);
+        Thread ta = new Thread(ia);
+        Thread tb = new Thread(ib);
+        ta.start();
+        tb.start();
+        ta.join();
+        tb.join();
+    }
+
+    public static void sleep() {
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            log("Thread interrupted");
+        }
+    }
+
+    private DelegateTest(String id, DelegatingLoader dl, String startClass) {
+        this.id = id;
+        this.dl = dl;
+        this.startClass = startClass;
+    }
+
+    public void run() {
+        log("Spawned thread " + id + " running");
+        try {
+            // To mirror the WAS deadlock, need to ensure class load
+            // is routed via the VM.
+            Class.forName(startClass, true, dl);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        log("Thread " + id + " terminating");
+    }
+}
--- a/jdk/test/java/lang/ClassLoader/deadlock/DelegatingLoader.java	Tue Jul 25 22:21:09 2017 +0000
+++ b/jdk/test/java/lang/ClassLoader/deadlock/DelegatingLoader.java	Wed Jul 26 09:20:59 2017 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, 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
@@ -75,7 +75,7 @@
             throws ClassNotFoundException {
         for (int i = 0; i < delClasses.length; i++) {
             if (delClasses[i].equals(className)) {
-                Starter.log("Delegating class loading for " + className);
+                DelegateTest.log("Delegating class loading for " + className);
                 try {
                     Thread.sleep(500);
                 } catch (InterruptedException ie) {
@@ -85,7 +85,7 @@
             }
         }
 
-        Starter.log("Loading local class " + className);
+        DelegateTest.log("Loading local class " + className);
 //        synchronized (getClassLoadingLock(className)) {
             return super.loadClass(className, resolve);
 //        }
--- a/jdk/test/java/lang/ClassLoader/deadlock/Starter.java	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2009, 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 java.net.MalformedURLException;
-import java.net.URL;
-
-public class Starter implements Runnable {
-
-    private String id;
-    private DelegatingLoader dl;
-    private String startClass;
-
-    private static DelegatingLoader saLoader, sbLoader;
-
-    public static void log(String line) {
-        System.out.println(line);
-    }
-
-    public static void main(String[] args) {
-        URL[] urlsa = new URL[1];
-        URL[] urlsb = new URL[1];
-        try {
-            String testDir = System.getProperty("test.classes", ".");
-            String sep = System.getProperty("file.separator");
-            urlsa[0] = new URL("file://" + testDir + sep + "SA" + sep);
-            urlsb[0] = new URL("file://" + testDir + sep + "SB" + sep);
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        }
-        // Set up Classloader delegation hierarchy
-        saLoader = new DelegatingLoader(urlsa);
-        sbLoader = new DelegatingLoader(urlsb);
-
-        String[] saClasses = { "comSA.SupBob", "comSA.Alice" };
-        String[] sbClasses = { "comSB.SupAlice", "comSB.Bob" };
-
-        saLoader.setDelegate(sbClasses, sbLoader);
-        sbLoader.setDelegate(saClasses, saLoader);
-
-        // test one-way delegate
-        String testType = args[0];
-        if (testType.equals("one-way")) {
-            test("comSA.Alice", "comSA.SupBob");
-        } else if (testType.equals("cross")) {
-            // test cross delegate
-            test("comSA.Alice", "comSB.Bob");
-        } else {
-            System.out.println("ERROR: unsupported - " + testType);
-        }
-    }
-
-    private static void test(String clsForSA, String clsForSB) {
-        Starter ia = new Starter("SA", saLoader, clsForSA);
-        Starter ib = new Starter("SB", sbLoader, clsForSB);
-        new Thread(ia).start();
-        new Thread(ib).start();
-    }
-
-    public static void sleep() {
-        try {
-            Thread.sleep(500);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            log("Thread interrupted");
-        }
-    }
-
-    private Starter(String id, DelegatingLoader dl, String startClass) {
-        this.id = id;
-        this.dl = dl;
-        this.startClass = startClass;
-    }
-
-    public void run() {
-        log("Spawned thread " + id + " running");
-        try {
-            // To mirror the WAS deadlock, need to ensure class load
-            // is routed via the VM.
-            Class.forName(startClass, true, dl);
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();
-        }
-        log("Thread " + id + " terminating");
-    }
-}
--- a/jdk/test/java/lang/ClassLoader/deadlock/SupAlice.java	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-package comSB;
-
-public class SupAlice {
-    static {
-        System.out.println("comSB.SupAlice loaded");
-    }
-}
--- a/jdk/test/java/lang/ClassLoader/deadlock/SupBob.java	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-package comSA;
-
-public class SupBob {
-    static {
-        System.out.println("comSA.SupBob loaded");
-    }
-}
--- a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-#
-# Copyright (c) 2009, 2016, 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
-# @bug 4735126
-# @summary (cl) ClassLoader.loadClass locks all instances in chain
-#          when delegating
-#
-# @run shell/timeout=300 TestCrossDelegate.sh
-
-# if running by hand on windows, change TESTSRC and TESTCLASSES to "."
-if [ "${TESTSRC}" = "" ] ; then
-    TESTSRC=`pwd`
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
-    TESTCLASSES=`pwd`
-fi
-
-# if running by hand on windows, change this to appropriate value
-if [ "${TESTJAVA}" = "" ] ; then
-    echo "TESTJAVA not set.  Test cannot execute."
-    echo "FAILED!!!"
-    exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
-    COMPILEJAVA="${TESTJAVA}"
-fi
-
-# set platform-specific variables
-OS=`uname -s`
-case "$OS" in
-  SunOS )
-    FS="/"
-    ;;
-  Linux )
-    FS="/"
-    ;;
-  Darwin )
-    FS="/"
-    ;;
-  AIX )
-    FS="/"
-    ;;
-  Windows*)
-    FS="\\"
-    ;;
-  CYGWIN* )
-    FS="\\"
-    TESTCLASSES=`/usr/bin/cygpath -a -s -m ${TESTCLASSES}`
-    ;;
-esac
-
-echo TESTSRC=${TESTSRC}
-echo TESTCLASSES=${TESTCLASSES}
-echo TESTJAVA=${TESTJAVA}
-echo ""
-
-# compile test
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-        -d ${TESTCLASSES} \
-        ${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java
-
-STATUS=$?
-if [ ${STATUS} -ne 0 ]
-then
-    exit ${STATUS}
-fi
-
-# set up test
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-        -d ${TESTCLASSES}${FS} \
-        ${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \
-        ${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java
-
-cd ${TESTCLASSES}
-DIRS="SA SB"
-for dir in $DIRS
-do
-    if [ -d ${dir} ]; then
-        rm -rf ${dir}
-    fi
-    mkdir ${dir}
-    mv com${dir} ${dir}
-done
-
-# run test
-${TESTJAVA}${FS}bin${FS}java \
-        ${TESTVMOPTS} \
-        --add-opens java.base/java.lang=ALL-UNNAMED \
-        -verbose:class -Xlog:class+load -cp . \
-        -Dtest.classes=${TESTCLASSES} \
-        Starter cross
-# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
-
-# save error status
-STATUS=$?
-
-# clean up
-rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB
-
-# return
-exit ${STATUS}
--- a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh	Tue Jul 25 22:21:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-#
-# Copyright (c) 2009, 2016, 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
-# @bug 4735126
-# @summary (cl) ClassLoader.loadClass locks all instances in chain
-#          when delegating
-#
-# @run shell TestOneWayDelegate.sh
-
-# if running by hand on windows, change TESTSRC and TESTCLASSES to "."
-if [ "${TESTSRC}" = "" ] ; then
-    TESTSRC=`pwd`
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
-    TESTCLASSES=`pwd`
-fi
-
-# if running by hand on windows, change this to appropriate value
-if [ "${TESTJAVA}" = "" ] ; then
-    echo "TESTJAVA not set.  Test cannot execute."
-    echo "FAILED!!!"
-    exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ] ; then
-    COMPILEJAVA="${TESTJAVA}"
-fi
-
-echo TESTSRC=${TESTSRC}
-echo TESTCLASSES=${TESTCLASSES}
-echo TESTJAVA=${TESTJAVA}
-echo COMPILEJAVA=${COMPILEJAVA}
-echo ""
-
-# set platform-specific variables
-OS=`uname -s`
-case "$OS" in
-  SunOS )
-    FS="/"
-    ;;
-  Linux )
-    FS="/"
-    ;;
-  Darwin )
-    FS="/"
-    ;;
-  AIX )
-    FS="/"
-    ;;
-  Windows* | CYGWIN* )
-    FS="\\"
-    ;;
-esac
-
-# compile test
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-        -d ${TESTCLASSES} \
-        ${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java
-
-STATUS=$?
-if [ ${STATUS} -ne 0 ]
-then
-    exit ${STATUS}
-fi
-
-# set up test
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-        -d ${TESTCLASSES}${FS} \
-        ${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \
-        ${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java
-
-cd ${TESTCLASSES}
-DIRS="SA SB"
-for dir in $DIRS
-do
-    if [ -d ${dir} ]; then
-        rm -rf ${dir}
-    fi
-    mkdir ${dir}
-    mv com${dir} ${dir}
-done
-
-# run test
-${TESTJAVA}${FS}bin${FS}java \
-        ${TESTVMOPTS} \
-        --add-opens java.base/java.lang=ALL-UNNAMED \
-        -verbose:class -Xlog:class+load -cp . \
-        -Dtest.classes=${TESTCLASSES} \
-        Starter one-way
-# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
-
-# save error status
-STATUS=$?
-
-# clean up
-rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB
-
-# return
-exit ${STATUS}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/deadlock/src/comSA/Alice.java	Wed Jul 26 09:20:59 2017 +0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+package comSA;
+
+public class Alice extends comSB.SupAlice {
+    static {
+        System.out.println("comSA.Alice loaded");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/deadlock/src/comSA/SupBob.java	Wed Jul 26 09:20:59 2017 +0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+package comSA;
+
+public class SupBob {
+    static {
+        System.out.println("comSA.SupBob loaded");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/deadlock/src/comSB/Bob.java	Wed Jul 26 09:20:59 2017 +0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+package comSB;
+
+public class Bob extends comSA.SupBob {
+    static {
+        System.out.println("comSB.Bob loaded");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/deadlock/src/comSB/SupAlice.java	Wed Jul 26 09:20:59 2017 +0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+package comSB;
+
+public class SupAlice {
+    static {
+        System.out.println("comSB.SupAlice loaded");
+    }
+}