failing test diagnostics
This commit is contained in:
@@ -4,7 +4,9 @@ import com.intellij.openapi.Disposable;
|
|||||||
import com.intellij.openapi.application.PathManager;
|
import com.intellij.openapi.application.PathManager;
|
||||||
import com.intellij.openapi.util.Disposer;
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
|
import com.intellij.util.Function;
|
||||||
import com.intellij.util.Processor;
|
import com.intellij.util.Processor;
|
||||||
import jet.modules.IModuleBuilder;
|
import jet.modules.IModuleBuilder;
|
||||||
import jet.modules.IModuleSetBuilder;
|
import jet.modules.IModuleSetBuilder;
|
||||||
@@ -40,7 +42,7 @@ public class CompileEnvironment {
|
|||||||
myEnvironment = new JetCoreEnvironment(myRootDisposable);
|
myEnvironment = new JetCoreEnvironment(myRootDisposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMyErrorStream(PrintStream errorStream) {
|
public void setErrorStream(PrintStream errorStream) {
|
||||||
myErrorStream = errorStream;
|
myErrorStream = errorStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +88,7 @@ public class CompileEnvironment {
|
|||||||
myEnvironment.addToClasspath(rtJarPath);
|
myEnvironment.addToClasspath(rtJarPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File findActiveRtJar() {
|
public static File findActiveRtJar(boolean failOnError) {
|
||||||
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
|
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
|
||||||
if (systemClassLoader instanceof URLClassLoader) {
|
if (systemClassLoader instanceof URLClassLoader) {
|
||||||
URLClassLoader loader = (URLClassLoader) systemClassLoader;
|
URLClassLoader loader = (URLClassLoader) systemClassLoader;
|
||||||
@@ -100,6 +102,17 @@ public class CompileEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (failOnError) {
|
||||||
|
throw new CompileEnvironmentException("Could not find rt.jar in system class loader: " + StringUtil.join(loader.getURLs(), new Function<URL, String>() {
|
||||||
|
@Override
|
||||||
|
public String fun(URL url) {
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
}, ", "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (failOnError) {
|
||||||
|
throw new CompileEnvironmentException("System class loader is not an URLClassLoader: " + systemClassLoader);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class KotlinCompiler {
|
|||||||
String javaHome = System.getenv("JAVA_HOME");
|
String javaHome = System.getenv("JAVA_HOME");
|
||||||
File rtJar;
|
File rtJar;
|
||||||
if (javaHome == null) {
|
if (javaHome == null) {
|
||||||
rtJar = CompileEnvironment.findActiveRtJar();
|
rtJar = CompileEnvironment.findActiveRtJar(false);
|
||||||
|
|
||||||
if(rtJar == null) {
|
if(rtJar == null) {
|
||||||
System.out.println("JAVA_HOME environment variable needs to be defined");
|
System.out.println("JAVA_HOME environment variable needs to be defined");
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import junit.framework.TestCase;
|
|||||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yole
|
* @author yole
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +26,8 @@ public class CompileEnvironmentTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testSmoke() {
|
public void testSmoke() {
|
||||||
environment.setJavaRuntime(CompileEnvironment.findActiveRtJar());
|
final File activeRtJar = CompileEnvironment.findActiveRtJar(true);
|
||||||
|
environment.setJavaRuntime(activeRtJar);
|
||||||
environment.initializeKotlinRuntime();
|
environment.initializeKotlinRuntime();
|
||||||
final String testDataDir = JetParsingTest.getTestDataDir() + "/compiler/smoke/";
|
final String testDataDir = JetParsingTest.getTestDataDir() + "/compiler/smoke/";
|
||||||
final IModuleSetBuilder setBuilder = environment.loadModuleScript(testDataDir + "Smoke.kts");
|
final IModuleSetBuilder setBuilder = environment.loadModuleScript(testDataDir + "Smoke.kts");
|
||||||
|
|||||||
Reference in New Issue
Block a user