changeset 4634:12819477ce5a

7120875: fix macos ipv6 issue and update multiple test scripts Reviewed-by: alanb Contributed-by: kurchi.subhra.hazra@oracle.com, jason.uh@oracle.com
author michaelm
date Thu, 22 Dec 2011 11:05:51 -0800
parents 4868a820411b
children 0c57f87f454d
files src/macosx/classes/java/net/DefaultInterface.java src/share/classes/java/net/MulticastSocket.java src/share/classes/java/net/NetworkInterface.java src/solaris/classes/java/net/DefaultInterface.java src/solaris/native/java/net/Inet4AddressImpl.c src/solaris/native/java/net/NetworkInterface.c src/solaris/native/java/net/PlainDatagramSocketImpl.c src/solaris/native/java/net/PlainSocketImpl.c src/solaris/native/java/net/net_util_md.c src/windows/classes/java/net/DefaultInterface.java test/com/sun/jdi/ImmutableResourceTest.sh test/com/sun/jdi/JITDebug.sh test/com/sun/jdi/Solaris32AndSolaris64Test.sh test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh test/com/sun/tools/attach/CommonSetup.sh test/java/io/Serializable/evolution/RenamePackage/run.sh test/java/io/Serializable/serialver/classpath/run.sh test/java/io/Serializable/serialver/nested/run.sh test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh test/java/lang/ProcessBuilder/Basic.java test/java/lang/ProcessBuilder/Zombies.java test/java/lang/StringCoding/CheckEncodings.sh test/java/lang/annotation/loaderLeak/LoaderLeak.sh test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh test/java/net/Authenticator/B4933582.sh test/java/net/DatagramSocket/Send12k.java test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh test/java/net/Socket/OldSocketImpl.sh test/java/net/URL/B5086147.sh test/java/net/URL/runconstructor.sh test/java/net/URLClassLoader/B5077773.sh test/java/net/URLClassLoader/sealing/checksealed.sh test/java/net/URLConnection/6212146/test.sh test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh test/java/security/Security/signedfirst/Dyn.sh test/java/security/Security/signedfirst/Static.sh test/java/util/Currency/PropertiesTest.sh test/java/util/Locale/LocaleCategory.sh test/java/util/PluggableLocale/ExecTest.sh test/java/util/ResourceBundle/Bug6299235Test.sh test/java/util/ResourceBundle/Control/ExpirationTest.sh test/java/util/ServiceLoader/basic.sh test/javax/crypto/SecretKeyFactory/FailOverTest.sh test/javax/imageio/stream/StreamCloserLeak/run_test.sh test/javax/script/CommonSetup.sh test/javax/security/auth/Subject/doAs/Test.sh test/lib/security/java.policy/Ext_AllPolicy.sh test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh test/sun/misc/URLClassPath/ClassnameCharTest.sh test/sun/net/www/MarkResetTest.sh test/sun/net/www/http/HttpClient/RetryPost.sh test/sun/net/www/protocol/jar/B5105410.sh test/sun/net/www/protocol/jar/jarbug/run.sh test/sun/security/krb5/runNameEquals.sh test/sun/security/pkcs11/Provider/ConfigQuotedString.sh test/sun/security/pkcs11/Provider/Login.sh test/sun/security/provider/PolicyFile/getinstance/getinstance.sh test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh test/sun/security/tools/jarsigner/AlgOptions.sh test/sun/security/tools/jarsigner/PercentSign.sh test/sun/security/tools/jarsigner/diffend.sh test/sun/security/tools/jarsigner/oldsig.sh test/sun/security/tools/keytool/AltProviderPath.sh test/sun/security/tools/keytool/CloneKeyAskPassword.sh test/sun/security/tools/keytool/NoExtNPE.sh test/sun/security/tools/keytool/SecretKeyKS.sh test/sun/security/tools/keytool/StandardAlgName.sh test/sun/security/tools/keytool/printssl.sh test/sun/security/tools/keytool/resource.sh test/sun/security/tools/keytool/standard.sh test/sun/tools/jconsole/ImmutableResourceTest.sh test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh
diffstat 78 files changed, 630 insertions(+), 358 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/classes/java/net/DefaultInterface.java	Thu Dec 22 11:05:51 2011 -0800
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2011, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.net;
+
+/**
+ * Choose a network inteface to be the default for
+ * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
+ * We choose the first interface that is up and is (in order of preference):
+ * 1. neither loopback nor point to point
+ * 2. point to point
+ * 3. loopback
+ * 4. none.
+ * Platforms that do not require a default interface implement a dummy
+ * that returns null.
+ */
+
+import java.util.Enumeration;
+import java.io.IOException;
+
+class DefaultInterface {
+
+    private final static NetworkInterface defaultInterface =
+        chooseDefaultInterface();
+
+    static NetworkInterface getDefault() {
+        return defaultInterface;
+    }
+
+    /**
+     * Choose a default interface. This method returns an interface that is
+     * both "up" and supports multicast. This method choses an interface in
+     * order of preference:
+     * 1. neither loopback nor point to point
+     * 2. point to point
+     * 3. loopback
+     *
+     * @return  the chosen interface or {@code null} if there isn't a suitable
+     *          default
+     */
+    private static NetworkInterface chooseDefaultInterface() {
+        Enumeration<NetworkInterface> nifs;
+
+        try {
+           nifs = NetworkInterface.getNetworkInterfaces();
+        } catch (IOException ignore) {
+            // unable to enumate network interfaces
+            return null;
+        }
+
+        NetworkInterface ppp = null;
+        NetworkInterface loopback = null;
+
+        while (nifs.hasMoreElements()) {
+            NetworkInterface ni = nifs.nextElement();
+            try {
+                if (ni.isUp() && ni.supportsMulticast()) {
+                    boolean isLoopback = ni.isLoopback();
+                    boolean isPPP = ni.isPointToPoint();
+                    if (!isLoopback && !isPPP) {
+                        // found an interface that is not the loopback or a
+                        // point-to-point interface
+                        return ni;
+                    }
+                    if (ppp == null && isPPP)
+                        ppp = ni;
+                    if (loopback == null && isLoopback)
+                        loopback = ni;
+                }
+            } catch (IOException skip) { }
+        }
+
+        return (ppp != null) ? ppp : loopback;
+    }
+}
--- a/src/share/classes/java/net/MulticastSocket.java	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/share/classes/java/net/MulticastSocket.java	Thu Dec 22 11:05:51 2011 -0800
@@ -164,6 +164,15 @@
         if (bindaddr != null) {
             bind(bindaddr);
         }
+        /**
+         * required for some platforms where it's not possible to join
+         * a group without setting the interface first.
+         */
+        NetworkInterface defaultInterface = NetworkInterface.getDefault();
+
+        if (defaultInterface != null) {
+            setNetworkInterface(defaultInterface);
+        }
     }
 
     /**
--- a/src/share/classes/java/net/NetworkInterface.java	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/share/classes/java/net/NetworkInterface.java	Thu Dec 22 11:05:51 2011 -0800
@@ -49,10 +49,18 @@
     private NetworkInterface childs[];
     private NetworkInterface parent = null;
     private boolean virtual = false;
+    private static final NetworkInterface defaultInterface;
+    private static final int defaultIndex; /* index of defaultInterface */
 
     static {
         AccessController.doPrivileged(new LoadLibraryAction("net"));
         init();
+        defaultInterface = DefaultInterface.getDefault();
+        if (defaultInterface != null) {
+            defaultIndex = defaultInterface.getIndex();
+        } else {
+            defaultIndex = 0;
+        }
     }
 
     /**
@@ -551,4 +559,13 @@
     }
 
     private static native void init();
+
+    /**
+     * Returns the default network interface of this system
+     *
+     * @return the default interface
+     */
+    static NetworkInterface getDefault() {
+        return defaultInterface;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/classes/java/net/DefaultInterface.java	Thu Dec 22 11:05:51 2011 -0800
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.net;
+
+/**
+ * Choose a network inteface to be the default for
+ * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
+ *
+ * Platforms that do not require a default interface may return null
+ * which is what this implementation does.
+ */
+
+class DefaultInterface {
+
+    static NetworkInterface getDefault() {
+        return null;
+    }
+}
--- a/src/solaris/native/java/net/Inet4AddressImpl.c	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/solaris/native/java/net/Inet4AddressImpl.c	Thu Dec 22 11:05:51 2011 -0800
@@ -732,6 +732,7 @@
 
     memset((char *) caddr, 0, sizeof(caddr));
     memset((char *) &him, 0, sizeof(him));
+    memset((char *) &inf, 0, sizeof(inf));
     sz = (*env)->GetArrayLength(env, addrArray);
     if (sz != 4) {
       return JNI_FALSE;
--- a/src/solaris/native/java/net/NetworkInterface.c	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/solaris/native/java/net/NetworkInterface.c	Thu Dec 22 11:05:51 2011 -0800
@@ -108,6 +108,7 @@
 jfieldID ni_virutalID;
 jfieldID ni_childsID;
 jfieldID ni_parentID;
+jfieldID ni_defaultIndexID;
 jmethodID ni_ctrID;
 
 static jclass ni_iacls;
@@ -200,6 +201,7 @@
     ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
     ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
     ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
+    ni_defaultIndexID = (*env)->GetStaticFieldID(env, ni_class, "defaultIndex", "I");
 }
 
 
--- a/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Thu Dec 22 11:05:51 2011 -0800
@@ -83,6 +83,8 @@
 static jfieldID pdsi_ttlID;
 #endif
 
+extern void setDefaultScopeID(JNIEnv *env, struct sockaddr *him);
+
 /*
  * Returns a java.lang.Integer based on 'i'
  */
@@ -240,6 +242,7 @@
     if (NET_InetAddressToSockaddr(env, iaObj, localport, (struct sockaddr *)&him, &len, JNI_TRUE) != 0) {
       return;
     }
+    setDefaultScopeID(env, (struct sockaddr *)&him);
 
     if (NET_Bind(fd, (struct sockaddr *)&him, len) < 0)  {
         if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
@@ -310,6 +313,7 @@
         setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, (char*) &t, sizeof(int));
     } else
 #endif
