changeset 8415:f5968b136d75

7127906: (launcher) convert the launcher regression tests to java Reviewed-by: darcy, naoto
author ksrini
date Mon, 11 Apr 2016 21:39:08 +0100
parents 21982fe20d63
children 233a2b4b7309
files test/tools/launcher/ChangeDataModel.java test/tools/launcher/ChangeDataModel.sh test/tools/launcher/CreatePlatformFile.java test/tools/launcher/ExecutionEnvironment.java test/tools/launcher/I18NJarTest.java test/tools/launcher/I18NTest.java test/tools/launcher/MiscTests.java test/tools/launcher/Settings.java test/tools/launcher/SomeException.java test/tools/launcher/Test7029048.java test/tools/launcher/TestHelper.java test/tools/launcher/UnicodeCleanup.java test/tools/launcher/UnicodeTest.java test/tools/launcher/UnicodeTest.sh test/tools/launcher/UnresolvedExceptions.java test/tools/launcher/deleteI18n.sh test/tools/launcher/i18nTest.sh test/tools/launcher/unresolvedExceptions.sh
diffstat 18 files changed, 624 insertions(+), 989 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/ChangeDataModel.java	Mon Apr 11 21:39:08 2016 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2012, 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 4894330 4810347 6277269
+ * @compile -XDignore.symbol.file ChangeDataModel.java
+ * @run main ChangeDataModel
+ * @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms
+ * @author Joseph D. Darcy, ksrini
+ */
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ChangeDataModel extends TestHelper {
+    private static final File TestJar      = new File("test" + JAR_FILE_EXT);
+    private static final String OPT_PREFIX = "ARCH_OPT:";
+
+    public static void main(String... args) throws Exception {
+        String[] code = {
+            "   public static void main(String argv[]) {",
+            "      System.out.println(\"" + OPT_PREFIX + "-d\" + System.getProperty(\"sun.arch.data.model\", \"none\"));",
+            "   }",
+        };
+        createJar(TestJar, code);
+
+        // verify if data model flag for default data model is accepted
+        if (is32Bit) {
+            checkAcceptance(javaCmd, "-d32");
+        } else if (is64Bit) {
+            checkAcceptance(javaCmd, "-d64");
+        } else {
+            throw new Error("unsupported data model");
+        }
+
+        // test dual mode systems
+        if (isDualMode) {
+            // albeit dual mode we may not have the 64 bit components present
+            if (dualModePresent()) {
+                // 32-bit -> 64-bit
+                checkExecCount(javaCmd, "-d64");
+                // 64-bit -> 32-bit
+                checkExecCount(java64Cmd, "-d32");
+
+                checkAcceptance(javaCmd, "-d64");
+                checkAcceptance(java64Cmd, "-d32");
+            } else {
+                System.out.println("Warning: no 64-bit components found;" +
+                    " only one data model tested.");
+            }
+        } else {
+            // Negative tests: ensure that non-dual mode systems reject the
+            // complementary (other) data model
+            if (is32Bit) {
+                checkRejection(javaCmd, "-d64");
+            } else if (is64Bit) {
+                checkRejection(javaCmd, "-d32");
+            } else {
+                throw new Error("unsupported data model");
+            }
+        }
+    }
+
+    static void checkExecCount(String cmd, String dmodel) {
+        Map<String, String> envMap = new HashMap<>();
+        envMap.put(JLDEBUG_KEY, "true");
+        TestResult tr = doExec(envMap, javaCmd, "-d64",
+                "-jar", TestJar.getAbsolutePath());
+        int count = 0;
+        for (String x : tr.testOutput) {
+            if (x.contains(EXPECTED_MARKER)) {
+                count++;
+                if (count > 1) {
+                    System.out.println(tr);
+                    throw new RuntimeException("Maximum exec count of 1 execeeded");
+                }
+            }
+        }
+    }
+
+    static void checkAcceptance(String cmd, String dmodel) {
+        TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath());
+        if (!tr.contains(OPT_PREFIX + dmodel)) {
+            System.out.println(tr);
+            String message = "Data model flag " + dmodel +
+                    " not accepted or had improper effect.";
+            throw new RuntimeException(message);
+        }
+    }
+
+    static void checkRejection(String cmd, String dmodel) {
+        TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath());
+        if (tr.contains(OPT_PREFIX + dmodel)) {
+            System.out.println(tr);
+            String message = "Data model flag " + dmodel + " was accepted.";
+            throw new RuntimeException(message);
+        }
+    }
+}
--- a/test/tools/launcher/ChangeDataModel.sh	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,269 +0,0 @@
-#
-# Copyright (c) 2003, 2012, 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 4894330 4810347 6277269
-# @run shell ChangeDataModel.sh
-# @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms 
-# @author Joseph D. Darcy
-
-OS=`uname -s`;
-
-# To remove CR from output, needed for java apps in CYGWIN, harmless otherwise
-SED_CR="sed -e s@\\r@@g"
-
-case "$OS" in
-	Windows* | CYGWIN* )
-	  PATHSEP=";"
-	  ;;
-
-	* )
-	  PATHSEP=":"
-	;;
-esac
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# Construct paths to default Java executables
-JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES${PATHSEP}."
-JAVAC="$TESTJAVA/bin/javac"
-
-
-# Create our little Java test on the fly
-( printf "public class GetDataModel {"
-  printf "   public static void main(String argv[]) {"
-  printf "      System.out.println(System.getProperty(\"sun.arch.data.model\", \"none\"));"
-  printf "   }"
-  printf "}"
-) > GetDataModel.java
-
-$JAVAC GetDataModel.java
-
-
-# All preconditions are met; run the tests.
-
-
-# Verify data model flag for default data model is accepted
-
-DM=`$JAVA GetDataModel | ${SED_CR}`
-case "$DM" in
-        32 )
-		DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}`	
-		if [ "${DM2}" != "32" ]
-		then
-	  	echo "Data model flag -d32 not accepted or had improper effect."
-	  	exit 1
-		fi
-        ;;
-
-        64 )
-		DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}`	
-		if [ "${DM2}" != "64" ]
-		then
-	  	echo "Data model flag -d64 not accepted or had improper effect."
-	  	exit 1
-		fi
-	;;
-
-	* )
-		echo "Unrecognized data model: $DM"
-        	exit 1
-	;;
-esac
-
-# Determine if platform might be dual-mode capable.
-
-case "$OS" in
-	SunOS )
-		# ARCH should be sparc or i386
-		ARCH=`uname -p`
-		case "${ARCH}" in 
-			sparc )
-			DUALMODE=true
-			PATH64=sparcv9
-			;;
-
-			i386 )
-			DUALMODE=true
-			PATH64=amd64
-			;;
-
-			* )
-			DUALMODE=false
-			;;
-		esac
-	;;
-
-
-	Linux )
-		# ARCH should be ia64, x86_64, or i*86
-		ARCH=`uname -m`
-		case "${ARCH}" in 
-			ia64 )
-			DUALMODE=false
-			;;
-
-			x86_64 )
-			DUALMODE=true
-			PATH64=amd64
-			;;
-
-			* )
-			DUALMODE=false;
-			;;
-		esac
-	;;
-
-	Windows* | CYGWIN* )
-		ARCH=`uname -m`
-		case "${ARCH}" in 
-			* )
-			DUALMODE=false;
-			;;
-		esac
-	;;
-
-        Darwin )
-                ARCH=`uname -m`
-                case "${ARCH}" in
-                        * )
-                        DUALMODE=false;
-                        ;;
-                esac
-        ;;
-
-	* )
-		echo "Warning: unknown environment."
-		DUALMODE=false
-	;;
-esac
-
-if [ "${DUALMODE}" = "true" ]
-then
-	# Construct path to 64-bit Java executable, might not exist
-	JAVA64FILE="${TESTJAVA}/bin/${PATH64}/java"
-	JAVA64="${JAVA64FILE} -classpath ${TESTCLASSES}${PATHSEP}."
-
-	if [ -f ${JAVA64FILE} ]; then
-		# Verify that, at least on Solaris, only one exec is
-		# used to change data models
-		if [ "${OS}" = "SunOS" ]
-		then
-			rm -f truss.out
-			truss -texec ${JAVA} -d64 GetDataModel > /dev/null 2> truss.out
-			execCount=`grep -c execve truss.out`
-			if [ "${execCount}" -gt 2 ]
-			then
-				echo "Maximum exec count of 2 exceeded: got $execCount."
-				exit 1
-			fi
-
-			rm -f truss.out
-			truss -texec ${JAVA64} -d32 GetDataModel > /dev/null 2> truss.out
-			execCount=`grep -c execve truss.out`
-			if [ "${execCount}" -gt 2 ]
-			then
-				echo "Maximum exec count of 2 exceeded: got $execCount."
-				exit 1
-			fi
-		fi
-
-		DM2=`${JAVA} -d64 GetDataModel`
-		if [ "${DM2}" != "64" ]
-		then
-		  echo "Data model flag -d64 not accepted or had improper effect."
-		  exit 1
-		fi
-
-		DM2=`${JAVA64} GetDataModel`
-		if [ "${DM2}" != "64" ]
-		then
-		  echo "Improper data model returned."
-		  exit 1
-		fi
-
-		DM2=`${JAVA64} -d64 GetDataModel`
-		if [ "${DM2}" != "64" ]
-		then
-		  echo "Data model flag -d64 not accepted or had improper effect."
-		  exit 1
-		fi
-
-		DM2=`${JAVA64} -d32 GetDataModel`
-		if [ "${DM2}" != "32" ]
-		then
-		  echo "Data model flag -d32 not accepted or had improper effect."
-		  exit 1
-		fi
-
-	else
-	  echo "Warning: no 64-bit components found; only one data model tested."
-	fi
-else
-# Negative tests for non-dual mode platforms to ensure the other data model is 
-# rejected
-	DM=`$JAVA GetDataModel | ${SED_CR}`
-	case "$DM" in
-	   32 )
-		DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}`	
-		if [ "x${DM2}" != "x" ]
-		then
-		   echo "Data model flag -d64 was accepted."
-		   exit 1
-		fi
-           ;;
-
-	   64 )
-		DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}`	
-		if [ "x${DM2}" != "x" ]
-		  then
-		    echo "Data model flag -d32 was accepted."
-	  	    exit 1
-		fi
-	   ;;
-
-	   * )
-		echo "Unrecognized data model: $DM"
-        	exit 1
-	   ;;
-        esac
-fi
-
-exit 0;
--- a/test/tools/launcher/CreatePlatformFile.java	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-/*
- *
- *
- * This class is used by test i18nTest.sh
- *
- * Class to create various i18n Hello World Java source files using
- * the platform's default encoding of a non-ASCII name; create plain
- * ASCII Hello World if the platform's default is charset is US-ASCII.
- */
-
-import java.io.PrintWriter;
-import java.io.FileOutputStream;
-
-public class CreatePlatformFile {
-    public static void main(String argv[])  {
-        String fileSep = System.getProperty("file.separator");
-        String defaultEncoding = System.getProperty("file.encoding");
-
-        if(defaultEncoding == null) {
-            System.err.println("Default encoding not found; Error.");
-            return;
-        }
-
-        if (defaultEncoding.equals("Cp1252") ) {
-            // "HelloWorld" with an accented e
-            String fileName = "i18nH\u00e9lloWorld.java";
-            try {
-                PrintWriter pw = new PrintWriter(new FileOutputStream("."+fileSep+fileName));
-                pw.println("public class i18nH\u00e9lloWorld {");
-                pw.println("    public static void main(String [] argv) {");
-                pw.println("        System.out.println(\"Hello Cp1252 World\");");
-                pw.println("    }");
-                pw.println("}");
-                pw.flush();
-                pw.close();
-            }
-            catch (java.io.FileNotFoundException e) {
-                System.err.println("Problem opening file; test fails");
-            }
-
-        } else {
-            // ASCII "HelloWorld"
-            String fileName = "i18nHelloWorld.java";
-            try {
-                PrintWriter pw = new PrintWriter(new FileOutputStream("."+fileSep+fileName));
-                pw.println("public class i18nHelloWorld {");
-                pw.println("    public static void main(String [] argv) {");
-                pw.println("        System.out.println(\"Warning: US-ASCII assumed; filenames with\");");
-                pw.println("        System.out.println(\"non-ASCII characters will not be tested\");");
-                pw.println("    }");
-                pw.println("}");
-                pw.flush();
-                pw.close();
-            }
-            catch (java.io.FileNotFoundException e) {
-                System.err.println("Problem opening file; test fails");
-            }
-        }
-    }
-}
--- a/test/tools/launcher/ExecutionEnvironment.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/ExecutionEnvironment.java	Mon Apr 11 21:39:08 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, 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
@@ -25,8 +25,8 @@
  * @test
  * @bug 4780570 4731671 6354700 6367077 6670965 4882974
  * @summary Checks for LD_LIBRARY_PATH and execution  on *nixes
