changeset 22024:216e0683bbf1

made SLInstrumentTestRunner (maybe) find test classes when Truffle is not the primary suite
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Jul 2015 16:06:31 +0200
parents fee42ec8c59b
children 854e52a0869c
files truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java	Tue Jul 21 15:56:56 2015 +0200
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java	Tue Jul 21 16:06:31 2015 +0200
@@ -144,7 +144,7 @@
         return foundCases;
     }
 
-    private static Path getRootViaResourceURL(final Class<?> c, String[] paths) {
+    public static Path getRootViaResourceURL(final Class<?> c, String[] paths) {
         URL url = c.getResource(c.getSimpleName() + ".class");
         if (url != null) {
             String externalForm = url.toExternalForm();
@@ -153,7 +153,6 @@
                 String suffix = sep + "bin" + sep + c.getName().replace('.', sep) + ".class";
                 if (externalForm.endsWith(suffix)) {
                     String base = externalForm.substring("file:".length(), externalForm.length() - suffix.length());
-                    System.out.println(base);
                     for (String path : paths) {
                         String candidate = base + sep + path;
                         if (new File(candidate).exists()) {
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java	Tue Jul 21 15:56:56 2015 +0200
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java	Tue Jul 21 16:06:31 2015 +0200
@@ -44,6 +44,7 @@
 import com.oracle.truffle.sl.nodes.local.*;
 import com.oracle.truffle.sl.parser.*;
 import com.oracle.truffle.sl.runtime.*;
+import com.oracle.truffle.sl.test.*;
 import com.oracle.truffle.sl.test.instrument.SLInstrumentTestRunner.InstrumentTestCase;
 
 /**
@@ -138,11 +139,13 @@
 
         String[] paths = suite.value();
 
-        Path root = null;
-        for (String path : paths) {
-            root = FileSystems.getDefault().getPath(path);
-            if (Files.exists(root)) {
-                break;
+        Path root = SLTestRunner.getRootViaResourceURL(c, paths);
+        if (root == null) {
+            for (String path : paths) {
+                root = FileSystems.getDefault().getPath(path);
+                if (Files.exists(root)) {
+                    break;
+                }
             }
         }
         if (root == null && paths.length > 0) {