+    setDefaultScopeID(env, (struct sockaddr *)&rmtaddr);
     {
         if (JVM_Connect(fd, (struct sockaddr *)&rmtaddr, len) == -1) {
             NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
@@ -457,6 +461,7 @@
           return;
         }
     }
+    setDefaultScopeID(env, (struct sockaddr *)&rmtaddr);
 
     if (packetBufferLen > MAX_BUFFER_LEN) {
         /* When JNI-ifying the JDK's IO routines, we turned
@@ -1328,7 +1333,7 @@
          * value is an InetAddress.
          */
 #ifdef AF_INET6
-#ifdef __solaris__
+#if defined(__solaris__) || defined(MACOSX)
         if (ipv6_available()) {
             mcast_set_if_by_addr_v6(env, this, fd, value);
         } else {
@@ -1351,7 +1356,7 @@
          * value is a NetworkInterface.
          */
 #ifdef AF_INET6
-#ifdef __solaris__
+#if defined(__solaris__) || defined(MACOSX)
         if (ipv6_available()) {
             mcast_set_if_by_if_v6(env, this, fd, value);
         } else {
@@ -1434,7 +1439,7 @@
 static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
                                   jint opt, jobject value) {
 #ifdef AF_INET6
-#ifdef __solaris__
+#if defined(__solaris__) || defined(MACOSX)
     if (ipv6_available()) {
         mcast_set_loop_v6(env, this, fd, value);
     } else {
@@ -2008,7 +2013,7 @@
     }
     /* setsockopt to be correct ttl */
 #ifdef AF_INET6
-#ifdef __solaris__
+#if defined(__solaris__) || defined(MACOSX)
     if (ipv6_available()) {
         setHopLimit(env, fd, ttl);
     } else {
--- a/src/solaris/native/java/net/PlainSocketImpl.c	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/solaris/native/java/net/PlainSocketImpl.c	Thu Dec 22 11:05:51 2011 -0800
@@ -70,6 +70,8 @@
 jfieldID psi_fdLockID;
 jfieldID psi_closePendingID;
 
+extern void setDefaultScopeID(JNIEnv *env, struct sockaddr *him);
+
 /*
  * file descriptor used for dup2
  */
@@ -115,7 +117,6 @@
     return sv[0];
 }
 
-
 /*
  * Return the file descriptor given a PlainSocketImpl
  */
@@ -260,6 +261,9 @@
 
     /* fdObj is the FileDescriptor field on this */
     jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
+
+    jclass clazz = (*env)->GetObjectClass(env, this);
+
     jobject fdLock;
 
     jint trafficClass = (*env)->GetIntField(env, this, psi_trafficClassID);
@@ -286,6 +290,7 @@
     if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&him, &len, JNI_TRUE) != 0) {
       return;
     }
+    setDefaultScopeID(env, (struct sockaddr *)&him);
 
 #ifdef AF_INET6
     if (trafficClass != 0 && ipv6_available()) {
@@ -567,6 +572,7 @@
     if (NET_InetAddressToSockaddr(env, iaObj, localport, (struct sockaddr *)&him, &len, JNI_TRUE) != 0) {
       return;
     }
+    setDefaultScopeID(env, (struct sockaddr *)&him);
 
     if (NET_Bind(fd, (struct sockaddr *)&him, len) < 0) {
         if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
--- a/src/solaris/native/java/net/net_util_md.c	Mon Dec 19 18:15:06 2011 -0800
+++ b/src/solaris/native/java/net/net_util_md.c	Thu Dec 22 11:05:51 2011 -0800
@@ -85,6 +85,22 @@
 #define UDP_EXCLBIND            0x0101
 #endif
 
+extern jclass ni_class;
+extern jfieldID ni_defaultIndexID;
+
+void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
+{
+#ifdef MACOSX
+    int defaultIndex;
+    struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)him;
+    if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0)) {
+        defaultIndex = (*env)->GetStaticIntField(env, ni_class,
+                                                 ni_defaultIndexID);
+        sin6->sin6_scope_id = defaultIndex;
+    }
+#endif
+}
+
 #ifdef __solaris__
 static int init_tcp_max_buf, init_udp_max_buf;
 static int tcp_max_buf;
@@ -1221,6 +1237,15 @@
     }
 #endif
 
+/* Workaround for Mac OS treating linger value as
+ *  signed integer
+ */
+#ifdef MACOSX
+    if (level == SOL_SOCKET && opt == SO_LINGER) {
+        struct linger* to_cast = (struct linger*)result;
+        to_cast->l_linger = (unsigned short)to_cast->l_linger;
+    }
+#endif
     return rv;
 }
 
@@ -1438,19 +1463,6 @@
         }
     }
 
-    /*
-     * Don't allow SO_LINGER value to be too big.
-     * Current max value (240) is empiric value based on tcp_timer.h's
-     * constant TCP_LINGERTIME, which was doubled.
-     *
-     * XXXBSD: maybe we should step it down to 120 ?
-     */
-    if (level == SOL_SOCKET && opt == SO_LINGER) {
-        ling = (struct linger *)arg;
-       if (ling->l_linger > 240 || ling->l_linger < 0) {
-           ling->l_linger = 240;
-       }
-    }
 #endif
 
     return setsockopt(fd, level, opt, arg, len);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/windows/classes/java/net/DefaultInterface.java	Thu Dec 22 11:05:51 2011 -0800
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.net;
+
+/**
+ * Choose a network inteface to be the default for
+ * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
+ *
+ * Platforms that do not require a default interface may return null
+ * which is what this implementation does.
+ */
+
+class DefaultInterface {
+
+    static NetworkInterface getDefault() {
+        return null;
+    }
+}
--- a/test/com/sun/jdi/ImmutableResourceTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/com/sun/jdi/ImmutableResourceTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -28,14 +28,14 @@
 #
 #   @run shell ImmutableResourceTest.sh
 #
-# 
+#
 
 # Beginning of subroutines:
 status=1
 
 #Call this from anywhere to fail the test with an error message
 # usage: fail "reason why the test failed"
-fail() 
+fail()
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
@@ -44,7 +44,7 @@
 
 #Call this from anywhere to pass the test with a message
 # usage: pass "reason why the test passed if applicable"
-pass() 
+pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
    exit 0
@@ -56,7 +56,7 @@
 
 OS=`uname -s`
 case "$OS" in
-   SunOS | Linux )
+   SunOS | Linux | Darwin )
       PATHSEP=":"
       ;;
 
@@ -83,7 +83,7 @@
    if [ -n "$1" ] ; then
           TESTJAVA=$1
       else
-	  TESTJAVA=$JAVA_HOME
+          TESTJAVA=$JAVA_HOME
    fi
    TESTSRC=.
    TESTCLASSES=.
--- a/test/com/sun/jdi/JITDebug.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/com/sun/jdi/JITDebug.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -40,7 +40,7 @@
 
 #Call this from anywhere to fail the test with an error message
 # usage: fail "reason why the test failed"
-fail() 
+fail()
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
@@ -49,7 +49,7 @@
 
 #Call this from anywhere to pass the test with a message
 # usage: pass "reason why the test passed if applicable"
-pass() 
+pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
    exit 0
@@ -63,7 +63,7 @@
 OS=`uname -s`
 export TRANSPORT_METHOD
 case "$OS" in
-   SunOS | Linux )
+   SunOS | Linux | Darwin )
       PATHSEP=":"
       TRANSPORT_METHOD=dt_socket
       ;;
@@ -80,8 +80,8 @@
       ;;
 esac
 #
-# Want this test to run standalone as well as in the harness, so do the 
-#  following to copy the test's directory into the harness's scratch directory 
+# Want this test to run standalone as well as in the harness, so do the
+#  following to copy the test's directory into the harness's scratch directory
 #  and set all appropriate variables:
 
 if [ -z "${TESTJAVA}" ] ; then
@@ -95,7 +95,7 @@
    if [ -n "$1" ] ; then
           TESTJAVA=$1
       else
-	  TESTJAVA=$JAVA_HOME
+          TESTJAVA=$JAVA_HOME
    fi
    TESTSRC=.
    TESTCLASSES=.
