Skip to content
Snippets Groups Projects
Commit 27ce8836 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

update Truffle version

parent 6589fe41
No related branches found
No related tags found
No related merge requests found
......@@ -61,13 +61,12 @@ class DefaultArgsExtractor {
HashMap<String, Samples<?>> samplesMap = new HashMap<>();
try {
Source source = RSource.fromTextInternal("formals(" + functionName + ")",
RSource.Internal.UNIT_TEST);
Source source = RSource.fromTextInternal("formals(" + functionName + ")", RSource.Internal.UNIT_TEST);
Value defArgVal = vm.eval(source);
if (defArgVal.get() instanceof RPairList) {
RPairList formals = (RPairList) defArgVal.get();
try {
RPairList formals = defArgVal.as(RPairList.class);
RStringVector names = formals.getNames();
for (int i = 0; i < names.getLength(); i++) {
......@@ -77,8 +76,7 @@ class DefaultArgsExtractor {
if (defVal instanceof RLanguage) {
String deparsedDefVal = RDeparse.deparse(defVal);
try {
Value eval = vm.eval(RSource.fromTextInternal(deparsedDefVal,
RSource.Internal.UNIT_TEST));
Value eval = vm.eval(RSource.fromTextInternal(deparsedDefVal, RSource.Internal.UNIT_TEST));
defVal = eval.get();
} catch (Throwable t) {
printer.accept("Warning: Unable to evaluate the default value of argument " + name + ". Expression: " + deparsedDefVal);
......@@ -107,6 +105,8 @@ class DefaultArgsExtractor {
samplesMap.put(name, Samples.anything(defVal));
}
}
} catch (ClassCastException e) {
// no pairlist...
}
} catch (Throwable t) {
printer.accept("Warning: Unable to evaluate formal arguments of function " + functionName);
......
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -99,7 +99,7 @@ public final class ContextInfo implements TruffleObject {
}
public static ContextInfo getContextInfo(PolyglotEngine vm) {
return (ContextInfo) vm.findGlobalSymbol(ContextInfo.GLOBAL_SYMBOL).get();
return vm.findGlobalSymbol(ContextInfo.GLOBAL_SYMBOL).as(ContextInfo.class);
}
public RStartParams getStartParams() {
......
......@@ -889,11 +889,11 @@ public class TestBase {
* we go via the {@code system2} R function (which may call {@link ProcessBuilder} internally).
*
*/
protected static Object evalInstallPackage(String system2Command) throws Throwable {
protected static String evalInstallPackage(String system2Command) throws Throwable {
if (generatingExpected()) {
return expectedOutputManager.getRSession().eval(null, system2Command, null, true);
} else {
return fastROutputManager.fastRSession.evalAsObject(null, system2Command, null, true);
return fastROutputManager.fastRSession.eval(null, system2Command, null, true);
}
}
......
......@@ -182,17 +182,6 @@ public final class FastRSession implements RSession {
@Override
public String eval(TestBase testClass, String expression, ContextInfo contextInfo, boolean longTimeout) throws Throwable {
evalAsObject(testClass, expression, contextInfo, longTimeout);
return consoleHandler.buffer.toString();
}
/**
* Returns the actual object from evaluating expression. Used (and result ignored) by
* {@link #eval} but also used for package installation via the {@code system2} command, where
* the result is used to check whether the installation succeeded.
*/
public Object evalAsObject(TestBase testClass, String expression, ContextInfo contextInfo, boolean longTimeout) throws Throwable {
Object result = null;
Timer timer = null;
consoleHandler.reset();
try {
......@@ -211,7 +200,7 @@ public final class FastRSession implements RSession {
Source source = RSource.fromTextInternal(input, RSource.Internal.UNIT_TEST);
try {
try {
result = vm.eval(source).get();
vm.eval(source);
// checked exceptions are wrapped in RuntimeExceptions
} catch (RuntimeException e) {
if (e.getCause() instanceof com.oracle.truffle.api.vm.IncompleteSourceException) {
......@@ -249,7 +238,7 @@ public final class FastRSession implements RSession {
timer.cancel();
}
}
return result;
return consoleHandler.buffer.toString();
}
private static Timer scheduleTimeBoxing(PolyglotEngine engine, long timeout) {
......
......@@ -31,7 +31,6 @@ import org.junit.Assert;
import com.oracle.truffle.r.runtime.REnvVars;
import com.oracle.truffle.r.runtime.RVersionNumber;
import com.oracle.truffle.r.runtime.data.RStringVector;
import com.oracle.truffle.r.test.TestBase;
/**
......@@ -140,26 +139,14 @@ public abstract class TestRPackages extends TestBase {
}
cmd = binBase.resolve("bin").resolve("R").toString();
try {
Object result = evalInstallPackage(String.format(SYSTEM2_COMMAND, cmd, packagePath.path.toString(), installDir().toString()));
boolean success;
if (generatingExpected()) {
String stringResult = (String) result;
success = stringResult.contains("* DONE (");
if (!success) {
System.out.println(stringResult);
}
} else {
RStringVector vecResult = (RStringVector) result;
success = vecResult.getAttr("status") == null;
if (!success) {
String[] output = vecResult.getDataWithoutCopying();
for (String line : output) {
System.out.println(line);
}
}
String result = evalInstallPackage(String.format(SYSTEM2_COMMAND, cmd, packagePath.path.toString(), installDir().toString()));
boolean success = result.contains("* DONE (");
if (!success) {
System.out.println(result);
}
return success;
} catch (Throwable t) {
t.printStackTrace();
return false;
}
}
......
......@@ -28,7 +28,7 @@ suite = {
"suites" : [
{
"name" : "truffle",
"version" : "16e66aa3231ee95b9dfe2f0cc8a32cfb63d86025",
"version" : "54e4d48faa085ae1fb1bbcdb4733acfd523a5fd0",
"urls" : [
{"url" : "https://github.com/graalvm/truffle", "kind" : "git"},
{"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment