diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java index cc63af538efe11861c189cf3399bd85babd03ae4..3b9c62f6dd6b6495a7f8b8d086e4c1a9cee5834e 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java @@ -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); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java index 781156ff27b2b2ae3d7d66fc72940b0d0c19f42a..779e8d50a454eee3026b77338317e83f90437505 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java @@ -1,5 +1,5 @@ /* - * 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() { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java index a89de0a6a441b21f95d635cf3b382fd036c44e00..8d04aedae7d37393be8bb78353d4cf15002c0aa6 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java @@ -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); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java index cbc3b17563ffd31b4c45dc886852c5b05d273ad0..915b2eac40729d7436a7e7d1eb2c80162201b93e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java @@ -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) { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/rpackages/TestRPackages.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/rpackages/TestRPackages.java index c2d69dba114f009e9c7ea096d4c1c68cacfb888c..fbac0b3aa650ad25b002676895715b25e9db219b 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/rpackages/TestRPackages.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/rpackages/TestRPackages.java @@ -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; } } diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 5ba8da1466df35aa04225d9f50528b6969f6ed90..1d08d05febcb302ba6a5893793dc42f3ebb01c10 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -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"},