- * @compile -XDignore.symbol.file ExecutionEnvironment.java TestHelper.java
- * @run main ExecutionEnvironment
+ * @compile -XDignore.symbol.file ExecutionEnvironment.java
+ * @run main/othervm ExecutionEnvironment
  */
 
 /*
@@ -46,6 +46,7 @@
  *            b. LD_LIBRARY_PATH32 is ignored if set
  *   5. no extra symlink exists on Solaris ie.
  *      jre/lib/$arch/libjvm.so -> client/libjvm.so
+ *   6. we also test to ensure the 64-bit isadir exists and contains appropriate links.
  * TODO:
  *      a. perhaps we need to add a test to audit all environment variables are
  *         in pristine condition after the launch, there may be a few that the
@@ -54,13 +55,19 @@
  */
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import static java.nio.file.LinkOption.*;
+import java.util.regex.Pattern;
 
 
-public class ExecutionEnvironment {
+public class ExecutionEnvironment extends TestHelper {
     static final String LD_LIBRARY_PATH    = TestHelper.isMacOSX
             ? "DYLD_LIBRARY_PATH"
             : TestHelper.isAIX
@@ -74,9 +81,6 @@
     static final String LD_LIBRARY_PATH_32_VALUE = "/Lawrence/Of/Arabia";
     static final String LD_LIBRARY_PATH_64_VALUE = "/A/Passage/To/India";
 
-    static final String JLDEBUG_KEY = "_JAVA_LAUNCHER_DEBUG";
-    static final String EXPECTED_MARKER = "TRACER_MARKER:About to EXEC";
-
     static final String[] LD_PATH_STRINGS = {
         LD_LIBRARY_PATH + "=" + LD_LIBRARY_PATH_VALUE,
         LD_LIBRARY_PATH_32 + "=" + LD_LIBRARY_PATH_32_VALUE,
@@ -85,16 +89,17 @@
 
     static final File testJarFile = new File("EcoFriendly.jar");
 
-    static int errors = 0;
-    static int passes = 0;
-
-    static final String LIBJVM = TestHelper.isWindows
+    static final String LIBJVM = isWindows
             ? "jvm.dll"
             : "libjvm" + (TestHelper.isMacOSX ? ".dylib" : ".so");
 
+    public ExecutionEnvironment() {
+        createTestJar();
+    }
+
     static void createTestJar() {
         try {
-            List<String> codeList = new ArrayList<String>();
+            List<String> codeList = new ArrayList<>();
             codeList.add("static void printValue(String name, boolean property) {\n");
             codeList.add("    String value = (property) ? System.getProperty(name) : System.getenv(name);\n");
             codeList.add("    System.out.println(name + \"=\" + value);\n");
@@ -111,41 +116,51 @@
             codeList.add("    printValue(\"" + LD_LIBRARY_PATH_64 + "\", false);\n");
             codeList.add("}\n");
             String[] clist = new String[codeList.size()];
-            TestHelper.createJar(testJarFile, codeList.toArray(clist));
+            createJar(testJarFile, codeList.toArray(clist));
         } catch (FileNotFoundException fnfe) {
             throw new RuntimeException(fnfe);
         }
     }
-
+    private void flagError(TestResult tr, String message) {
+        System.err.println(tr);
+        throw new RuntimeException(message);
+    }
     /*
      * tests if the launcher pollutes the LD_LIBRARY_PATH variables ie. there
      * should not be any new variables or pollution/mutations of any kind, the
      * environment should be pristine.
      */
-    private static void ensureEcoFriendly() {
-        TestHelper.TestResult tr = null;
+    @Test
+    void testEcoFriendly() {
+        TestResult tr = null;
 
-        Map<String, String> env = new HashMap<String, String>();
+        Map<String, String> env = new HashMap<>();
         for (String x : LD_PATH_STRINGS) {
             String pairs[] = x.split("=");
             env.put(pairs[0], pairs[1]);
         }
 
-        tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
-                testJarFile.getAbsolutePath());
+        tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
 
         if (!tr.isNotZeroOutput()) {
-            System.out.println(tr);
-            throw new RuntimeException("Error: No output at all. Did the test execute ?");
+            flagError(tr, "Error: No output at all. Did the test execute ?");
         }
 
         for (String x : LD_PATH_STRINGS) {
             if (!tr.contains(x)) {
-                System.out.println("FAIL: did not get <" + x + ">");
-                System.out.println(tr);
-                errors++;
-            } else {
-                passes++;
+                if (TestHelper.isAIX && x.startsWith(LD_LIBRARY_PATH)) {
+                    // AIX does not support the '-rpath' linker options so the
+                    // launchers have to prepend the jdk library path to 'LIBPATH'.
+                    String aixLibPath = LD_LIBRARY_PATH + "=" +
+                        System.getenv(LD_LIBRARY_PATH) +
+                        System.getProperty("path.separator") + LD_LIBRARY_PATH_VALUE;
+                    if (!tr.matches(aixLibPath)) {
+                        flagError(tr, "FAIL: did not get <" + aixLibPath + ">");
+                    }
+                }
+                else {
+                    flagError(tr, "FAIL: did not get <" + x + ">");
+                }
             }
         }
     }
@@ -154,20 +169,15 @@
      * ensures that there are no execs as long as we are in the same
      * data model
      */
-    static void ensureNoExec() {
-        Map<String, String> env = new HashMap<String, String>();
+    @Test
+    void testNoExec() {
+        Map<String, String> env = new HashMap<>();
         env.put(JLDEBUG_KEY, "true");
-        TestHelper.TestResult tr =
-                TestHelper.doExec(env, TestHelper.javaCmd, "-version");
+        TestResult tr = doExec(env, javaCmd, "-version");
         if (tr.testOutput.contains(EXPECTED_MARKER)) {
-            System.out.println("FAIL: EnsureNoExecs: found expected warning <" +
-                    EXPECTED_MARKER +
+            flagError(tr, "testNoExec: found  warning <" + EXPECTED_MARKER +
                     "> the process execing ?");
-            errors++;
-        } else {
-            passes++;
         }
-        return;
     }
 
     /*
@@ -180,27 +190,25 @@
      * For Solaris 64-bit
      *    * The LD_LIBRARY_PATH_64 should override LD_LIBRARY_PATH if specified
      */
+    @Test
+    void testJavaLibraryPath() {
+        TestResult tr = null;
 
-    static void verifyJavaLibraryPath() {
-        TestHelper.TestResult tr = null;
+        Map<String, String> env = new HashMap<>();
 
-        Map<String, String> env = new HashMap<String, String>();
-
-        if (TestHelper.isLinux || TestHelper.isMacOSX || TestHelper.isAIX) {
+        if (isLinux || isMacOSX || isAIX) {
             for (String x : LD_PATH_STRINGS) {
                 String pairs[] = x.split("=");
                 env.put(pairs[0], pairs[1]);
             }
 
-            tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
-                    testJarFile.getAbsolutePath());
+            tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
             verifyJavaLibraryPathGeneric(tr);
-        } else {
+        } else { // Solaris
             // no override
             env.clear();
             env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
-            tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
-                    testJarFile.getAbsolutePath());
+            tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
             verifyJavaLibraryPathGeneric(tr);
 
             env.clear();
@@ -212,86 +220,72 @@
             // verify the override occurs, since we know the invocation always
             // uses by default is 32-bit, therefore we also set the test
             // expectation to be the same.
-            tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
-                    testJarFile.getAbsolutePath());
+            tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
             verifyJavaLibraryPathOverride(tr, true);
 
             // try changing the model from 32 to 64 bit
-            if (TestHelper.dualModePresent() && TestHelper.is32Bit) {
+            if (dualModePresent() && is32Bit) {
                 // verify the override occurs
                 env.clear();
                 for (String x : LD_PATH_STRINGS) {
                     String pairs[] = x.split("=");
                     env.put(pairs[0], pairs[1]);
                 }
-                tr = TestHelper.doExec(env, TestHelper.javaCmd, "-d64", "-jar",
+                tr = doExec(env, javaCmd, "-d64", "-jar",
                     testJarFile.getAbsolutePath());
                 verifyJavaLibraryPathOverride(tr, false);
 
                 // no override
                 env.clear();
                 env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
-                tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
+                tr = doExec(env, javaCmd, "-jar",
                         testJarFile.getAbsolutePath());
                 verifyJavaLibraryPathGeneric(tr);
             }
 
             // try changing the model from 64 to 32 bit
-            if (TestHelper.java64Cmd != null && TestHelper.is64Bit) {
+            if (java64Cmd != null && is64Bit) {
                 // verify the override occurs
                 env.clear();
                 for (String x : LD_PATH_STRINGS) {
                     String pairs[] = x.split("=");
                     env.put(pairs[0], pairs[1]);
                 }
-                tr = TestHelper.doExec(env, TestHelper.java64Cmd, "-d32", "-jar",
+                tr = doExec(env, java64Cmd, "-d32", "-jar",
                     testJarFile.getAbsolutePath());
                 verifyJavaLibraryPathOverride(tr, true);
 
                 // no override
                 env.clear();
                 env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
-                tr = TestHelper.doExec(env, TestHelper.java64Cmd, "-d32", "-jar",
+                tr = doExec(env, java64Cmd, "-d32", "-jar",
                         testJarFile.getAbsolutePath());
                 verifyJavaLibraryPathGeneric(tr);
             }
         }
     }
 
-    private static void verifyJavaLibraryPathGeneric(TestHelper.TestResult tr) {
+    private void verifyJavaLibraryPathGeneric(TestResult tr) {
         if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
-            System.out.print("FAIL: verifyJavaLibraryPath: ");
-            System.out.println(" java.library.path does not contain " +
+            flagError(tr, "testJavaLibraryPath: java.library.path does not contain " +
                     LD_LIBRARY_PATH_VALUE);
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
         }
     }
 
-    private static void verifyJavaLibraryPathOverride(TestHelper.TestResult tr,
+    private void verifyJavaLibraryPathOverride(TestResult tr,
             boolean is32Bit) {
         // make sure the 32/64 bit value exists
         if (!tr.matches("java.library.path=.*" +
                 (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) {
-            System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
-            System.out.println(" java.library.path does not contain " +
+            flagError(tr, "verifyJavaLibraryPathOverride: " +
+                " java.library.path does not contain " +
                     (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE));
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
+
         }
         // make sure the generic value is absent
-        if (tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
-            System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
-            System.out.println(" java.library.path contains " +
-                    LD_LIBRARY_PATH_VALUE);
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
+        if (!tr.notMatches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
+            flagError(tr, "verifyJavaLibraryPathOverride: " +
+                    " java.library.path contains " + LD_LIBRARY_PATH_VALUE);
         }
     }
 
@@ -299,68 +293,96 @@
      * ensures we have indeed exec'ed the correct vm of choice, all VMs support
      * -server, however 32-bit VMs support -client and -server.
      */
-    static void verifyVmSelection() {
+    @Test
+    void testVmSelection() {
 
-        TestHelper.TestResult tr = null;
+        TestResult tr = null;
 
-        if (TestHelper.is32Bit) {
-            tr = TestHelper.doExec(TestHelper.javaCmd, "-client", "-version");
+        if (is32Bit) {
+            tr = doExec(javaCmd, "-client", "-version");
             if (!tr.matches(".*Client VM.*")) {
-                System.out.println("FAIL: the expected vm -client did launch");
-                System.out.println(tr);
-                errors++;
-            } else {
-                passes++;
+                flagError(tr, "the expected vm -client did not launch");
             }
         }
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-server", "-version");
+        tr = doExec(javaCmd, "-server", "-version");
         if (!tr.matches(".*Server VM.*")) {
-            System.out.println("FAIL: the expected vm -server did launch");
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
+            flagError(tr, "the expected vm -server did not launch");
         }
     }
 
     /*
      * checks to see there is no extra libjvm.so than needed
      */
-    static void verifyNoSymLink() {
-        if (TestHelper.is64Bit) {
+    @Test
+    void testNoSymLink() {
+        if (is64Bit) {
             return;
         }
 
         File symLink = null;
-        String libPathPrefix = TestHelper.isSDK ? "jre/lib" : "/lib";
-        symLink = new File(TestHelper.JAVAHOME, libPathPrefix +
-                TestHelper.getJreArch() + "/" + LIBJVM);
+        String libPathPrefix = isSDK ? "jre/lib" : "/lib";
+        symLink = new File(JAVAHOME, libPathPrefix +
+                getJreArch() + "/" + LIBJVM);
         if (symLink.exists()) {
-            System.out.println("FAIL: The symlink exists " +
-                    symLink.getAbsolutePath());
-            errors++;
-        } else {
-            passes++;
+            throw new RuntimeException("symlink exists " + symLink.getAbsolutePath());
         }
     }
 
+    /*
+     * verify if all the symlinks in the images are created correctly,
+     * only on solaris, this test works only on images.
+     */
+    @Test
+    void testSymLinks() throws Exception {
+        if (!isSolaris)
+            return;
+        verifySymLinks(JAVA_BIN);
+        verifySymLinks(JAVA_JRE_BIN);
+    }
+    // exclude non-consequential binaries or scripts co-packaged in other
+    // build phases
+    private final String excludeRE =
+            ".*jvisualvm.*" +
+            "|.*javaws.*" +
+            "|.*ControlPanel.*" +
+            "|.*java-rmi.cgi" +
+            "|.*jcontrol.*";
+    private final Pattern symlinkExcludes = Pattern.compile(excludeRE);
+
+    private void verifySymLinks(String bindir) throws IOException {
+        File binDir = new File(bindir);
+        System.err.println("verifying links in: " + bindir);
+        File isaDir = new File(binDir, getArch()).getAbsoluteFile();
+        if (!isaDir.exists()) {
+            throw new RuntimeException("dir: " + isaDir + " does not exist");
+        }
+        try (DirectoryStream<Path> ds = Files.newDirectoryStream(binDir.toPath())) {
+            for (Path p : ds) {
+                if (symlinkExcludes.matcher(p.toString()).matches() ||
+                        Files.isDirectory(p, NOFOLLOW_LINKS)) {
+                    continue;
+                }
+                Path link = new File(isaDir, p.getFileName().toString()).toPath();
+                if (Files.isSymbolicLink(link)) {
+                    Path target = Files.readSymbolicLink(link);
+                    if (target.startsWith("..") && p.endsWith(target.getFileName())) {
+                        // System.out.println(target + " OK");
+                        continue;
+                    }
+                    System.err.println("target:" + target);
+                    System.err.println("file:" + p);
+                }
+                throw new RuntimeException("could not find link to " + p);
+            }
+        }
+
+    }
     public static void main(String... args) throws Exception {
-        if (TestHelper.isWindows) {
-            System.out.println("Warning: noop on windows");
+        if (isWindows) {
+            System.err.println("Warning: test not applicable to windows");
             return;
         }
-        // create our test jar first
-        createTestJar();
-        ensureNoExec();
-        verifyVmSelection();
-        ensureEcoFriendly();
-        verifyJavaLibraryPath();
-        verifyNoSymLink();
-        if (errors > 0) {
-            throw new Exception("ExecutionEnvironment: FAIL: with " +
-                    errors + " errors and passes " + passes );
-        } else {
-            System.out.println("ExecutionEnvironment: PASS " + passes);
-        }
+        ExecutionEnvironment ee = new ExecutionEnvironment();
+        ee.run(args);
     }
 }
--- a/test/tools/launcher/I18NJarTest.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/I18NJarTest.java	Mon Apr 11 21:39:08 2016 +0100
@@ -26,7 +26,7 @@
  * @bug 7125442
  * @summary ensures a jar path as well as a class located in a path containing
  *          unicode characters are launched.
- * @compile -XDignore.symbol.file I18NJarTest.java TestHelper.java
+ * @compile -XDignore.symbol.file I18NJarTest.java
  * @run main/othervm I18NJarTest
  */
 import java.io.File;
@@ -48,7 +48,7 @@
  * in its own VM (othervm mode), such that the ensuing tests can run unperturbed,
  * regardless of the outcome.
  */
-public class I18NJarTest {
+public class I18NJarTest extends TestHelper {
     private static final File cwd = new File(".");
     private static final File dir = new File("\uFF66\uFF67\uFF68\uFF69");
     private static final String encoding = System.getProperty("sun.jnu.encoding", "");
@@ -89,7 +89,7 @@
         }
         dir.mkdir();
         File dirfile = new File(dir, "foo.jar");
-        TestHelper.createJar(dirfile,
+        createJar(dirfile,
                 "public static void main(String... args) {",
                 "System.out.println(\"Hello World\");",
                 "System.exit(0);",
@@ -97,22 +97,20 @@
 
         // remove the class files, to ensure that the class is indeed picked up
         // from the jar file and not from ambient classpath.
-        File[] classFiles = cwd.listFiles(TestHelper.createFilter(TestHelper.CLASS_FILE_EXT));
+        File[] classFiles = cwd.listFiles(createFilter(CLASS_FILE_EXT));
         for (File f : classFiles) {
             f.delete();
         }
 
         // test with a jar file
-        TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javaCmd,
-                "-jar", dirfile.getAbsolutePath());
+        TestResult tr = doExec(javaCmd, "-jar", dirfile.getAbsolutePath());
         System.out.println(tr);
         if (!tr.isOK()) {
             throw new RuntimeException("TEST FAILED");
         }
 
         // test the same class but by specifying it as a classpath
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp",
-                dirfile.getAbsolutePath(), "Foo");
+        tr = doExec(javaCmd, "-cp", dirfile.getAbsolutePath(), "Foo");
         System.out.println(tr);
         if (!tr.isOK()) {
             throw new RuntimeException("TEST FAILED");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/I18NTest.java	Mon Apr 11 21:39:08 2016 +0100
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2012, 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 4761384
+ * @compile -XDignore.symbol.file I18NTest.java
+ * @run main I18NTest
+ * @summary Test to see if class files with non-ASCII characters can be run
+ * @author Joseph D. Darcy, Kumar Srinivasan
+ */
+
+
+import java.util.ArrayList;
+import java.io.File;
+import java.util.List;
+
+public class I18NTest extends TestHelper {
+    static String fileName = null;
+    public static void main(String... args) throws Exception {
+        String defaultEncoding = System.getProperty("file.encoding");
+        if (defaultEncoding == null) {
+            System.err.println("Default encoding not found; Error.");
+            return;
+        }
+        if (!defaultEncoding.equals("Cp1252")) {
+            System.err.println("Warning: required encoding not found, test skipped.");
+            return;
+        }
+        // for some reason the shell test version insisted on cleaning out the
+        // directory, likely being pedantic.
+        File cwd = new File(".");
+        for (File f : cwd.listFiles(createFilter(CLASS_FILE_EXT))) {
+            f.delete();
+        }
+        for (File f : cwd.listFiles(createFilter(JAVA_FILE_EXT))) {
+            f.delete();
+        }
+        createPlatformFile();
+
+        // compile the generate code using the javac compiler vs. the api, to
+        // as a bonus point to see if the argument is passed correctly
+        TestResult tr = null;
+        tr = doExec(javacCmd, fileName + JAVA_FILE_EXT);
+        if (!tr.isOK()) {
+            System.out.println(tr);
+            throw new Error("compilation failed...");
+        }
+        tr = doExec(javaCmd, "-cp", ".", fileName);
+        if (!tr.isOK()) {
+            System.out.println(tr);
+            throw new RuntimeException("run failed with encoding " + defaultEncoding);
+        }
+    }
+
+    public static void createPlatformFile() throws Exception {
+        List<String> buffer = new ArrayList<>();
+        // "HelloWorld" with an accented e
+        fileName = "i18nH\u00e9lloWorld";
+        buffer.clear();
+        buffer.add("public class i18nH\u00e9lloWorld {");
+        buffer.add("    public static void main(String [] argv) {");
+        buffer.add("        System.out.println(\"Hello Cp1252 World\");");
+        buffer.add("    }");
+        buffer.add("}");
+        File outFile = new File(fileName + JAVA_FILE_EXT);
+        createFile(outFile, buffer);
+    }
+}
--- a/test/tools/launcher/MiscTests.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/MiscTests.java	Mon Apr 11 21:39:08 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6856415
  * @summary Miscellaneous tests, Exceptions
- * @compile -XDignore.symbol.file MiscTests.java TestHelper.java
+ * @compile -XDignore.symbol.file MiscTests.java
  * @run main MiscTests
  */
 
@@ -33,12 +33,12 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 
-public class MiscTests {
+public class MiscTests extends TestHelper {
 
     // 6856415: Checks to ensure that proper exceptions are thrown by java
     static void test6856415() {
         // No pkcs library on win-x64, so we bail out.
-        if (TestHelper.is64Bit && TestHelper.isWindows) {
+        if (is64Bit && isWindows) {
             return;
         }
         StringBuilder sb = new StringBuilder();
@@ -49,11 +49,11 @@
         File testJar = new File("Foo.jar");
         testJar.delete();
         try {
-            TestHelper.createJar(testJar, sb.toString());
+            createJar(testJar, sb.toString());
         } catch (FileNotFoundException fnfe) {
             throw new RuntimeException(fnfe);
         }
-        TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javaCmd,
+        TestResult tr = doExec(javaCmd,
                 "-Djava.security.manager", "-jar", testJar.getName(), "foo.bak");
         for (String s : tr.testOutput) {
             System.out.println(s);
@@ -67,8 +67,8 @@
 
     public static void main(String... args) {
         test6856415();
-        if (TestHelper.testExitValue != 0) {
-            throw new Error(TestHelper.testExitValue + " tests failed");
+        if (testExitValue != 0) {
+            throw new Error(testExitValue + " tests failed");
     }
 }
 }
--- a/test/tools/launcher/Settings.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/Settings.java	Mon Apr 11 21:39:08 2016 +0100
@@ -27,11 +27,11 @@
  * @test
  * @bug 6994753 7123582
  * @summary tests -XshowSettings options
- * @compile -XDignore.symbol.file Settings.java TestHelper.java
+ * @compile -XDignore.symbol.file Settings.java
  * @run main Settings
  * @author ksrini
  */
-public class Settings {
+public class Settings extends TestHelper {
     private static File testJar = null;
 
     static void init() throws IOException {
@@ -45,17 +45,17 @@
         tsrc.append("        System.out.println(x);\n");
         tsrc.append("   }\n");
         tsrc.append("}\n");
-        TestHelper.createJar(testJar, tsrc.toString());
+        createJar(testJar, tsrc.toString());
     }
 
-    static void checkContains(TestHelper.TestResult tr, String str) {
+    static void checkContains(TestResult tr, String str) {
         if (!tr.contains(str)) {
             System.out.println(tr);
             throw new RuntimeException(str + " not found");
         }
     }
 
-    static void checkNoContains(TestHelper.TestResult tr, String str) {
+    static void checkNoContains(TestResult tr, String str) {
         if (tr.contains(str)) {
             System.out.println(tr.status);
             throw new RuntimeException(str + " found");
@@ -66,7 +66,7 @@
     private static final String PROP_SETTINGS = "Property settings:";
     private static final String LOCALE_SETTINGS = "Locale settings:";
 
-    static void containsAllOptions(TestHelper.TestResult tr) {
+    static void containsAllOptions(TestResult tr) {
         checkContains(tr, VM_SETTINGS);
         checkContains(tr, PROP_SETTINGS);
         checkContains(tr, LOCALE_SETTINGS);
@@ -77,15 +77,15 @@
         if (getArch().equals("ppc64")) {
             stackSize = "800";
         }
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-Xms64m", "-Xmx512m",
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
                 "-Xss" + stackSize + "k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
         containsAllOptions(tr);
         if (!tr.isOK()) {
             System.out.println(tr.status);
             throw new RuntimeException("test fails");
         }
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-Xms65536k", "-Xmx712m",
+        tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
                 "-Xss" + stackSize + "000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
         containsAllOptions(tr);
         if (!tr.isOK()) {
@@ -96,38 +96,38 @@
 
     static void runTestOptionAll() throws IOException {
         init();
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings:all");
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-XshowSettings:all");
         containsAllOptions(tr);
     }
 
     static void runTestOptionVM() throws IOException {
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings:vm");
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-XshowSettings:vm");
         checkContains(tr, VM_SETTINGS);
         checkNoContains(tr, PROP_SETTINGS);
         checkNoContains(tr, LOCALE_SETTINGS);
     }
 
     static void runTestOptionProperty() throws IOException {
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings:properties");
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-XshowSettings:properties");
         checkNoContains(tr, VM_SETTINGS);
         checkContains(tr, PROP_SETTINGS);
         checkNoContains(tr, LOCALE_SETTINGS);
     }
 
     static void runTestOptionLocale() throws IOException {
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings:locale");
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-XshowSettings:locale");
         checkNoContains(tr, VM_SETTINGS);
         checkNoContains(tr, PROP_SETTINGS);
         checkContains(tr, LOCALE_SETTINGS);
     }
 
     static void runTestBadOptions() throws IOException {
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettingsBadOption");
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-XshowSettingsBadOption");
         checkNoContains(tr, VM_SETTINGS);
         checkNoContains(tr, PROP_SETTINGS);
         checkNoContains(tr, LOCALE_SETTINGS);
@@ -135,8 +135,8 @@
     }
 
     static void runTest7123582() throws IOException {
-        TestHelper.TestResult tr = null;
-        tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings", "-version");
+        TestResult tr = null;
+        tr = doExec(javaCmd, "-XshowSettings", "-version");
         if (!tr.isOK()) {
             System.out.println(tr.status);
             throw new RuntimeException("test fails");
--- a/test/tools/launcher/SomeException.java	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2002, 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.
- */
-
-/*
- *
- *
- * Used by unresolvedExceptions.sh
- */
-
-public class SomeException extends RuntimeException {
-
-}
--- a/test/tools/launcher/Test7029048.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/Test7029048.java	Mon Apr 11 21:39:08 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 7029048
  * @summary Checks for LD_LIBRARY_PATH on *nixes
- * @compile -XDignore.symbol.file ExecutionEnvironment.java TestHelper.java Test7029048.java
+ * @compile -XDignore.symbol.file ExecutionEnvironment.java Test7029048.java
  * @run main Test7029048
  */
 
@@ -42,7 +42,7 @@
 import java.util.List;
 import java.util.Map;
 
-public class Test7029048 {
+public class Test7029048 extends TestHelper {
 
     static int passes = 0;
     static int errors = 0;
@@ -62,7 +62,7 @@
 
     private static final File dstLibDir = new File("lib");
     private static final File dstLibArchDir =
-            new File(dstLibDir, TestHelper.getJreArch());
+            new File(dstLibDir, getJreArch());
 
     private static final File dstServerDir = new File(dstLibArchDir, "server");
     private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM);
@@ -78,8 +78,8 @@
     private static final Map<String, String> env = new HashMap<>();
 
     static {
-        if (TestHelper.isDualMode) {
-            dstOtherArchDir = new File(dstLibDir, TestHelper.getComplementaryJreArch());
+        if (isDualMode) {
+            dstOtherArchDir = new File(dstLibDir, getComplementaryJreArch());
             dstOtherServerDir = new File(dstOtherArchDir, "server");
             dstOtherServerLibjvm = new File(dstOtherServerDir, LIBJVM);
         } else {
@@ -106,10 +106,10 @@
         List<String> cmdsList = new ArrayList<>();
 
         // only for a dual-mode system
-        if (want64 && TestHelper.isDualMode) {
-            cmdsList.add(TestHelper.java64Cmd);
+        if (want64 && isDualMode) {
+            cmdsList.add(java64Cmd);
         } else {
-            cmdsList.add(TestHelper.javaCmd); // a 32-bit java command for all
+            cmdsList.add(javaCmd); // a 32-bit java command for all
         }
 
         /*
@@ -127,18 +127,18 @@
         cmdsList.add("-jar");
         cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath());
         String[] cmds = new String[cmdsList.size()];
-        TestHelper.TestResult tr = TestHelper.doExec(env, cmdsList.toArray(cmds));
+        TestResult tr = doExec(env, cmdsList.toArray(cmds));
         analyze(tr, nLLPComponents, caseID);
     }
 
     // no cross launch, ie. no change to the data model.
     static void run(Map<String, String> env, int nLLPComponents, String caseID)
             throws IOException {
-        boolean want32 = TestHelper.is32Bit;
+        boolean want32 = is32Bit;
         run(want32, null, env, nLLPComponents, caseID);
     }
 
-    static void analyze(TestHelper.TestResult tr, int nLLPComponents, String caseID) {
+    static void analyze(TestResult tr, int nLLPComponents, String caseID) {
         String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput);
        /*
         * the envValue can never be null, since the test code should always
@@ -189,12 +189,12 @@
             switch (v) {
                 case LLP_SET_WITH_JVM:
                     // copy the files into the directory structures
-                    TestHelper.copyFile(srcLibjvmSo, dstServerLibjvm);
+                    copyFile(srcLibjvmSo, dstServerLibjvm);
                     // does not matter if it is client or a server
-                    TestHelper.copyFile(srcLibjvmSo, dstClientLibjvm);
+                    copyFile(srcLibjvmSo, dstClientLibjvm);
                     // does not matter if the arch do not match either
-                    if (TestHelper.isDualMode) {
-                        TestHelper.copyFile(srcLibjvmSo, dstOtherServerLibjvm);
+                    if (isDualMode) {
+                        copyFile(srcLibjvmSo, dstOtherServerLibjvm);
                     }
                     desc = "LD_LIBRARY_PATH should be set";
                     break;
@@ -211,7 +211,7 @@
                         Files.deleteIfExists(dstServerLibjvm.toPath());
                     }
 
-                    if (TestHelper.isDualMode) {
+                    if (isDualMode) {
                         if (!dstOtherServerDir.exists()) {
                             Files.createDirectories(dstOtherServerDir.toPath());
                         } else {
@@ -223,7 +223,7 @@
                     break;
                 case LLP_SET_NON_EXISTENT_PATH:
                     if (dstLibDir.exists()) {
-                        TestHelper.recursiveDelete(dstLibDir);
+                        recursiveDelete(dstLibDir);
                     }
                     desc = "LD_LIBRARY_PATH should not be set";
                     break;
@@ -245,18 +245,18 @@
             env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath());
             run(env, v.value + 1, "Case 2: " + desc);
 
-            if (!TestHelper.isDualMode) {
+            if (!isDualMode) {
                 continue; // nothing more to do for Linux
             }
 
             // Tests applicable only to solaris.
 
             // initialize test variables for dual mode operations
-            final File dst32ServerDir = TestHelper.is32Bit
+            final File dst32ServerDir = is32Bit
                     ? dstServerDir
                     : dstOtherServerDir;
 
-            final File dst64ServerDir = TestHelper.is64Bit
+            final File dst64ServerDir = is64Bit
                     ? dstServerDir
                     : dstOtherServerDir;
 
@@ -268,7 +268,7 @@
             env.clear();
             env.put(LD_LIBRARY_PATH_32, dst32ServerDir.getAbsolutePath());
             env.put(LD_LIBRARY_PATH_64, dst64ServerDir.getAbsolutePath());
-            run(TestHelper.is32Bit, null, env, v.value + 1, "Case 3: " + desc);
+            run(is32Bit, null, env, v.value + 1, "Case 3: " + desc);
 
             /*
              * Case 4: we are in dual mode environment, running 64-bit then
@@ -276,7 +276,7 @@
              * java32 -d64, LLP_64 is relevant, LLP_32 is ignored
              * java64 -d32, LLP_32 is relevant, LLP_64 is ignored
              */
-            if (TestHelper.dualModePresent()) {
+            if (dualModePresent()) {
                 run(true, "-d64", env, v.value + 1, "Case 4A: " + desc);
                 run(false,"-d32", env, v.value + 1, "Case 4B: " + desc);
             }
@@ -285,7 +285,7 @@
     }
 
     public static void main(String... args) throws Exception {
-        if (TestHelper.isWindows || TestHelper.isMacOSX) {
+        if (isWindows || isMacOSX) {
             System.out.println("Note: applicable on neither Windows nor MacOSX");
             return;
         }
@@ -297,13 +297,13 @@
         if (errors > 0) {
             throw new Exception("Test7029048: FAIL: with "
                     + errors + " errors and passes " + passes);
-        } else if (TestHelper.dualModePresent() && passes < 15) {
+        } else if (dualModePresent() && passes < 15) {
             throw new Exception("Test7029048: FAIL: " +
                     "all tests did not run, expected " + 15 + " got " + passes);
-        } else if (TestHelper.isSolaris && passes < 9) {
+        } else if (isSolaris && passes < 9) {
             throw new Exception("Test7029048: FAIL: " +
                     "all tests did not run, expected " + 9 + " got " + passes);
-        } else if (TestHelper.isLinux && passes < 6) {
+        } else if (isLinux && passes < 6) {
              throw new Exception("Test7029048: FAIL: " +
                     "all tests did not run, expected " + 6 + " got " + passes);
         } else {
--- a/test/tools/launcher/TestHelper.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/TestHelper.java	Mon Apr 11 21:39:08 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, 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
@@ -21,6 +21,8 @@
  * questions.
  */
 
+import java.io.OutputStream;
+import java.io.InputStream;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -64,6 +66,7 @@
 
     static final String JAVAHOME = System.getProperty("java.home");
     static final String JAVA_BIN;
+    static final String JAVA_JRE_BIN;
     static final boolean isSDK = JAVAHOME.endsWith("jre");
     static final String javaCmd;
     static final String javawCmd;
@@ -124,9 +127,12 @@
             throw new RuntimeException("arch model is not 32 or 64 bit ?");
         }
         compiler = ToolProvider.getSystemJavaCompiler();
-        File binDir = (isSDK) ? new File((new File(JAVAHOME)).getParentFile(), "bin")
-            : new File(JAVAHOME, "bin");
+        File binDir = (isSDK)
+                ? new File((new File(JAVAHOME)).getParentFile(), "bin")
+                : new File(JAVAHOME, "bin");
         JAVA_BIN = binDir.getAbsolutePath();
+        JAVA_JRE_BIN = new File((new File(JAVAHOME)).getParentFile(),
+                        (isSDK) ? "jre/bin" : "bin").getAbsolutePath();
         File javaCmdFile = (isWindows)
                 ? new File(binDir, "java.exe")
                 : new File(binDir, "java");
@@ -192,9 +198,15 @@
                     System.out.println(m.getName() + ": OK");
                     passed++;
                     System.out.printf("Passed: %d, Failed: %d, ExitValue: %d%n",
-                                       passed, failed, testExitValue);
+                                      passed, failed, testExitValue);
                 } catch (Throwable ex) {
-                    System.out.printf("Test %s failed: %s %n", m, ex.getCause());
+                    System.out.printf("Test %s failed: %s %n", m, ex);
+                    System.out.println("----begin detailed exceptions----");
+                    ex.printStackTrace(System.out);
+                    for (Throwable t : ex.getSuppressed()) {
+                        t.printStackTrace(System.out);
+                    }
+                    System.out.println("----end detailed exceptions----");
                     failed++;
                 }
             }
@@ -223,6 +235,13 @@
         String arch = System.getProperty("os.arch");
         return arch.equals("x86") ? "i386" : arch;
     }
+    static String getArch() {
+        return System.getProperty("os.arch");
+    }
+    static File getClassFile(File javaFile) {
+        String s = javaFile.getAbsolutePath().replace(JAVA_FILE_EXT, CLASS_FILE_EXT);
+        return new File(s);
+    }
 
     /*
      * get the complementary jre arch ie. if sparc then return sparcv9 and
@@ -245,6 +264,16 @@
         return null;
     }
 
+    static File getJavaFile(File classFile) {
+        String s = classFile.getAbsolutePath().replace(CLASS_FILE_EXT, JAVA_FILE_EXT);
+        return new File(s);
+    }
+
+    static String baseName(File f) {
+        String s = f.getName();
+        return s.substring(0, s.indexOf("."));
+    }
+
     /*
      * A convenience method to create a jar with jar file name and defs
      */
@@ -326,6 +355,15 @@
         }
    }
 
+   static void copyStream(InputStream in, OutputStream out) throws IOException {
+        byte[] buf = new byte[8192];
+        int n = in.read(buf);
+        while (n > 0) {
+            out.write(buf, 0, n);
+            n = in.read(buf);
+        }
+    }
+
    static void copyFile(File src, File dst) throws IOException {
         Path parent = dst.toPath().getParent();
         if (parent != null) {
@@ -580,6 +618,16 @@
             return false;
         }
 
+        boolean notContains(String str) {
+             for (String x : testOutput) {
+                if (x.contains(str)) {
+                    appendError("string <" + str + "> found");
+                    return false;
+                }
+            }
+            return true;
+        }
+
         boolean matches(String stringToMatch) {
           for (String x : testOutput) {
                 if (x.matches(stringToMatch)) {
@@ -589,6 +637,16 @@
             appendError("string <" + stringToMatch + "> not found");
             return false;
         }
+
+        boolean notMatches(String stringToMatch) {
+            for (String x : testOutput) {
+                if (!x.matches(stringToMatch)) {
+                    return true;
+                }
+            }
+            appendError("string <" + stringToMatch + "> found");
+            return false;
+        }
     }
     /**
     * Indicates that the annotated method is a test method.
--- a/test/tools/launcher/UnicodeCleanup.java	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-
-
-/*
- *
- *
- * Used by UnicodeTest.sh.
- *
- * Recursively deletes the given file/directory and its contents.
- * Equivalent to "rm -rf args...", but on NT-based Windows can
- * handle files with full Unicode names inside the given directories
- * while shells are generally limited to names using the system encoding.
- *
- * @author Norbert Lindenberg
- */
-
-
-
-import java.io.File;
-
-public class UnicodeCleanup {
-
-    public static void main(String[] args) {
-
-        for (int i = 0; i < args.length; i++) {
-            delete(new File(args[i]));
-        }
-    }
-
-    private static void delete(File file) {
-        // paranoia is healthy in rm -rf
-        String name = file.toString();
-        if (name.equals(".") || name.equals("..") ||
-                name.endsWith(File.separator + ".") ||
-                name.endsWith(File.separator + "..")) {
-            throw new RuntimeException("too risky to process: " + name);
-        }
-        if (file.isDirectory()) {
-            File[] contents = file.listFiles();
-            for (int i = 0; i < contents.length; i++) {
-                delete(contents[i]);
-            }
-        }
-        if (!file.delete()) {
-            throw new RuntimeException("Unable to delete " + file);
-        }
-    }
-}
--- a/test/tools/launcher/UnicodeTest.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/UnicodeTest.java	Mon Apr 11 21:39:08 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, 2012 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
@@ -21,12 +21,18 @@
  * questions.
  */
 
+/*
+ * @test
+ * @bug 5030265
+ * @compile  -XDignore.symbol.file UnicodeTest.java
+ * @run main/othervm UnicodeTest
+ * @summary Verify that the J2RE can handle all legal Unicode characters
+ *          in class names unless limited by the file system encoding
+ *          or the encoding used for command line arguments.
+ * @author Norbert Lindenberg, ksrini
+ */
 
 /*
- *
- *
- * Used by UnicodeTest.sh.
- *
  * This class creates Java source files using Unicode characters
  * that test the limits of what's possible
  * - in situations where the platform encoding imposes limits
@@ -35,38 +41,126 @@
  *   (file system access in UTF-8 locales and on Windows 2000++,
  *    jar file contents)
  *
- * @author Norbert Lindenberg
+ * This test needs to be run in othervm as the locale is reset.
  */
 
-
-
+import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
 import java.util.Locale;
 
-public class UnicodeTest {
+public class UnicodeTest extends TestHelper {
+    static final File UnicodeTestSrc        = new File("UnicodeTest-src");
+    static final File UnicodeTestClasses    = new File("UnicodeTest-classes");
+    static final String UnicodeTestJarName  = "UnicodeTest" + JAR_FILE_EXT;
+    static final File UnicodeTestJar        = new File(UnicodeTestJarName);
+    static final File SolarisUnicodeTestJar = new File(TEST_SOURCES_DIR,
+                                                       UnicodeTestJarName);
 
-    public static void main(String[] args) throws Exception {
+    /*
+     * the main method is a port of the shell based test to a java, this
+     * eliminates the need for MKS on windows, thus we can rely on consistent
+     * results regardless of the shell being used.
+     */
+    public static void main(String... args) throws Exception {
+        System.out.println("creating test source files");
+        UnicodeTestSrc.mkdirs();
+        UnicodeTestClasses.mkdirs();
+        String classname = generateSources();
+        File javaFile = new File(UnicodeTestSrc, classname + JAVA_FILE_EXT);
+        System.out.println("building test apps");
+        compile("-encoding", "UTF-8",
+                "-sourcepath", UnicodeTestSrc.getAbsolutePath(),
+                "-d", UnicodeTestClasses.getAbsolutePath(),
+                javaFile.getAbsolutePath());
 
+        createJar("-cvfm", UnicodeTestJar.getAbsolutePath(),
+                  new File(UnicodeTestSrc, "MANIFEST.MF").getAbsolutePath(),
+                  "-C", UnicodeTestClasses.getAbsolutePath(), ".");
+
+        if (!UnicodeTestJar.exists()) {
+            throw new Error("failed to create " + UnicodeTestJar.getAbsolutePath());
+        }
+
+        System.out.println("running test app using class file");
+        TestResult tr = doExec(javaCmd,
+                        "-cp", UnicodeTestClasses.getAbsolutePath(), classname);
+        if (!tr.isOK()) {
+            System.out.println(tr);
+            throw new RuntimeException("test fails");
+        }
+
+        System.out.println("delete generated files with non-ASCII names");
+        recursiveDelete(UnicodeTestSrc);
+        recursiveDelete(UnicodeTestClasses);
+
+        /*
+         * test in whatever the default locale is
+         */
+        runJarTests();
+
+        /*
+         * if the Japanese locale is available, test in that locale as well
+         */
+        if (setLocale(Locale.JAPANESE)) {
+            runJarTests();
+        }
+
+       /*
+        * if we can switch to a C locale, then test whether jar files with
+        * non-ASCII characters in the manifest still work in this crippled
+        * environment
+        */
+        if (setLocale(Locale.ENGLISH)) {
+            runJarTests();
+        }
+        // thats it we are outta here
+    }
+
+    static void runJarTests() {
+        System.out.println("running test app using newly built jar file in " +
+                Locale.getDefault());
+        runTest(UnicodeTestJar);
+
+        System.out.println("running test app using jar file " +
+                "(built with Solaris UTF-8 locale) in " + Locale.getDefault());
+        runTest(SolarisUnicodeTestJar);
+    }
+
+    static void runTest(File testJar) {
+        TestResult tr = doExec(javaCmd, "-jar", testJar.getAbsolutePath());
+        if (!tr.isOK()) {
+            System.out.println(tr);
+            throw new RuntimeException("test fails");
+        }
+    }
+
+    static boolean setLocale(Locale desired) {
+        if (Locale.getDefault().equals(desired)) {
+            return true;  // already set nothing more
+        }
+        for (Locale l : Locale.getAvailableLocales()) {
+            if (l == desired) {
+                Locale.setDefault(l);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    static String generateSources() throws Exception {
         String commandLineClassNameSuffix = commandLineClassNameSuffix();
         String commandLineClassName = "ClassA" + commandLineClassNameSuffix;
-        String manifestClassName;
-        if (hasUnicodeFileSystem()) {
-            manifestClassName = "ClassB" + unicode;
-        } else {
-            manifestClassName = "ClassB" + commandLineClassNameSuffix;
-        }
+        String manifestClassName = "ClassB" +
+                (hasUnicodeFileSystem() ? unicode : commandLineClassNameSuffix);
 
         generateSource(commandLineClassName, manifestClassName);
         generateSource(manifestClassName, commandLineClassName);
         generateManifest(manifestClassName);
-
-        System.out.println(commandLineClassName);
+        return commandLineClassName;
     }
 
-    private static final String fileSeparator = System.getProperty("file.separator");
-    private static final String osName = System.getProperty("os.name");
     private static final String defaultEncoding = Charset.defaultCharset().name();
 
     // language names taken from java.util.Locale.getDisplayLanguage for the respective language
@@ -132,12 +226,7 @@
             { "tis-620",        thai,           null            },
         };
 
-        int column;
-        if (osName.startsWith("Windows")) {
-            column = 2;
-        } else {
-            column = 1;
-        }
+        int column = isWindows ? 2 : 1;
         for (int i = 0; i < names.length; i++) {
              if (names[i][0].equalsIgnoreCase(defaultEncoding)) {
                  return names[i][column];
@@ -147,17 +236,12 @@
     }
 
     private static boolean hasUnicodeFileSystem() {
-        if (osName.startsWith("Windows")) {
-            return ! osName.startsWith("Windows 9") &&
-                   ! osName.equals("Windows Me");
-        } else {
-            return defaultEncoding.equalsIgnoreCase("UTF-8");
-        }
+        return (isWindows) ? true : defaultEncoding.equalsIgnoreCase("UTF-8");
     }
 
     private static void generateSource(String thisClass, String otherClass) throws Exception {
-        String fileName = "UnicodeTest-src" + fileSeparator + thisClass + ".java";
-        OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8");
+        File file = new File(UnicodeTestSrc, thisClass + JAVA_FILE_EXT);
+        OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
         out.write("public class " + thisClass + " {\n");
         out.write("    public static void main(String[] args) {\n");
         out.write("        if (!" + otherClass + "." + otherClass.toLowerCase() + "().equals(\"" + otherClass + "\")) {\n");
@@ -172,8 +256,8 @@
     }
 
     private static void generateManifest(String mainClass) throws Exception {
-        String fileName = "UnicodeTest-src" + fileSeparator + "MANIFEST.MF";
-        FileOutputStream out = new FileOutputStream(fileName);
+        File file = new File(UnicodeTestSrc, "MANIFEST.MF");
+        FileOutputStream out = new FileOutputStream(file);
         out.write("Manifest-Version: 1.0\n".getBytes("UTF-8"));
         // Header lines are limited to 72 bytes.
         // The manifest spec doesn't say we have to break at character boundaries,
--- a/test/tools/launcher/UnicodeTest.sh	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-# Copyright (c) 2007, 2010, 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 5030265
-# @summary Verify that the J2RE can handle all legal Unicode characters
-#          in class names unless limited by the file system encoding
-#          or the encoding used for command line arguments.
-# @author Norbert Lindenberg
-
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-JAVAC="${TESTJAVA}"/bin/javac
-JAVA="${TESTJAVA}"/bin/java
-JAR="${TESTJAVA}"/bin/jar
-
-mkdir UnicodeTest-src UnicodeTest-classes
-
-echo "creating test source files"
-"$JAVAC" -d . "${TESTSRC}"/UnicodeTest.java
-if [ "`uname -s | grep CYGWIN`" != "" ] ; then
-  CLASS_NAME=`"$JAVA" UnicodeTest | sed -e 's@\\r@@g' `
-else
-  CLASS_NAME=`"$JAVA" UnicodeTest`
-fi
-
-if [ "$CLASS_NAME" = "" ]
-then
-  echo "CLASS_NAME not generated.  Test failed."
-  exit 1
-fi
-
-echo "building test apps"
-"$JAVAC" -encoding UTF-8 -sourcepath UnicodeTest-src \
-    -d UnicodeTest-classes UnicodeTest-src/"${CLASS_NAME}".java || exit 1
-"$JAR" -cvfm UnicodeTest.jar UnicodeTest-src/MANIFEST.MF \
-    -C UnicodeTest-classes . || exit 1
-
-echo "running test app using class file"
-"$JAVA" -classpath UnicodeTest-classes "$CLASS_NAME" || exit 1
-
-echo "delete generated files with non-ASCII names"
-# do it now because on Unix they may not be accessible when locale changes
-# do it in Java because shells on Windows can't handle full Unicode
-"$JAVAC" -d . "${TESTSRC}"/UnicodeCleanup.java || exit 1
-"$JAVA" UnicodeCleanup UnicodeTest-src UnicodeTest-classes || exit 1
-
-echo "running test app using newly built jar file"
-"$JAVA" -jar UnicodeTest.jar || exit 1
-
-echo "running test app using jar file built in Solaris UTF-8 locale"
-"$JAVA" -jar "${TESTSRC}"/UnicodeTest.jar || exit 1
-
-# if we can switch to a C locale, then test whether jar files with
-# non-ASCII characters in the manifest still work in this crippled
-# environment
-if test -n "`locale -a 2>/dev/null | grep '^C$'`"
-then
-    LC_ALL=C
-    export LC_ALL
-
-    echo "running test app using newly built jar file in C locale"
-    "$JAVA" -jar UnicodeTest.jar || exit 1
-
-    echo "running test app using premade jar file in C locale"
-    "$JAVA" -jar "${TESTSRC}"/UnicodeTest.jar || exit 1
-fi
-
-exit 0
-
--- a/test/tools/launcher/UnresolvedExceptions.java	Mon Apr 11 15:31:27 2016 +0100
+++ b/test/tools/launcher/UnresolvedExceptions.java	Mon Apr 11 21:39:08 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, 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
@@ -22,15 +22,39 @@
  */
 
 /*
- *
- *
- * Used by unresolvedExceptions.sh
+ * @test
+ * @bug 4529320
+ * @compile -XDignore.symbol.file UnresolvedExceptions.java
+ * @run main UnresolvedExceptions
+ * @summary Verifying jvm won't segv if exception not available
+ * @author Joseph D. Darcy, ksrini
  */
 
-public class UnresolvedExceptions  {
-    public static void main(String[] argv) throws SomeException {
-        // main is invoked from a shell so calling exit won't stop all
-        // tests.
-        System.exit(0);
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class UnresolvedExceptions extends TestHelper {
+
+    public static void main(String... args) throws Exception {
+        final String fname = "Foo";
+        List<String> buffer = new ArrayList<>();
+        buffer.add("public class " + fname + " {");
+        buffer.add("    public static void main(String[] argv) throws "
+                       + "Foo.SomeException {");
+        buffer.add("        System.exit(0);");
+        buffer.add("    }");
+        buffer.add("    static class SomeException extends RuntimeException{}");
+        buffer.add("}");
+
+        File testJavaFile = new File("Foo" + JAVA_FILE_EXT);
+        createFile(testJavaFile, buffer);
+        compile(testJavaFile.getName());
+        TestResult tr = doExec(javaCmd, "-cp", ".", fname);
+        if (!tr.isOK()) {
+            System.out.println(tr);
+            throw new RuntimeException("java -cp ... failed");
     }
 }
+}
--- a/test/tools/launcher/deleteI18n.sh	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2002, 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.
-#
-
-#
-#
-# This file is used by test i18nTest.sh; this file is called to use
-# shell globbing to delete Java source and class files whose names
-# include non-ASCII characters.
-
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-rm -f i18n*.java
-rm -f i18n*.class
-
-
--- a/test/tools/launcher/i18nTest.sh	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-#
-# Copyright (c) 2002, 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 4761384
-# @run shell deleteI18n.sh
-# @build CreatePlatformFile
-# @run main CreatePlatformFile
-# @run shell i18nTest.sh
-# @summary Test to see if class files with non-ASCII characters can be run
-# @author Joseph D. Darcy
-
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-JAVAC="${TESTJAVA}/bin/javac -d . "
-JAVA="${TESTJAVA}/bin/java -classpath . "
-
-NAME=`ls i18n*.java | sed s/.java//`
-echo $NAME
-$JAVAC ${NAME}.java
-
-RESULT=$?
-case "$RESULT" in
-        0  )
-        ;;
-
-        * )
-	echo "Compile of i18n*.java failed."
-        exit 1
-esac
-
-$JAVA ${NAME}
-RESULT=$?
-
-case "$RESULT" in
-        0  )
-        exit 0;
-        ;;
-
-        * )
-	echo "Class $NAME did not run successfully."
-        exit 1
-esac
--- a/test/tools/launcher/unresolvedExceptions.sh	Mon Apr 11 15:31:27 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-#
-# Copyright (c) 2002, 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 4529320
-# @build SomeException
-# @build UnresolvedExceptions
-# @clean SomeException
-# @run shell/timeout=60 unresolvedExceptions.sh
-# @summary Verifying jvm won't segv if exception not available
-# @author Joseph D. Darcy
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-JAVA="${TESTJAVA}/bin/java"
-
-$JAVA -classpath ${TESTCLASSES} UnresolvedExceptions
-RESULT=$?
-
-case "$RESULT" in
-	0 | 1 )
-	exit 0;
-	;;
-
-	* )
-	exit 1
-esac