8142857: Enable all nashorn "api" tests for jtreg test run
authorsundar
Thu, 12 Nov 2015 19:51:43 +0530
changeset 33694 a48295df8eb9
parent 33693 cc0617a78522
child 33695 f3f1bd0f638e
8142857: Enable all nashorn "api" tests for jtreg test run Reviewed-by: attila, hannesw, mhaupt
nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java
nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java
nashorn/test/src/jdk/nashorn/api/scripting/test/JSONCompatibleTest.java
nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java
nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java
nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java
nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -40,6 +40,10 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+/**
+ * @test
+ * @run testng/othervm jdk.nashorn.api.javaaccess.test.ArrayConversionTest
+ */
 @SuppressWarnings("javadoc")
 public class ArrayConversionTest {
     private static ScriptEngine e = null;
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -39,6 +39,10 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+/**
+ * @test
+ * @run testng jdk.nashorn.api.javaaccess.test.ConsStringTest
+ */
 @SuppressWarnings("javadoc")
 public class ConsStringTest {
     private static ScriptEngine e = null;
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -40,6 +40,10 @@
 
 /**
  * Tests for javax.script.Invocable implementation of nashorn.
+ *
+ * @test
+ * @build jdk.nashorn.api.scripting.test.VariableArityTestInterface jdk.nashorn.api.scripting.test.InvocableTest
+ * @run testng jdk.nashorn.api.scripting.test.InvocableTest
  */
 @SuppressWarnings("javadoc")
 public class InvocableTest {
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/JSONCompatibleTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/JSONCompatibleTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -39,6 +39,10 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+/**
+ * @test
+ * @run testng jdk.nashorn.api.scripting.test.JSONCompatibleTest
+ */
 public class JSONCompatibleTest {
 
     /**
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -47,6 +47,9 @@
  *
  * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external
  * JSObject implementations.
+ *
+ * @test
+ * @run testng jdk.nashorn.api.scripting.test.PluggableJSObjectTest
  */
 @SuppressWarnings("javadoc")
 public class PluggableJSObjectTest {
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -38,6 +38,9 @@
 
 /**
  * jsr223 tests for security access checks.
+ *
+ * @test
+ * @run testng/othervm jdk.nashorn.api.scripting.test.ScriptEngineSecurityTest
  */
 @SuppressWarnings("javadoc")
 public class ScriptEngineSecurityTest {
@@ -244,7 +247,7 @@
         final ScriptEngineManager m = new ScriptEngineManager();
         final ScriptEngine e = m.getEngineByName("nashorn");
         final Runnable r = (Runnable)Proxy.newProxyInstance(
-            ScriptEngineTest.class.getClassLoader(),
+            ScriptEngineSecurityTest.class.getClassLoader(),
             new Class[] { Runnable.class },
             new InvocationHandler() {
                 @Override
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -47,6 +47,9 @@
 
 /**
  * Tests to check jdk.nashorn.api.scripting.ScriptObjectMirror API.
+ *
+ * @test
+ * @run testng jdk.nashorn.api.scripting.test.ScriptObjectMirrorTest
  */
 @SuppressWarnings("javadoc")
 public class ScriptObjectMirrorTest {
--- a/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java	Thu Nov 12 12:30:15 2015 +0530
+++ b/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java	Thu Nov 12 19:51:43 2015 +0530
@@ -37,17 +37,38 @@
 
 /**
  * Test for nashorn Parser API (jdk.nashorn.api.tree.*)
+ *
+ * @test
+ * @run testng jdk.nashorn.api.tree.test.ParseAPITest
  */
 public class ParseAPITest {
 
     private static final boolean VERBOSE   = Boolean.valueOf(System.getProperty("parserapitest.verbose"));
     private static final boolean TEST262   = Boolean.valueOf(System.getProperty("parserapitest.test262"));
 
-    private static final String TEST_BASIC_DIR     = System.getProperty("test.basic.dir");
-    private static final String TEST_MAPTESTS_DIR  = System.getProperty("test.maptests.dir");
-    private static final String TEST_SANDBOX_DIR   = System.getProperty("test.sandbox.dir");
-    private static final String TEST_TRUSTED_DIR   = System.getProperty("test.trusted.dir");
-    private static final String TEST262_SUITE_DIR  = System.getProperty("test262.suite.dir");
+    private static final String TEST_BASIC_DIR;
+    private static final String TEST_MAPTESTS_DIR;
+    private static final String TEST_SANDBOX_DIR;
+    private static final String TEST_TRUSTED_DIR;
+    private static final String TEST262_SUITE_DIR;
+
+    static {
+        String testSrc = System.getProperty("test.src");
+        if (testSrc != null) {
+            String testScriptDir = testSrc + "/../../../../../../script/";
+            TEST_BASIC_DIR    = testScriptDir + "basic";
+            TEST_MAPTESTS_DIR = testScriptDir + "maptests";
+            TEST_SANDBOX_DIR  = testScriptDir + "sandbox";
+            TEST_TRUSTED_DIR  = testScriptDir + "trusted";
+            TEST262_SUITE_DIR = testScriptDir + "external/test262/test/suite";
+        } else {
+            TEST_BASIC_DIR     = System.getProperty("test.basic.dir");
+            TEST_MAPTESTS_DIR  = System.getProperty("test.maptests.dir");
+            TEST_SANDBOX_DIR   = System.getProperty("test.sandbox.dir");
+            TEST_TRUSTED_DIR   = System.getProperty("test.trusted.dir");
+            TEST262_SUITE_DIR  = System.getProperty("test262.suite.dir");
+        }
+    }
 
     interface TestFilter {
         public boolean exclude(File file, String content);