8043443: Test framework changes to run script tests without security manager

Tue, 20 May 2014 08:32:09 +0530

author
sundar
date
Tue, 20 May 2014 08:32:09 +0530
changeset 855
ffdb43036807
parent 852
bb2d11667547
child 856
3384c8f804a8

8043443: Test framework changes to run script tests without security manager
Reviewed-by: attila

make/build.xml file | annotate | diff | comparison | revisions
make/project.properties file | annotate | diff | comparison | revisions
test/script/nosecurity/nosecurity.js file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Wed May 14 11:02:04 2014 -0700
     1.2 +++ b/make/build.xml	Tue May 20 08:32:09 2014 +0530
     1.3 @@ -348,6 +348,10 @@
     1.4        <include name="**/framework/*Test.class"/>
     1.5      </fileset>
     1.6  
     1.7 +    <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
     1.8 +      <include name="**/framework/ScriptTest.class"/>
     1.9 +    </fileset>
    1.10 +
    1.11      <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
    1.12         verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
    1.13        <jvmarg line="${ext.class.path}"/>
    1.14 @@ -361,6 +365,21 @@
    1.15            <pathelement path="${run.test.classpath}"/>
    1.16        </classpath>
    1.17      </testng>
    1.18 +    <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes"
    1.19 +       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
    1.20 +      <jvmarg line="${ext.class.path}"/>
    1.21 +      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
    1.22 +      <propertyset>
    1.23 +        <propertyref prefix="nashorn."/>
    1.24 +      </propertyset>
    1.25 +      <propertyset>
    1.26 +        <propertyref prefix="test-sys-prop-no-security."/>
    1.27 +        <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
    1.28 +      </propertyset>
    1.29 +      <classpath>
    1.30 +          <pathelement path="${run.test.classpath}"/>
    1.31 +      </classpath>
    1.32 +    </testng>
    1.33    </target>
    1.34  
    1.35    <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file">
     2.1 --- a/make/project.properties	Wed May 14 11:02:04 2014 -0700
     2.2 +++ b/make/project.properties	Tue May 20 08:32:09 2014 +0530
     2.3 @@ -59,6 +59,7 @@
     2.4  
     2.5  # test results directory
     2.6  build.test.results.dir=${build.dir}/test/reports
     2.7 +build.nosecurity.test.results.dir=${build.dir}/test/nosecurity/reports
     2.8  
     2.9  # This directory is removed when the project is cleaned:
    2.10  dist.dir=dist
    2.11 @@ -110,6 +111,7 @@
    2.12  
    2.13  # test scripts to run
    2.14  test.dir=test
    2.15 +test.nosecurity.dir=test/script/nosecurity
    2.16  test.script.dir=test/script
    2.17  test.basic.dir=test/script/basic
    2.18  test.maptests.dir=test/script/maptests
    2.19 @@ -127,8 +129,12 @@
    2.20  test-sys-prop.es5conform.testcases.dir=${test.external.dir}/ES5Conform/TestCases
    2.21  test-sys-prop.test.basic.dir=${test.basic.dir}
    2.22  
    2.23 +test-sys-prop-no-security.test.dir=${test.dir}
    2.24 +test-sys-prop-no-security.test.js.roots=${test.nosecurity.dir}
    2.25 +
    2.26  # framework root for our script tests
    2.27  test-sys-prop.test.js.framework=${test.script.dir}/assert.js
    2.28 +test-sys-prop-no-security.test.js.framework=${test.script.dir}/assert.js
    2.29  
    2.30  # Control the verbosity of ParserTest
    2.31  test-sys-prop.parsertest.verbose=false
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/script/nosecurity/nosecurity.js	Tue May 20 08:32:09 2014 +0530
     3.3 @@ -0,0 +1,34 @@
     3.4 +/*
     3.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + * 
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + * 
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + * 
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + * 
    3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 + * or visit www.oracle.com if you need additional information or have any
    3.24 + * questions.
    3.25 + */
    3.26 +
    3.27 +/**
    3.28 + * 8043443: Test framework changes to run script tests without security manager 
    3.29 + * @test
    3.30 + * @run
    3.31 + */
    3.32 +
    3.33 +var System = Java.type("java.lang.System");
    3.34 +
    3.35 +if (System.securityManager != null) {
    3.36 +    fail("SecurityManager is set!");
    3.37 +}

mercurial