8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
authoramjiang
Thu, 14 Apr 2016 09:45:37 +0800
changeset 37353 e8e684b89c81
parent 37352 a9b326858ae3
child 37354 2cc8c7bd70ee
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux Reviewed-by: vinnie, weijun
jdk/test/ProblemList.txt
jdk/test/sun/security/pkcs11/KeyStore/Basic.java
jdk/test/sun/security/pkcs11/KeyStore/Basic.policy
jdk/test/sun/security/pkcs11/KeyStore/Basic.sh
jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh
jdk/test/sun/security/pkcs11/PKCS11Test.java
jdk/test/sun/security/pkcs11/Provider/Login.java
jdk/test/sun/security/pkcs11/Provider/Login.policy
jdk/test/sun/security/pkcs11/Provider/Login.sh
--- a/jdk/test/ProblemList.txt	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/ProblemList.txt	Thu Apr 14 09:45:37 2016 +0800
@@ -234,7 +234,7 @@
 sun/security/pkcs11/MessageDigest/ReinitDigest.java             8077138,8023434 windows-all
 sun/security/pkcs11/MessageDigest/TestCloning.java              8077138,8023434 windows-all
 sun/security/pkcs11/Provider/ConfigQuotedString.sh              8077138,8023434 windows-all
-sun/security/pkcs11/Provider/Login.sh                           8077138,8023434,8153545 windows-all,linux-all
+sun/security/pkcs11/Provider/Login.sh                           8077138,8023434 windows-all
 sun/security/pkcs11/SampleTest.java                             8077138,8023434 windows-all
 sun/security/pkcs11/Secmod/AddPrivateKey.java                   8077138,8023434 windows-all
 sun/security/pkcs11/Secmod/AddTrustedCert.java                  8077138,8023434 windows-all
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.java	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.java	Thu Apr 14 09:45:37 2016 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,7 +103,7 @@
     }
 
     public static void main(String[] args) throws Exception {
-        main(new Basic());
+        main(new Basic(), args);
     }
 
     public void main(Provider p) throws Exception {
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy	Thu Apr 14 09:45:37 2016 +0800
@@ -7,6 +7,7 @@
     permission java.lang.RuntimePermission "loadLibrary.*";
     permission java.lang.RuntimePermission "accessClassInPackage.sun.*";
     permission java.lang.RuntimePermission "getProtectionDomain";
+    permission java.lang.RuntimePermission "setSecurityManager";
     permission java.security.SecurityPermission "putProviderProperty.*";
 
     permission java.io.FilePermission "<<ALL FILES>>", "read";
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.sh	Thu Apr 14 09:45:37 2016 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -187,10 +187,8 @@
 	-DTEST=${TEST} \
 	-Dtest.src=${TESTSRC} \
 	-Dtest.classes=${TESTCLASSES} \
-	-Djava.security.manager \
-	-Djava.security.policy=${TESTSRC}${FS}Basic.policy \
 	-Djava.security.debug=${DEBUG} \
-	Basic
+	Basic sm Basic.policy
 
 # save error status
 status=$?
--- a/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh	Thu Apr 14 09:45:37 2016 +0800
@@ -155,10 +155,8 @@
 	-DNO_DEIMOS=true \
 	-DTOKEN=solaris \
 	-DTEST=${TEST} \
-	-Djava.security.manager \
-	-Djava.security.policy=${TESTSRC}${FS}Basic.policy \
 	-Djava.security.debug=${DEBUG} \
-	Basic
+	Basic sm Basic.policy
 
 # clean up
 
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Thu Apr 14 09:45:37 2016 +0800
@@ -181,8 +181,13 @@
 
     public static void main(PKCS11Test test, String[] args) throws Exception {
         if (args != null) {
-            if (args.length > 0 && "sm".equals(args[0])) {
-                test.enableSM = true;
+            if (args.length > 0) {
+                if ("sm".equals(args[0])) {
+                    test.enableSM = true;
+                } else {
+                    throw new RuntimeException("Unknown Command, use 'sm' as "
+                            + "first arguemtn to enable security manager");
+                }
             }
             if (test.enableSM) {
                 System.setProperty("java.security.policy",
--- a/jdk/test/sun/security/pkcs11/Provider/Login.java	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.java	Thu Apr 14 09:45:37 2016 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
     private static char[] password;
 
     public static void main(String[] args) throws Exception {
-        main(new Login());
+        main(new Login(), args);
     }
 
     public void main(Provider p) throws Exception {
--- a/jdk/test/sun/security/pkcs11/Provider/Login.policy	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.policy	Thu Apr 14 09:45:37 2016 +0800
@@ -4,6 +4,7 @@
     permission java.lang.RuntimePermission "accessClassInPackage.apple.*";
     permission java.lang.RuntimePermission "accessClassInPackage.sun.*";
     permission java.lang.RuntimePermission "getProtectionDomain";
+    permission java.lang.RuntimePermission "setSecurityManager";
     permission java.security.SecurityPermission "putProviderProperty.*";
 
 
--- a/jdk/test/sun/security/pkcs11/Provider/Login.sh	Wed Apr 13 16:08:43 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.sh	Thu Apr 14 09:45:37 2016 +0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,10 +127,8 @@
         -DNO_DEIMOS=true \
         -Dtest.src=${TESTSRC} \
         -Dtest.classes=${TESTCLASSES} \
-        -Djava.security.manager \
-        -Djava.security.policy=${TESTSRC}${FS}Login.policy \
         -Djava.security.debug=${DEBUG} \
-        Login
+        Login sm Login.policy
 
 # save error status
 status=$?