--- a/test/com/sun/jdi/Solaris32AndSolaris64Test.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/com/sun/jdi/Solaris32AndSolaris64Test.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -41,7 +41,7 @@
 
 #Call this from anywhere to fail the test with an error message
 # usage: fail "reason why the test failed"
-fail() 
+fail()
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
@@ -50,7 +50,7 @@
 
 #Call this from anywhere to pass the test with a message
 # usage: pass "reason why the test passed if applicable"
-pass() 
+pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
    exit 0
@@ -65,7 +65,7 @@
 testName=$1
 shift
 
-#Set appropriate jdk 
+#Set appropriate jdk
 
 if [ -z "${TESTJAVA}" ] ; then
    # TESTJAVA is not set, so the test is running stand-alone.
@@ -79,7 +79,7 @@
           TESTJAVA=$1
       else
           echo "no JDK specified on command line so using JAVA_HOME=$JAVA_HOME"
-	  TESTJAVA=$JAVA_HOME
+          TESTJAVA=$JAVA_HOME
    fi
    TESTSRC=.
    TESTCLASSES=.
@@ -104,15 +104,15 @@
       PATHSEP=":"
       PTYPE=`uname -p`
       if [ -x /usr/bin/isainfo ]; then
-	  # Instruction set being used by the OS
-	  ISET=`isainfo -k`
+          # Instruction set being used by the OS
+          ISET=`isainfo -k`
       else
-	  #SunOS 5.6 didn't have "isainfo"
+          #SunOS 5.6 didn't have "isainfo"
           pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
       fi
       ;;
 
-   Linux )
+   Linux | Darwin )
       pass "This test always passes on $OS"
       ;;
 
@@ -156,12 +156,12 @@
    pass "This test always passes on $OS/$PTYPE if 64 bit jdk is not installed"
 fi
 
-# Want this test to run standalone as well as in the harness, so do the 
-#  following to copy the test's directory into the harness's scratch directory 
+# Want this test to run standalone as well as in the harness, so do the
+#  following to copy the test's directory into the harness's scratch directory
 #  and set all appropriate variables:
 
 #Deal with .class files:
-if [ -n "${STANDALONE}" ] ; then 
+if [ -n "${STANDALONE}" ] ; then
    #if running standalone, compile the support files
    ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
             -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
@@ -177,7 +177,7 @@
 if [ ! -r ${filename} ] ; then
     filename=$TESTCLASSES/../@debuggeeVMOptions
 fi
-# Remove -d32, -d64 if present, and remove -XX:[+-]UseCompressedOops 
+# Remove -d32, -d64 if present, and remove -XX:[+-]UseCompressedOops
 # if present since it is illegal in 32 bit mode.
 if [ -r ${filename} ] ; then
     DEBUGGEEFLAGS=`cat ${filename} | sed \
@@ -204,19 +204,19 @@
         DEBUGGERFLAGS="-d${DEBUGGERMODEL} -showversion -DEXPECTED=${TARGETMODEL}"
         CONNECTSTRING="-connect 'com.sun.jdi.CommandLineLaunch:options=-d${TARGETMODEL} $DEBUGGEEFLAGS -showversion'"
 
-	for TARGETCLASS in $testName ; do
-	    echo "--------------------------------------------"
-	    echo "debugger=${DEBUGGERMODEL} debugee=${TARGETMODEL} class=${TARGETCLASS}"
-	    echo "--------------------------------------------"
-	    echo ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
-	    eval ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
-	    status=$?
-	    if [ $status -ne "0" ];
-	       then fail "$DEBUGGERMODEL to $TARGETMODEL test failed for class=$TARGETCLASS!"
-	    fi
-	done
+        for TARGETCLASS in $testName ; do
+            echo "--------------------------------------------"
+            echo "debugger=${DEBUGGERMODEL} debugee=${TARGETMODEL} class=${TARGETCLASS}"
+            echo "--------------------------------------------"
+            echo ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
+            eval ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
+            status=$?
+            if [ $status -ne "0" ];
+               then fail "$DEBUGGERMODEL to $TARGETMODEL test failed for class=$TARGETCLASS!"
+            fi
+        done
     done
-done  
+done
 #
 # pass or fail the test based on status of the command
 if [ $status -eq "0" ];
--- a/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -45,10 +45,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PS=":"
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     ;;
   Windows* | CYGWIN*)
@@ -65,7 +62,7 @@
 SOMEOTHERDIR="${TESTCLASSES}"/someotherdir
 
 # Compile test into the classes directory
-# Compile the list connectors class into a directory that isn't on 
+# Compile the list connectors class into a directory that isn't on
 # any class path.
 
 $JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java
@@ -74,7 +71,7 @@
 $JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar" \
     "${TESTSRC}"/ListConnectors.java
 
-# Run the test 
+# Run the test
 
 "${JAVA}" -classpath "${TESTCLASSES}" JdiLoadedByCustomLoader \
     "${SOMEOTHERDIR}"
--- a/test/com/sun/tools/attach/CommonSetup.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/com/sun/tools/attach/CommonSetup.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -36,11 +36,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PS=":"
-    FS="/"
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -72,7 +68,7 @@
   echo "TESTSRC not set.  Test cannot execute.  Failed."
   exit 1
 fi
- 
+
 if [ "${TESTCLASSES}" = "" ]
 then
   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
--- a/test/java/io/Serializable/evolution/RenamePackage/run.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/io/Serializable/evolution/RenamePackage/run.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -41,7 +41,7 @@
 # Need to determine the classpath separator and filepath separator based on the
 # operating system.
 case "$OS" in
-SunOS | Linux )
+SunOS | Linux | Darwin )
   PS=":"  ;;
 Windows* | CYGWIN* )
   PS=";"  ;;
@@ -55,19 +55,19 @@
 MKDIR=mkdir
 RDEL="rm -r"
 
-if [ -d ${TESTCLASSES}/oclasses ] 
+if [ -d ${TESTCLASSES}/oclasses ]
 then
-   ${RDEL} ${TESTCLASSES}/oclasses 
+   ${RDEL} ${TESTCLASSES}/oclasses
 fi
-if [ -d ${TESTCLASSES}/nclasses ] 
+if [ -d ${TESTCLASSES}/nclasses ]
 then
-   ${RDEL} ${TESTCLASSES}/nclasses 
+   ${RDEL} ${TESTCLASSES}/nclasses
 fi
-if [ -d ${TESTCLASSES}/share ] 
+if [ -d ${TESTCLASSES}/share ]
 then
-   ${RDEL} ${TESTCLASSES}/share 
+   ${RDEL} ${TESTCLASSES}/share
 fi
-if [ -f ${TESTCLASSES}/stream.ser ] 
+if [ -f ${TESTCLASSES}/stream.ser ]
 then
    ${RDEL} ${TESTCLASSES}/stream.ser
 fi
@@ -77,7 +77,7 @@
 mkdir ${TESTCLASSES}/nclasses
 
 # Build sources
-set -e 
+set -e
 ${JAVAC} -d ${TESTCLASSES}/share ${TESTSRC}/extension/ExtendedObjectInputStream.java
 CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;
 ${JAVAC} -d ${TESTCLASSES}/oclasses ${TESTSRC}/test/SerialDriver.java
--- a/test/java/io/Serializable/serialver/classpath/run.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/io/Serializable/serialver/classpath/run.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -47,7 +47,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"    ;;
   Windows* | CYGWIN* )
     PS=";"    ;;
--- a/test/java/io/Serializable/serialver/nested/run.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/io/Serializable/serialver/nested/run.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -25,7 +25,7 @@
 # @bug 4312217 4785473
 # @summary Test the use of the -classpath switch in the serialver application.
 # @author Naveen Sanjeeva
-# 
+#
 # @build Test
 # @run shell run.sh
 
@@ -43,11 +43,11 @@
   echo "FAILED!!!"
   exit 1
 fi
-  
+
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"    ;;
   Windows* | CYGWIN* )
     PS=";"    ;;
--- a/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -22,9 +22,9 @@
 #
 # @test
 # @bug 4735126
-# @summary (cl) ClassLoader.loadClass locks all instances in chain 
+# @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 "."
@@ -51,6 +51,9 @@
   Linux )
     FS="/"
     ;;
+  Darwin )
+    FS="/"
+    ;;
   Windows*)
     FS="\\"
     ;;
--- a/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -22,9 +22,9 @@
 #
 # @test
 # @bug 4735126
-# @summary (cl) ClassLoader.loadClass locks all instances in chain 
+# @summary (cl) ClassLoader.loadClass locks all instances in chain
 #          when delegating
-# 
+#
 # @run shell/timeout=10 TestOneWayDelegate.sh
 
 # if running by hand on windows, change TESTSRC and TESTCLASSES to "."
@@ -55,6 +55,9 @@
   Linux )
     FS="/"
     ;;
+  Darwin )
+    FS="/"
+    ;;
   Windows* | CYGWIN* )
     FS="\\"
     ;;
--- a/test/java/lang/ProcessBuilder/Basic.java	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/ProcessBuilder/Basic.java	Thu Dec 22 11:05:51 2011 -0800
@@ -1632,6 +1632,14 @@
             } else {
                 envp = envpOth;
             }
+            System.out.println ("cmdp");
+            for (int i=0; i<cmdp.length; i++) {
+                System.out.printf ("cmdp %d: %s\n", i, cmdp[i]);
+            }
+            System.out.println ("envp");
+            for (int i=0; i<envp.length; i++) {
+                System.out.printf ("envp %d: %s\n", i, envp[i]);
+            }
             Process p = Runtime.getRuntime().exec(cmdp, envp);
             check(commandOutput(p).equals(Windows.is() ? "SystemRoot="+systemRoot+",LC_ALL=C," : "LC_ALL=C,"),
                   "Incorrect handling of envstrings containing NULs");
--- a/test/java/lang/ProcessBuilder/Zombies.java	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/ProcessBuilder/Zombies.java	Thu Dec 22 11:05:51 2011 -0800
@@ -49,11 +49,11 @@
         } catch (IOException _) {/* OK */}
 
         try {
-            rt.exec("/bin/true", null, new File("no-such-dir"));
+            rt.exec("/usr/bin/true", null, new File("no-such-dir"));
             throw new Error("expected IOException not thrown");
         } catch (IOException _) {/* OK */}
 
-        rt.exec("/bin/true").waitFor();
+        rt.exec("/usr/bin/true").waitFor();
 
         // Count all the zombies that are children of this Java process
         final String[] zombieCounter = {
--- a/test/java/lang/StringCoding/CheckEncodings.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/StringCoding/CheckEncodings.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -30,7 +30,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux ) ;;
+  SunOS | Linux | Darwin) ;;
   Windows* | CYGWIN* )
     echo "Passed"; exit 0 ;;
   * ) echo "Unrecognized system!" ;  exit 1 ;;
@@ -63,7 +63,7 @@
 for i in `xargs < locale_union.txt` ; do
   runTest ${i}
 done
-  
+
 # random strings
 for i in FOO 1234 ZZ; do
   runTest ${i}
--- a/test/java/lang/annotation/loaderLeak/LoaderLeak.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/annotation/loaderLeak/LoaderLeak.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -44,7 +44,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin)
     NULL=/dev/null
     PS=":"
     FS="/"
--- a/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -43,6 +43,10 @@
     PS=":"
     FS="/"
     ;;
+  Darwin )
+    PS=":"
+    FS="/"
+    ;;
   Windows*)
     PS=";"
     OS="Windows"
--- a/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -21,10 +21,10 @@
 # questions.
 #
 
-# 
+#
 # @test
 # @summary  Tests OperatingSystemMXBean.getSystemLoadAverage() api.
-# @author   Mandy Chung 
+# @author   Mandy Chung
 # @bug      6336608 6367473 6511738
 #
 # @run build GetSystemLoadAverage
@@ -61,10 +61,7 @@
 while true; do
   echo "Run $i: TestSystemLoadAvg"
   case `uname -s` in
-       SunOS )
-         runOne GetSystemLoadAverage 
-         ;;
-       Linux )
+       SunOS | Linux | Darwin )
          runOne GetSystemLoadAverage
          ;;
       * )
@@ -81,6 +78,6 @@
       exit 1
   fi
   i=`expr $i + 1`
-  # sleep for 5 seconds 
+  # sleep for 5 seconds
   sleep 5
 done
--- a/test/java/net/Authenticator/B4933582.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/Authenticator/B4933582.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -26,7 +26,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/java/net/DatagramSocket/Send12k.java	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/DatagramSocket/Send12k.java	Thu Dec 22 11:05:51 2011 -0800
@@ -33,10 +33,16 @@
 
 public class Send12k {
 
-    static final int SEND_SIZE = 16 * 1024;
 
     public static void main(String args[]) throws Exception {
 
+         int SEND_SIZE=0;
+
+         if(System.getProperty("os.name").contains("Mac")) {
+             SEND_SIZE = 16 * 576;
+         } else {
+             SEND_SIZE = 16 * 1024;
+         }
         DatagramSocket s1 = new DatagramSocket();
         DatagramSocket s2 = new DatagramSocket();
 
--- a/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -27,7 +27,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS )
+  SunOS | Darwin )
     PATHSEP=":"
     FILESEP="/"
     ;;
--- a/test/java/net/Socket/OldSocketImpl.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/Socket/OldSocketImpl.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -28,7 +28,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -46,10 +46,10 @@
     ;;
 esac
 
-# no need to compile the test. It is already compiled 
+# no need to compile the test. It is already compiled
 # with 1.3 and in OldStyleImpl.jar
 
-# run 
+# run
 ${TESTJAVA}${FS}bin${FS}java -cp ${TESTSRC}${FS}OldSocketImpl.jar OldSocketImpl
 result=$?
 if [ "$result" -ne "0" ]; then
--- a/test/java/net/URL/B5086147.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/URL/B5086147.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -26,7 +26,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     exit 0
     ;;
   CYGWIN* )
--- a/test/java/net/URL/runconstructor.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/URL/runconstructor.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -27,7 +27,7 @@
 #
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/java/net/URLClassLoader/B5077773.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/URLClassLoader/B5077773.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -34,7 +34,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
+  SunOS | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/java/net/URLClassLoader/sealing/checksealed.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/URLClassLoader/sealing/checksealed.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -27,13 +27,13 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
+  SunOS | Darwin )
     PS=":"
-    FS="/"            
+    FS="/"
     ;;
   Linux )
     PS=":"
-    FS="/"            
+    FS="/"
     ;;
   CYGWIN* )
     PS=";"
--- a/test/java/net/URLConnection/6212146/test.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/net/URLConnection/6212146/test.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -33,7 +33,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
+  SunOS | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -67,7 +67,7 @@
 
 WD=`pwd`
 ulimit -H -n 300
-${TESTJAVA}${FS}bin${FS}java Test ${WD}/jars/ test.jar 
+${TESTJAVA}${FS}bin${FS}java Test ${WD}/jars/ test.jar
 result=$?
 rm -rf jars
 exit $?
--- a/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -54,6 +54,10 @@
     PATHSEP=":"
     FILESEP="/"
     ;;
+  Darwin )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
   CYGWIN* )
     PATHSEP=";"
     FILESEP="/"
@@ -75,17 +79,17 @@
 
 # compile the test program
 ${TESTJAVA}${FILESEP}bin${FILESEP}javac \
-	-d ${TESTCLASSES}${FILESEP} \
-	${TESTSRC}${FILESEP}ClassLoaderDeadlock.java
+        -d ${TESTCLASSES}${FILESEP} \
+        ${TESTSRC}${FILESEP}ClassLoaderDeadlock.java
 
 ${TESTJAVA}${FILESEP}bin${FILESEP}javac \
-	-d ${TESTCLASSES}${FILESEP}provider${FILESEP} \
-	${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java
+        -d ${TESTCLASSES}${FILESEP}provider${FILESEP} \
+        ${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java
 
 # run the test
 ${TESTJAVA}${FILESEP}bin${FILESEP}java \
-	-classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \
-	ClassLoaderDeadlock
+        -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \
+        ClassLoaderDeadlock
 
 STATUS=$?
 
--- a/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -42,6 +42,10 @@
     PATHSEP=":"
     FILESEP="/"
     ;;
+  Darwin )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
   CYGWIN* )
     PATHSEP=";"
     FILESEP="/"
--- a/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -58,6 +58,10 @@
     PATHSEP=":"
     FILESEP="/"
     ;;
+  Darwin )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
   Windows* )
     PATHSEP=";"
     FILESEP="\\"
--- a/test/java/security/Security/signedfirst/Dyn.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/security/Security/signedfirst/Dyn.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -54,6 +54,10 @@
     PATHSEP=":"
     FILESEP="/"
     ;;
+  Darwin )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
   CYGWIN* )
     PATHSEP=";"
     FILESEP="/"
@@ -74,13 +78,13 @@
 
 # compile the test program
 ${TESTJAVA}${FILESEP}bin${FILESEP}javac \
-	-classpath ${TESTSRC}${FILESEP}exp.jar \
-	-d ${TESTCLASSES}${FILESEP} \
-	${TESTSRC}${FILESEP}DynSignedProvFirst.java
+        -classpath ${TESTSRC}${FILESEP}exp.jar \
+        -d ${TESTCLASSES}${FILESEP} \
+        ${TESTSRC}${FILESEP}DynSignedProvFirst.java
 
 # run the test
 ${TESTJAVA}${FILESEP}bin${FILESEP}java \
-	-classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \
-	DynSignedProvFirst
+        -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \
+        DynSignedProvFirst
 
 exit $?
--- a/test/java/security/Security/signedfirst/Static.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/security/Security/signedfirst/Static.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -54,6 +54,10 @@
     PATHSEP=":"
     FILESEP="/"
     ;;
+  Darwin )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
   CYGWIN* )
     PATHSEP=";"
     FILESEP="/"
@@ -74,15 +78,15 @@
 
 # compile the test program
 ${TESTJAVA}${FILESEP}bin${FILESEP}javac \
-	-classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \
-	-d ${TESTCLASSES}${FILESEP} \
-	${TESTSRC}${FILESEP}StaticSignedProvFirst.java
+        -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \
+        -d ${TESTCLASSES}${FILESEP} \
+        ${TESTSRC}${FILESEP}StaticSignedProvFirst.java
 
 # run the test
 cd ${TESTSRC}${FILESEP}
 ${TESTJAVA}${FILESEP}bin${FILESEP}java \
-	-classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \
-	-Djava.security.properties=file:${TESTSRC}${FILESEP}Static.props \
-	StaticSignedProvFirst
+        -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}exp.jar" \
+        -Djava.security.properties=file:${TESTSRC}${FILESEP}Static.props \
+        StaticSignedProvFirst
 
 exit $?
--- a/test/java/util/Currency/PropertiesTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/util/Currency/PropertiesTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -30,7 +30,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -65,10 +65,10 @@
 # copy the test properties file
 COPIED=0
 if [ -w $TESTJAVA ]
-then 
+then
   WRITABLEJDK=$TESTJAVA
 else
-  WRITABLEJDK=.${FS}testjava 
+  WRITABLEJDK=.${FS}testjava
   cp -r $TESTJAVA $WRITABLEJDK
   COPIED=1
 fi
--- a/test/java/util/Locale/LocaleCategory.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/util/Locale/LocaleCategory.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -2,7 +2,7 @@
 #
 # @test
 # @bug 4700857 6997928 7079486
-# @summary tests for Locale.getDefault(Locale.Category) and 
+# @summary tests for Locale.getDefault(Locale.Category) and
 #    Locale.setDefault(Locale.Category, Locale)
 # @build LocaleCategory
 # @run shell/timeout=600 LocaleCategory.sh
@@ -30,7 +30,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | *BSD | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/java/util/PluggableLocale/ExecTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/util/PluggableLocale/ExecTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -1,21 +1,21 @@
-# 
+#
 # 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.
@@ -27,9 +27,9 @@
 # This script is the actual launcher of each locale service provider test.
 # fooprovider.jar contains localized object providers and barprovider.jar
 # contains localized name providers.  This way, we can test providers that
-# can relate to each other (such as, DateFormatSymbolsProvider and 
+# can relate to each other (such as, DateFormatSymbolsProvider and
 # TimeZoneNameProvider) separately.
-# 
+#
 # Parameters:
 #    providersToTest: [foo|bar|foobar]
 #    java class name: <class name>
@@ -58,7 +58,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -80,7 +80,7 @@
     EXTDIRS="${TESTJAVA}${FS}jre${FS}lib${FS}ext${PS}${TESTCLASSES}"
 fi
 
-case "$1" in 
+case "$1" in
   "foo" )
     cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
     CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar"
@@ -95,7 +95,7 @@
     CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
     ;;
 esac
-    
+
 # compile
 cp ${TESTSRC}${FS}ProviderTest.java .
 cp ${TESTSRC}${FS}$2.java .
@@ -107,7 +107,7 @@
 if [ $result -eq 0 ]
 then
   echo "Compilation of the test case was successful."
-else 
+else
   echo "Compilation of the test case failed."
   # Cleanup
   rm -f ${TESTCLASSES}${FS}$2*.class
--- a/test/java/util/ResourceBundle/Bug6299235Test.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/util/ResourceBundle/Bug6299235Test.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -1,21 +1,21 @@
-# 
+#
 # 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.
@@ -31,7 +31,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PATHSEP=":"
     FILESEP="/"
     ;;
--- a/test/java/util/ResourceBundle/Control/ExpirationTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/util/ResourceBundle/Control/ExpirationTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -1,21 +1,21 @@
-# 
+#
 # 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.
@@ -72,7 +72,7 @@
 Windows* | CYGWIN* )
     DEL=";"
     ;;
-SunOS)
+SunOS | Darwin)
     DEL=":"
     ;;
 Linux)
@@ -103,11 +103,11 @@
 
 createJar() {
     if [ "$FORMAT" = "properties" ]; then
-	createProperties
-	F="${DATA}*.properties"
+        createProperties
+        F="${DATA}*.properties"
     else
-	createClasses
-	F="-C classes ${ROOT}.class -C classes ${JA}.class -C classes ${DE}.class"
+        createClasses
+        F="-C classes ${ROOT}.class -C classes ${JA}.class -C classes ${DE}.class"
     fi
     ${TESTJAVA}/bin/jar cf $JARFILE $F
     ${TESTJAVA}/bin/jar tvf $JARFILE
@@ -132,12 +132,12 @@
 
 public class $1 extends ListResourceBundle {
     public Object[][] getContents() {
-	return new Object[][] {
-	    { \"data\", \"$2\" },"
+        return new Object[][] {
+            { \"data\", \"$2\" },"
     if [ "x$3" != "x" ]; then
-	echo "	    { \"january\", \"$3\" },"
+        echo "      { \"january\", \"$3\" },"
     fi
-echo "	};
+echo "  };
     }
 }") >$1.java
 }
@@ -161,11 +161,11 @@
 
 updateJar() {
     if [ "$FORMAT" = "properties" ]; then
-	updateDEaddAT
-	F="$DE $AT"
+        updateDEaddAT
+        F="$DE $AT"
     else
-	updateClassDEaddClassAT
-	F="-C classes ${DE}.class -C classes ${AT}.class"
+        updateClassDEaddClassAT
+        F="-C classes ${DE}.class -C classes ${AT}.class"
     fi
     ${TESTJAVA}/bin/jar uf $JARFILE $F
     rm -f $DE $AT
@@ -175,12 +175,12 @@
 
 getSeconds() {
     if [ "$HAS_S" = "YES" ]; then
-	date '+%s'
+        date '+%s'
     else
-	# Returns an approximation of the offset from the Epoch in
-	# seconds.
-	date -u '+%Y %j %H %M %S' | \
-	awk '{d=($1-1970)*365.2425; print int(((((((d+$2-1)*24)+$3)*60)+$3)*60)+$5);}'
+        # Returns an approximation of the offset from the Epoch in
+        # seconds.
+        date -u '+%Y %j %H %M %S' | \
+        awk '{d=($1-1970)*365.2425; print int(((((((d+$2-1)*24)+$3)*60)+$3)*60)+$5);}'
     fi
 }
 
@@ -196,9 +196,9 @@
     # If this machine is too slow, give up the further testing.
     #
     if [ "$D" -gt $2 ]; then
-	1>&2 echo "This machine took $D seconds to prepare test data," \
-		  "which is too slow to proceed. Exiting..."
-	exit 0
+        1>&2 echo "This machine took $D seconds to prepare test data," \
+                  "which is too slow to proceed. Exiting..."
+        exit 0
     fi
     unset S
     unset E
@@ -207,13 +207,13 @@
 
 checkStatus() {
     if [ $1 = 0 ]; then
-	echo "$2: PASSED"
+        echo "$2: PASSED"
     elif [ $1 != 2 ]; then
-	echo "$2: FAILED"
-	exit 1
+        echo "$2: FAILED"
+        exit 1
     else
-	# Just we should't proceed to avoid timing issues.
-	exit 0
+        # Just we should't proceed to avoid timing issues.
+        exit 0
     fi
 }
 
--- a/test/java/util/ServiceLoader/basic.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/java/util/ServiceLoader/basic.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -42,7 +42,7 @@
 
 OS=`uname -s`
 case "$OS" in
-    SunOS )
+    SunOS | Darwin )
       SEP=':' ;;
     Linux )
       SEP=':' ;;
@@ -63,7 +63,7 @@
     for n in 2 3; do
       rm -rf $JARD/*; mkdir -p $JARD/META-INF/services
       echo FooProvider$n \
-	>$JARD/META-INF/services/FooService
+        >$JARD/META-INF/services/FooService
       cp $TESTCLASSES/FooProvider$n.class $JARD
       if [ $n = 3 ]; then
         cp $TESTCLASSES/FooService.class $JARD
--- a/test/javax/crypto/SecretKeyFactory/FailOverTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/javax/crypto/SecretKeyFactory/FailOverTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -51,7 +51,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
--- a/test/javax/imageio/stream/StreamCloserLeak/run_test.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/javax/imageio/stream/StreamCloserLeak/run_test.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -84,7 +84,7 @@
       TMP="/tmp"
       ;;
 
-   Linux )
+   Linux | Darwin )
       VAR="A different value for Linux"
       DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386
       FILESEP="/"
@@ -123,7 +123,7 @@
    if [ -n "$1" ] ;
       then TESTJAVA=$1
       else echo "no JDK specified on command line so using default!"
-	 TESTJAVA=$DEFAULT_JDK
+         TESTJAVA=$DEFAULT_JDK
    fi
    TESTSRC=.
    TESTCLASSES=.
--- a/test/javax/script/CommonSetup.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/javax/script/CommonSetup.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -36,11 +36,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PS=":"
-    FS="/"
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -72,7 +68,7 @@
   echo "TESTSRC not set.  Test cannot execute.  Failed."
   exit 1
 fi
- 
+
 if [ "${TESTCLASSES}" = "" ]
 then
   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
--- a/test/javax/security/auth/Subject/doAs/Test.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/javax/security/auth/Subject/doAs/Test.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -25,7 +25,7 @@
 
 # @test 1.1, 02/14/01
 # @author  Ram Marti
-# @bug 4399067 
+# @bug 4399067
 # @summary Subject.doAs(null, action) does not clear the executing
 #
 # ${TESTJAVA} is pointing to the jre
@@ -43,6 +43,11 @@
     FS="/"
     RM="/bin/rm -f"
     ;;
+  Darwin )
+    PS=":"
+    FS="/"
+    RM="/bin/rm -f"
+    ;;
   CYGWIN* )
     PS=";"
     FS="/"
@@ -69,6 +74,6 @@
 ${TESTJAVA}${FS}bin${FS}java -classpath "${TESTCLASSES}${FS}" \
 -Djava.security.manager  \
 -Djava.security.policy=${TESTSRC}${FS}policy \
-Test 
+Test
 
 exit $?
--- a/test/lib/security/java.policy/Ext_AllPolicy.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/lib/security/java.policy/Ext_AllPolicy.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -50,7 +50,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
@@ -81,6 +81,6 @@
 
 rm Ext_AllPolicy.class
 ${TESTJAVA}${FS}bin${FS}java \
-	-Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy
+        -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy
 
 exit $?
--- a/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -26,7 +26,7 @@
 # or .access files from a list of input .in files.
 #
 # Source in this GeneratePropertyPassword.sh and call the function
-# generatePropertyPasswordFiles. 
+# generatePropertyPasswordFiles.
 # Call restoreFilePermissions to restore file permissions after the test completes
 #
 
@@ -35,7 +35,7 @@
 UMASK=`umask`
 
 case $OS in
-SunOS | Linux)
+SunOS | Linux | Darwin)
     PATHSEP=":"
     FILESEP="/"
     DFILESEP=$FILESEP
@@ -60,12 +60,12 @@
         sed -e 's^ZZZZ^\\\\\\\\^g' > ${TMP_FILE}
 
     if [ "$OS" = "Windows_NT" ]; then
-	USER=`id -u -n`
-	CACLS="$SystemRoot/system32/cacls.exe"
-	REVOKEALL="${TESTSRC}/../../windows/revokeall.exe"
-	if [ ! -f "$REVOKEALL" ] ; then
-	    echo "$REVOKEALL missing"
-	    exit 1
+        USER=`id -u -n`
+        CACLS="$SystemRoot/system32/cacls.exe"
+        REVOKEALL="${TESTSRC}/../../windows/revokeall.exe"
+        if [ ! -f "$REVOKEALL" ] ; then
+            echo "$REVOKEALL missing"
+            exit 1
         fi
     fi
 
@@ -77,47 +77,47 @@
     ;;
 esac
 
-generatePropertyPasswordFiles() 
+generatePropertyPasswordFiles()
 {
    for f in $@
    do
         echo processing $f
-	suffix=`basename $f .in`
-   	f2="${TESTCLASSES}${FILESEP}${suffix}"
+        suffix=`basename $f .in`
+        f2="${TESTCLASSES}${FILESEP}${suffix}"
 
-	if [ -f "$f2" ] ; then
-	    rm -f $f2 || echo WARNING: $f2 already exits - unable to remove old copy
-	fi
+        if [ -f "$f2" ] ; then
+            rm -f $f2 || echo WARNING: $f2 already exits - unable to remove old copy
+        fi
 
-	echo creating $f2
+        echo creating $f2
         sed -f $TMP_FILE $f > $f2
 
- 	if [ "$OS" = "Windows_NT" ]; then
-	    chown $USER $f2
-	    # Grant this user full access
-	    echo Y|$CACLS $f2 \/E \/G $USER:F
-  	    # Revoke everyone else
-	    $REVOKEALL $f2
-	    # Display ACLs
-	    $CACLS $f2
+        if [ "$OS" = "Windows_NT" ]; then
+            chown $USER $f2
+            # Grant this user full access
+            echo Y|$CACLS $f2 \/E \/G $USER:F
+            # Revoke everyone else
+            $REVOKEALL $f2
+            # Display ACLs
+            $CACLS $f2
         else
-	    chmod 600 $f2
+            chmod 600 $f2
         fi
    done
 }
 
-restoreFilePermissions() 
+restoreFilePermissions()
 {
     for f in $@
     do
-      	suffix=`basename $f .in`
-	f2="${TESTCLASSES}${FILESEP}${suffix}"
+        suffix=`basename $f .in`
+        f2="${TESTCLASSES}${FILESEP}${suffix}"
 
-	if [ "$OS" = "Windows_NT" ]; then
-	    # Grant everyone full control
-	    $CACLS $f2 \/E \/G Everyone:F
-	else
-	    chmod 777 $f2
+        if [ "$OS" = "Windows_NT" ]; then
+            # Grant everyone full control
+            $CACLS $f2 \/E \/G Everyone:F
+        else
+            chmod 777 $f2
         fi
 
     done
--- a/test/sun/misc/URLClassPath/ClassnameCharTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/misc/URLClassPath/ClassnameCharTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -36,11 +36,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PS=":"
-    FS="/"
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/sun/net/www/MarkResetTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/net/www/MarkResetTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -28,7 +28,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -49,7 +49,7 @@
 ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}MarkResetTest.java
 
 # ftp server used by the test requires the file to be present
-# in this directory 
+# in this directory
 cp ${TESTSRC}${FS}EncDec.doc .
 
 ${TESTJAVA}${FS}bin${FS}java MarkResetTest
--- a/test/sun/net/www/http/HttpClient/RetryPost.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/net/www/http/HttpClient/RetryPost.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -28,7 +28,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/sun/net/www/protocol/jar/B5105410.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/net/www/protocol/jar/B5105410.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -31,11 +31,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PS=":"
-    FS="/"
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/sun/net/www/protocol/jar/jarbug/run.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/net/www/protocol/jar/jarbug/run.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -31,11 +31,7 @@
 
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PS=":"
-    FS="/"
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
@@ -58,10 +54,10 @@
 esac
 
 #
-# build jar1 
+# build jar1
 #
 mkdir -p ${DEST}${FS}jar1
-cd ${TESTSRC}${FS}etc${FS}jar1 
+cd ${TESTSRC}${FS}etc${FS}jar1
 cp -r . ${DEST}${FS}jar1
 ${TESTJAVA}${FS}bin${FS}javac -d ${DEST}${FS}jar1 \
     ${TESTSRC}${FS}src${FS}jar1${FS}LoadResourceBundle.java
--- a/test/sun/security/krb5/runNameEquals.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/krb5/runNameEquals.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -48,12 +48,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS )
-    PATHSEP=":"
-    FILESEP="/"
-    NATIVE=true
-    ;;
-  Linux )
+  SunOS | Linux | Darwin )
     PATHSEP=":"
     FILESEP="/"
     NATIVE=true
--- a/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -62,6 +62,12 @@
     CP="${FS}bin${FS}cp"
     CHMOD="${FS}bin${FS}chmod"
     ;;
+  Darwin )
+    FS="/"
+    PS=":"
+    CP="${FS}bin${FS}cp"
+    CHMOD="${FS}bin${FS}chmod"
+    ;;
   Windows* )
     FS="\\"
     PS=";"
@@ -87,18 +93,18 @@
 # compile test
 
 ${TESTJAVA}${FS}bin${FS}javac \
-	-classpath ${TESTSRC}${FS}.. \
-	-d ${TESTCLASSES} \
-	${TESTSRC}${FS}ConfigQuotedString.java
+        -classpath ${TESTSRC}${FS}.. \
+        -d ${TESTCLASSES} \
+        ${TESTSRC}${FS}ConfigQuotedString.java
 
 # run test
 
 ${TESTJAVA}${FS}bin${FS}java \
-	-classpath ${TESTCLASSES} \
-	-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \
-	-Dtest.src=${TESTSRC} \
-	-Dtest.classes=${TESTCLASSES} \
-	ConfigQuotedString
+        -classpath ${TESTCLASSES} \
+        -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \
+        -Dtest.src=${TESTSRC} \
+        -Dtest.classes=${TESTCLASSES} \
+        ConfigQuotedString
 
 # save error status
 status=$?
--- a/test/sun/security/pkcs11/Provider/Login.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/pkcs11/Provider/Login.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -63,6 +63,12 @@
     CP="${FS}bin${FS}cp"
     CHMOD="${FS}bin${FS}chmod"
     ;;
+  Darwin )
+    FS="/"
+    PS=":"
+    CP="${FS}bin${FS}cp"
+    CHMOD="${FS}bin${FS}chmod"
+    ;;
   Windows* )
     FS="\\"
     PS=";"
@@ -96,24 +102,24 @@
 # compile test
 
 ${TESTJAVA}${FS}bin${FS}javac \
-	-classpath ${TESTSRC}${FS}.. \
-	-d ${TESTCLASSES} \
-	${TESTSRC}${FS}Login.java
+        -classpath ${TESTSRC}${FS}.. \
+        -d ${TESTCLASSES} \
+        ${TESTSRC}${FS}Login.java
 
 # run test
 
 ${TESTJAVA}${FS}bin${FS}java \
-	-classpath ${TESTCLASSES} \
-	-DCUSTOM_DB_DIR=${TESTCLASSES} \
-	-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \
-	-DNO_DEFAULT=true \
-	-DNO_DEIMOS=true \
-	-Dtest.src=${TESTSRC} \
-	-Dtest.classes=${TESTCLASSES} \
-	-Djava.security.manager \
-	-Djava.security.policy=${TESTSRC}${FS}Login.policy \
-	-Djava.security.debug=${DEBUG} \
-	Login
+        -classpath ${TESTCLASSES} \
+        -DCUSTOM_DB_DIR=${TESTCLASSES} \
+        -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \
+        -DNO_DEFAULT=true \
+        -DNO_DEIMOS=true \
+        -Dtest.src=${TESTSRC} \
+        -Dtest.classes=${TESTCLASSES} \
+        -Djava.security.manager \
+        -Djava.security.policy=${TESTSRC}${FS}Login.policy \
+        -Djava.security.debug=${DEBUG} \
+        Login
 
 # save error status
 status=$?
--- a/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -25,8 +25,8 @@
 
 # @test
 # @author  Ram Marti
-# @bug 4350951 
-# @summary 4350951 assumes permission constructor with 2 string params 
+# @bug 4350951
+# @summary 4350951 assumes permission constructor with 2 string params
 
 # set a few environment variables so that the shell-script can run stand-alone
 # in the source directory
@@ -55,6 +55,10 @@
     PS=":"
     FS="/"
     ;;
+  Darwin )
+    PS=":"
+    FS="/"
+    ;;
   CYGWIN* )
     PS=";"
     FS="/"
@@ -69,24 +73,24 @@
     ;;
 esac
 
-if [ ! -d ${TESTCLASSES}${FS}boot ]; then 
-	mkdir -p ${TESTCLASSES}${FS}boot
+if [ ! -d ${TESTCLASSES}${FS}boot ]; then
+        mkdir -p ${TESTCLASSES}${FS}boot
 fi
-if [ ! -d ${TESTCLASSES}${FS}app ]; then 
-	mkdir -p ${TESTCLASSES}${FS}app
+if [ ! -d ${TESTCLASSES}${FS}app ]; then
+        mkdir -p ${TESTCLASSES}${FS}app
 fi
 
 cd ${TESTSRC}${FS}
 ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
-	${TESTSRC}${FS}NoArgPermission.java
+        ${TESTSRC}${FS}NoArgPermission.java
 ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
-	${TESTSRC}${FS}OneArgPermission.java
+        ${TESTSRC}${FS}OneArgPermission.java
 ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
-	${TESTSRC}${FS}TwoArgPermission.java
+        ${TESTSRC}${FS}TwoArgPermission.java
 ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
-	${TESTSRC}${FS}TwoArgNullActionsPermission.java
+        ${TESTSRC}${FS}TwoArgNullActionsPermission.java
 ${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}app \
-	${TESTSRC}${FS}GetInstance.java
+        ${TESTSRC}${FS}GetInstance.java
 
 ${TESTJAVA}${FS}bin${FS}java  \
 -Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -31,31 +31,31 @@
 
 if [ "${TESTJAVA}" = "" ]
 then
-	echo "TESTJAVA not set.  Test cannot execute.  Failed."
-	exit 1
+        echo "TESTJAVA not set.  Test cannot execute.  Failed."
+        exit 1
 fi
 
 if [ "${TESTSRC}" = "" ]
 then
-	TESTSRC="."
+        TESTSRC="."
 fi
 
 OS=`uname -s`
 case "$OS" in
-    SunOS | Linux )
+    SunOS | Linux | Darwin )
         FILESEP="/"
-	PATHSEP=":"
-	;;
+        PATHSEP=":"
+        ;;
 
     CYGWIN* )
         FILESEP="/"
-	PATHSEP=";"
-	;;
+        PATHSEP=";"
+        ;;
 
     Windows* )
         FILESEP="\\"
-	PATHSEP=";"
-	;;
+        PATHSEP=";"
+        ;;
 esac
 
 set -ex
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -32,7 +32,7 @@
 HOSTNAME=`uname -n`
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -32,7 +32,7 @@
 HOSTNAME=`uname -n`
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PS=":"
     FS="/"
     ;;
--- a/test/sun/security/tools/jarsigner/AlgOptions.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/jarsigner/AlgOptions.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -46,7 +46,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
@@ -87,7 +87,7 @@
 if [ $RESULT -eq 0 ]; then
     echo "test 1 failed"
     failed=1
-else 
+else
     echo "test 1 passed"
 fi
 
@@ -101,11 +101,11 @@
 if [ $RESULT -eq 0 ]; then
     echo "test 2 failed"
     failed=1
-else 
+else
     echo "test 2 passed"
 fi
 
-# test BOGUS signature algorithm 
+# test BOGUS signature algorithm
 ${TESTJAVA}${FS}bin${FS}jarsigner \
     -keystore ${TESTSRC}${FS}JarSigning.keystore \
     -storepass bbbbbb \
@@ -115,11 +115,11 @@
 if [ $RESULT -eq 0 ]; then
     echo "test 3 failed"
     failed=1
-else 
+else
     echo "test 3 passed"
 fi
 
-# test BOGUS digest algorithm 
+# test BOGUS digest algorithm
 ${TESTJAVA}${FS}bin${FS}jarsigner \
     -keystore ${TESTSRC}${FS}JarSigning.keystore \
     -storepass bbbbbb \
@@ -129,11 +129,11 @@
 if [ $RESULT -eq 0 ]; then
     echo "test 4 failed"
     failed=1
-else 
+else
     echo "test 4 passed"
 fi
 
-# test incompatible signature algorithm 
+# test incompatible signature algorithm
 ${TESTJAVA}${FS}bin${FS}jarsigner \
     -keystore ${TESTSRC}${FS}JarSigning.keystore \
     -storepass bbbbbb \
@@ -143,11 +143,11 @@
 if [ $RESULT -eq 0 ]; then
     echo "test 5 failed"
     failed=1
-else 
+else
     echo "test 5 passed"
 fi
 
-# test compatible signature algorithm 
+# test compatible signature algorithm
 ${TESTJAVA}${FS}bin${FS}jarsigner \
     -keystore ${TESTSRC}${FS}JarSigning.keystore \
     -storepass bbbbbb \
@@ -156,22 +156,22 @@
 RESULT=$?
 if [ $RESULT -eq 0 ]; then
     echo "test 6 passed"
-else 
+else
     echo "test 6 failed"
     failed=1
 fi
 
-# verify it 
+# verify it
 ${TESTJAVA}${FS}bin${FS}jarsigner -verify ${TESTCLASSES}${FS}AlgOptionsTmp.jar
 RESULT=$?
 if [ $RESULT -eq 0 ]; then
     echo "test 7 passed"
-else 
+else
     echo "test 7 failed"
     failed=1
 fi
 
-# test non-default digest algorithm 
+# test non-default digest algorithm
 ${TESTJAVA}${FS}bin${FS}jarsigner \
     -keystore ${TESTSRC}${FS}JarSigning.keystore \
     -storepass bbbbbb \
@@ -180,17 +180,17 @@
 RESULT=$?
 if [ $RESULT -eq 0 ]; then
     echo "test 8 passed"
-else 
+else
     echo "test 8 failed"
     failed=1
 fi
 
-# verify it 
+# verify it
 ${TESTJAVA}${FS}bin${FS}jarsigner -verify ${TESTCLASSES}${FS}AlgOptionsTmp.jar
 RESULT=$?
 if [ $RESULT -eq 0 ]; then
     echo "test 9 passed"
-else 
+else
     echo "test 9 failed"
     failed=1
 fi
@@ -205,17 +205,17 @@
 RESULT=$?
 if [ $RESULT -eq 0 ]; then
     echo "test 10 passed"
-else 
+else
     echo "test 10 failed"
     failed=1
 fi
 
-# verify it 
+# verify it
 ${TESTJAVA}${FS}bin${FS}jarsigner -verify ${TESTCLASSES}${FS}AlgOptionsTmp.jar
 RESULT=$?
 if [ $RESULT -eq 0 ]; then
     echo "test 11 passed"
-else 
+else
     echo "test 11 failed"
     failed=1
 fi
--- a/test/sun/security/tools/jarsigner/PercentSign.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/jarsigner/PercentSign.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -46,7 +46,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
--- a/test/sun/security/tools/jarsigner/diffend.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/jarsigner/diffend.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -41,7 +41,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
--- a/test/sun/security/tools/jarsigner/oldsig.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/jarsigner/oldsig.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -1,21 +1,21 @@
 #
 # 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.
@@ -42,7 +42,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
@@ -73,7 +73,7 @@
 ${CP} ${TESTSRC}${FS}oldsig${FS}A.jar B.jar
 ${CP} ${TESTSRC}${FS}oldsig${FS}A.class B.class
 
-${TESTJAVA}${FS}bin${FS}jar uvf B.jar B.class 
+${TESTJAVA}${FS}bin${FS}jar uvf B.jar B.class
 ${TESTJAVA}${FS}bin${FS}jarsigner \
     -keystore ${TESTSRC}${FS}JarSigning.keystore \
     -storepass bbbbbb \
--- a/test/sun/security/tools/keytool/AltProviderPath.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/AltProviderPath.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -46,7 +46,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
@@ -79,7 +79,7 @@
     -storetype "dks" -provider "org.test.dummy.DummyProvider" \
     -providerPath ${TESTCLASSES}
 
-if [ $? -ne 0 ]; then 
+if [ $? -ne 0 ]; then
     exit 1
 fi
 
@@ -88,7 +88,7 @@
     -keystore keystoreCA.dks -storetype "dks" -storepass storepass \
     -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES}
 
-if [ $? -ne 0 ]; then 
+if [ $? -ne 0 ]; then
     exit 1
 fi
 
@@ -99,7 +99,7 @@
     -storetype "dks" -storepass storepass2 \
     -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES}
 
-if [ $? -ne 0 ]; then 
+if [ $? -ne 0 ]; then
     exit 1
 fi
 
@@ -109,7 +109,7 @@
     -storepass storepass2 -provider "org.test.dummy.DummyProvider" \
     -providerPath ${TESTCLASSES}
 
-if [ $? -ne 0 ]; then 
+if [ $? -ne 0 ]; then
     exit 1
 fi
 
@@ -118,7 +118,7 @@
     -storetype "dks" -storepass storepass2 \
     -provider "org.test.dummy.DummyProvider" -providerPath ${TESTCLASSES}
 
-if [ $? -ne 0 ]; then 
+if [ $? -ne 0 ]; then
     exit 1
 fi
 
--- a/test/sun/security/tools/keytool/CloneKeyAskPassword.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/CloneKeyAskPassword.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -23,7 +23,7 @@
 
 # @test
 # @bug 6178366
-# @summary confirm that keytool correctly finds (and clones) a private key 
+# @summary confirm that keytool correctly finds (and clones) a private key
 #          when the user is prompted for the key's password.
 #
 # @run shell CloneKeyAskPassword.sh
@@ -55,6 +55,10 @@
     PATHSEP=":"
     FILESEP="/"
     ;;
+  Darwin )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
   CYGWIN* )
     PATHSEP=";"
     FILESEP="/"
@@ -75,11 +79,11 @@
 
 # run the test: attempt to clone the private key
 ${TESTJAVA}${FILESEP}bin${FILESEP}keytool \
-	-keyclone \
-	-alias mykey \
-	-dest myclone \
-	-keystore CloneKeyAskPassword.jks \
-	-storepass test123 <<EOF
+        -keyclone \
+        -alias mykey \
+        -dest myclone \
+        -keystore CloneKeyAskPassword.jks \
+        -storepass test123 <<EOF
 test456
 EOF
 
--- a/test/sun/security/tools/keytool/NoExtNPE.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/NoExtNPE.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -48,6 +48,9 @@
   Linux )
     FILESEP="/"
     ;;
+  Darwin )
+    FILESEP="/"
+    ;;
   CYGWIN* )
     FILESEP="/"
     ;;
@@ -61,8 +64,8 @@
 esac
 
 ${TESTJAVA}${FILESEP}bin${FILESEP}keytool \
-	-list -v \
-	-keystore ${TESTSRC}${FILESEP}CloneKeyAskPassword.jks \
-	-storepass test123
+        -list -v \
+        -keystore ${TESTSRC}${FILESEP}CloneKeyAskPassword.jks \
+        -storepass test123
 
 exit $?
--- a/test/sun/security/tools/keytool/SecretKeyKS.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/SecretKeyKS.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -24,7 +24,7 @@
 # @test
 # @bug 4694076
 # @summary KeyTool throws ArrayIndexOutOfBoundsException for listing
-# 	   SecretKey entries in non-verbose mode.
+#          SecretKey entries in non-verbose mode.
 # @author Valerie Peng
 #
 # @run shell SecretKeyKS.sh
@@ -45,7 +45,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
--- a/test/sun/security/tools/keytool/StandardAlgName.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/StandardAlgName.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -46,7 +46,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     PS=":"
     FS="/"
@@ -75,19 +75,19 @@
 ${TESTJAVA}${FS}bin${FS}keytool -genkey -v -alias pkcs12testCA -keyalg "RsA" -keysize 2048 -sigalg "ShA1wItHRSA" -dname "cn=PKCS12 Test CA, ou=Security SQE, o=JavaSoft, c=US" -validity 3650 -keypass storepass -keystore keystoreCA.jceks.data -storepass storepass -storetype jceKS 2>&1 | egrep 'RsA|ShA1wItHRSA'
 
 RESULT=$?
-if [ $RESULT -eq 0 ]; then 
+if [ $RESULT -eq 0 ]; then
     exit 1
 else
     #Lead
     ${TESTJAVA}${FS}bin${FS}keytool -genkey -v -alias pkcs12testLead -keyalg "rSA" -keysize 1024 -sigalg "mD5withRSA" -dname "cn=PKCS12 Test Lead, ou=Security SQE, o=JavaSoft, c=US" -validity 3650 -keypass storepass -keystore keystoreLead.jceks.data -storepass storepass -storetype jCeks 2>&1 | egrep 'rSA|mD5withRSA'
     RESULT=$?
-    if [ $RESULT -eq 0 ]; then 
+    if [ $RESULT -eq 0 ]; then
         exit 1
     else
         #End User 1
         ${TESTJAVA}${FS}bin${FS}keytool -genkey -v -alias pkcs12testEndUser1 -keyalg "RSa" -keysize 1024 -sigalg "sHa1wIThRSA" -dname "cn=PKCS12 Test End User 1, ou=Security SQE, o=JavaSoft, c=US" -validity 3650 -keypass storepass -keystore keystoreEndUser1.jceks.data -storepass storepass -storetype Jceks 2>&1 | egrep 'RSa|sHa1wIThRSA'
         RESULT=$?
-        if [ $RESULT -eq 0 ]; then 
+        if [ $RESULT -eq 0 ]; then
             exit 1
         else
             exit 0
--- a/test/sun/security/tools/keytool/printssl.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/printssl.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -37,7 +37,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     FS="/"
     ;;
   CYGWIN* )
--- a/test/sun/security/tools/keytool/resource.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/resource.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -43,7 +43,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     NULL=/dev/null
     FS="/"
     TMP=/tmp
@@ -68,7 +68,7 @@
 ${TESTJAVA}${FS}bin${FS}keytool > ${TMP}${FS}temp_file_40875602475 2> ${NULL}
 grep MissingResourceException ${TMP}${FS}temp_file_40875602475
 
-if [ $? -eq 0 ]; then 
+if [ $? -eq 0 ]; then
     rm ${TMP}${FS}temp_file_40875602475
     exit 1
 fi
--- a/test/sun/security/tools/keytool/standard.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/security/tools/keytool/standard.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -44,7 +44,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | CYGWIN* )
+  SunOS | Linux | Darwin | CYGWIN* )
     FS="/"
     ;;
   Windows_* )
--- a/test/sun/tools/jconsole/ImmutableResourceTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/tools/jconsole/ImmutableResourceTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -32,7 +32,7 @@
 
 #Call this from anywhere to fail the test with an error message
 # usage: fail "reason why the test failed"
-fail() 
+fail()
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
@@ -41,7 +41,7 @@
 
 #Call this from anywhere to pass the test with a message
 # usage: pass "reason why the test passed if applicable"
-pass() 
+pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
    exit 0
@@ -53,7 +53,7 @@
 
 OS=`uname -s`
 case "$OS" in
-   SunOS | Linux )
+   SunOS | Linux | Darwin )
       PATHSEP=":"
       ;;
 
@@ -80,7 +80,7 @@
    if [ -n "$1" ] ; then
           TESTJAVA=$1
       else
-	  TESTJAVA=$JAVA_HOME
+          TESTJAVA=$JAVA_HOME
    fi
    TESTSRC=.
    TESTCLASSES=.
--- a/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh	Mon Dec 19 18:15:06 2011 -0800
+++ b/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh	Thu Dec 22 11:05:51 2011 -0800
@@ -28,14 +28,14 @@
 #
 #   @run shell ImmutableResourceTest.sh
 #
-# 
+#
 
 # Beginning of subroutines:
 status=1
 
 #Call this from anywhere to fail the test with an error message
 # usage: fail "reason why the test failed"
-fail() 
+fail()
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
@@ -44,7 +44,7 @@
 
 #Call this from anywhere to pass the test with a message
 # usage: pass "reason why the test passed if applicable"
-pass() 
+pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
    exit 0
@@ -56,7 +56,7 @@
 
 OS=`uname -s`
 case "$OS" in
-   SunOS | Linux )
+   SunOS | Linux | Darwin )
       PATHSEP=":"
       ;;
 
@@ -83,7 +83,7 @@
    if [ -n "$1" ] ; then
           TESTJAVA=$1
       else
-	  TESTJAVA=$JAVA_HOME
+          TESTJAVA=$JAVA_HOME
    fi
    TESTSRC=.
    TESTCLASSES=.