Skip to content
Permalink
Browse files
8267184: Add -Djava.security.manager=allow to tests calling System.se…
…tSecurityManager

Co-authored-by: Lance Andersen <lancea@openjdk.org>
Co-authored-by: Weijun Wang <weijun@openjdk.org>
Reviewed-by: dholmes, alanb, dfuchs, mchung, mullan, prr
  • Loading branch information
wangweij and Lance Andersen committed May 24, 2021
1 parent f04db5f commit 640a2afda36857410b7abf398af81e35430a62e7
Showing 852 changed files with 1,019 additions and 776 deletions.
@@ -29,7 +29,7 @@
* @author Tom Rodriguez
*
* @modules java.rmi
* @run main compiler.exceptions.ExceptionInInit
* @run main/othervm -Djava.security.manager=allow compiler.exceptions.ExceptionInInit
*/

package compiler.exceptions;
@@ -36,14 +36,17 @@
* NO_SEC_MAN
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -XX:+EnableJVMCI
* -Djava.security.manager=allow
* compiler.jvmci.SecurityRestrictionsTest
* NO_PERM
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -XX:+EnableJVMCI
* -Djava.security.manager=allow
* compiler.jvmci.SecurityRestrictionsTest
* ALL_PERM
* @run main/othervm -XX:+UnlockExperimentalVMOptions
* -XX:+EnableJVMCI -XX:-UseJVMCICompiler
* -Djava.security.manager=allow
* compiler.jvmci.SecurityRestrictionsTest
* NO_JVMCI_ACCESS_PERM
* @run main/othervm -XX:+UnlockExperimentalVMOptions
@@ -48,6 +48,7 @@ public static void main(String args[]) throws Exception {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-Xbootclasspath/a:.",
"-Djava.security.manager=allow",
Test.class.getName());
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("protection domain added");
@@ -40,6 +40,7 @@ public static void main(String... args) throws Exception {
// -Xlog:protectiondomain=trace
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",
"-Xmx128m",
"-Djava.security.manager=allow",
Hello.class.getName(), "security_manager");
new OutputAnalyzer(pb.start())
.shouldHaveExitValue(0)
@@ -49,6 +50,7 @@ public static void main(String... args) throws Exception {
// -Xlog:protectiondomain=debug
pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
"-Xmx128m",
"-Djava.security.manager=allow",
Hello.class.getName(), "security_manager");
new OutputAnalyzer(pb.start())
.shouldHaveExitValue(0)
@@ -31,6 +31,6 @@
*
* @library /vmTestbase
* /test/lib
* @run main/othervm -Xlog:gc=debug:gc.log gc.ArrayJuggle.Juggle01.Juggle01 -gp charArr -ms medium
* @run main/othervm -Xlog:gc=debug:gc.log -Djava.security.manager=allow gc.ArrayJuggle.Juggle01.Juggle01 -gp charArr -ms medium
*/

@@ -35,7 +35,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.CatalogReferCircularityTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.CatalogReferCircularityTest
* @run testng/othervm catalog.CatalogReferCircularityTest
* @summary Via nextCatalog entry, the catalog reference chain may be
* a (partial) closed circuit. For instance, a catalog may use itself
@@ -36,7 +36,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.DefaultFeaturesTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DefaultFeaturesTest
* @run testng/othervm catalog.DefaultFeaturesTest
* @summary This case tests if the default feature values are expected.
*/
@@ -48,7 +48,7 @@
* @bug 8077931 8176405
* @library /javax/xml/jaxp/libs
* @modules java.xml/javax.xml.catalog:open
* @run testng/othervm -DrunSecMngr=true catalog.DeferFeatureTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DeferFeatureTest
* @run testng/othervm catalog.DeferFeatureTest
* @summary This case tests whether the catalogs specified in delegateSystem,
* delegatePublic, delegateURI and nextCatalog entries are used lazily
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.DelegatePublicTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DelegatePublicTest
* @run testng/othervm catalog.DelegatePublicTest
* @summary Get matched URIs from DelegatePublic entries.
*/
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.DelegateSystemTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DelegateSystemTest
* @run testng/othervm catalog.DelegateSystemTest
* @summary Get matched URIs from delegateSystem entries.
*/
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.DelegateUriTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.DelegateUriTest
* @run testng/othervm catalog.DelegateUriTest
* @summary Get matched URIs from delegateURI entries.
*/
@@ -39,7 +39,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.GroupTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.GroupTest
* @run testng/othervm catalog.GroupTest
* @summary Get matched URIs from system, public and uri entries respectively,
* and some of the entries are enclosed by group entries.
@@ -42,7 +42,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.LoadCatalogTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.LoadCatalogTest
* @run testng/othervm catalog.LoadCatalogTest
* @summary When catalog resolver loads catalog files, the current catalog file
* and the catalog files specified by the nextCatalog entries may not
@@ -39,7 +39,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.NextCatalogTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.NextCatalogTest
* @run testng/othervm catalog.NextCatalogTest
* @summary Get matched URIs from system, public and uri entries respectively,
* but some of the entries are defined in none-current catalog files.
@@ -39,7 +39,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.NormalizationTest
* @run testng/othervm catalog.NormalizationTest
* @summary Before matching identifiers and URI references, it has to normalize
* the passed identifiers and URI references. And then the catalog
@@ -40,7 +40,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.PreferFeatureTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PreferFeatureTest
* @run testng/othervm catalog.PreferFeatureTest
* @summary This case tests how does the feature affect the catalog resolution,
* and tests the priority between this feature and attribute prefer
@@ -36,7 +36,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.PreferTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PreferTest
* @run testng/othervm catalog.PreferTest
* @summary Get matched URIs from system and public family entries, which
* specify the prefer attribute. It tests how does the prefer attribute
@@ -37,7 +37,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.PublicFamilyTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PublicFamilyTest
* @run testng/othervm catalog.PublicFamilyTest
* @summary Get matched URIs from public and delegatePublic entries.
* It tests the resolution priorities among the public family entries.
@@ -39,7 +39,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.PublicTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.PublicTest
* @run testng/othervm catalog.PublicTest
* @summary Get matched URIs from public entries.
*/
@@ -46,7 +46,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.ResolveFeatureTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.ResolveFeatureTest
* @run testng/othervm catalog.ResolveFeatureTest
* @summary This case tests how does resolve feature affect the catalog
* resolution.
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.RewriteSystemTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.RewriteSystemTest
* @run testng/othervm catalog.RewriteSystemTest
* @summary Get matched URIs from rewriteSystem entries.
*/
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.RewriteUriTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.RewriteUriTest
* @run testng/othervm catalog.RewriteUriTest
* @summary Get matched URIs from rewriteURI entries.
*/
@@ -44,7 +44,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.SpecifyCatalogTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SpecifyCatalogTest
* @run testng/othervm catalog.SpecifyCatalogTest
* @summary This case tests how to specify the catalog files.
*/
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.SystemFamilyTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SystemFamilyTest
* @run testng/othervm catalog.SystemFamilyTest
* @summary Get matched URIs from system, rewriteSystem, systemSuffix and
* delegateSystem entries. It tests the resolution priorities among
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.SystemSuffixTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SystemSuffixTest
* @run testng/othervm catalog.SystemSuffixTest
* @summary Get matched URIs from systemSuffix entries.
*/
@@ -39,7 +39,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.SystemTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.SystemTest
* @run testng/othervm catalog.SystemTest
* @summary Get matched URIs from system entries.
*/
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.UriFamilyTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UriFamilyTest
* @run testng/othervm catalog.UriFamilyTest
* @summary Get matched URIs from uri, rewriteURI, uriSuffix and delegateURI
* entries. It tests the resolution priorities among the uri family
@@ -38,7 +38,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.UriSuffixTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UriSuffixTest
* @run testng/othervm catalog.UriSuffixTest
* @summary Get matched URIs from rewriteURI entries.
*/
@@ -41,7 +41,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.UriTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UriTest
* @run testng/othervm catalog.UriTest
* @summary Get matched URIs from uri entries.
*/
@@ -36,7 +36,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.UrnUnwrappingTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.UrnUnwrappingTest
* @run testng/othervm catalog.UrnUnwrappingTest
* @summary If the passed public identifier is started with "urn:publicid:",
* it has to be regarded as URN and normalized. And then the catalog
@@ -39,7 +39,7 @@
* @test
* @bug 8077931
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true catalog.ValidateCatalogTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow catalog.ValidateCatalogTest
* @run testng/othervm catalog.ValidateCatalogTest
* @summary A legal catalog file must be well-formed XML, the root element
* must be catalog, and the naming space of the root element must be
@@ -53,7 +53,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.DurationTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.datatype.ptests.DurationTest
* @run testng/othervm javax.xml.datatype.ptests.DurationTest
* @summary Class containing the test cases for Duration.
*/
@@ -42,7 +42,7 @@
* @test
* @bug 8169778
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.FactoryNewInstanceTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.datatype.ptests.FactoryNewInstanceTest
* @run testng/othervm javax.xml.datatype.ptests.FactoryNewInstanceTest
* @summary Tests for DatatypeFactory.newInstance(factoryClassName , classLoader)
*/
@@ -49,7 +49,7 @@
* @test
* @bug 5049592 5041845 5048932 5064587 5040542 5049531 5049528
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.XMLGregorianCalendarTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.datatype.ptests.XMLGregorianCalendarTest
* @run testng/othervm javax.xml.datatype.ptests.XMLGregorianCalendarTest
* @summary Class containing the test cases for XMLGregorianCalendar
*/
@@ -48,7 +48,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DBFNamespaceTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.DBFNamespaceTest
* @run testng/othervm javax.xml.parsers.ptests.DBFNamespaceTest
*/
@Listeners({jaxp.library.FilePolicy.class})
@@ -74,7 +74,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderFactoryTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.DocumentBuilderFactoryTest
* @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderFactoryTest
*/
@Listeners({jaxp.library.FilePolicy.class})
@@ -48,7 +48,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderImpl01
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.DocumentBuilderImpl01
* @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderImpl01
*/
@Listeners({jaxp.library.FilePolicy.class})
@@ -42,7 +42,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.FactoryConfErrorTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.FactoryConfErrorTest
* @run testng/othervm javax.xml.parsers.ptests.FactoryConfErrorTest
*/
@Listeners({jaxp.library.BasePolicy.class})
@@ -40,7 +40,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
* @run testng/othervm javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
* @summary Tests for SAXParserFactory.newInstance(factoryClassName , classLoader)
*/
@@ -40,7 +40,7 @@
* @test
* @bug 8169778
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserFactTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserFactTest
* @run testng/othervm javax.xml.parsers.ptests.SAXParserFactTest
*/
@Listeners({jaxp.library.BasePolicy.class})
@@ -48,7 +48,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserTest
* @run testng/othervm javax.xml.parsers.ptests.SAXParserTest
*/
@Listeners({jaxp.library.FilePolicy.class})
@@ -45,7 +45,7 @@
/*
* @test
* @library /javax/xml/jaxp/libs
* @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest02
* @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow javax.xml.parsers.ptests.SAXParserTest02
* @run testng/othervm javax.xml.parsers.ptests.SAXParserTest02
*/
@Listeners({jaxp.library.BasePolicy.class})

1 comment on commit 640a2af

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 640a2af May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.