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

Merge pull request #680 in G/fastr from...

Merge pull request #680 in G/fastr from ~LUKAS.STADLER_ORACLE.COM/fastr:feature/update_truffle to master

* commit '27ce8836':
  update Truffle version
parents b0aaf3da 27ce8836
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);
......
......@@ -116,7 +116,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);
}
}
......
......@@ -183,17 +183,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 {
......@@ -212,7 +201,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) {
......@@ -252,7 +241,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