diff --git a/com.oracle.truffle.r.test.packages/r/install.cache.R b/com.oracle.truffle.r.test.packages/r/install.cache.R index cab215a510a3ca5a05007bad5c47e5470d063ed4..834fb7b073f24e359c5c6d99df7c498fe175ffa5 100644 --- a/com.oracle.truffle.r.test.packages/r/install.cache.R +++ b/com.oracle.truffle.r.test.packages/r/install.cache.R @@ -21,6 +21,10 @@ # questions. # +is.fastr <- function() { + length(grep('FastR', R.Version()$version.string)) +} + # A simple log function; to be replaced by a user of this file. log.message <- function(..., level=0) { cat(..., "\n") @@ -255,7 +259,7 @@ recommended.base.packages <- c("boot", "class", "cluster", "codetools", "foreign base.packages <- c("base", "compiler", "datasets", "grDevices", "graphics", "grid", "methods", "parallel", "splines", "stats", "stats4", "tools", "utils") # the list of packages that will be excluded in the transitive dependecies -ignored.packages <- recommended.base.packages +ignored.packages <- if (is.fastr()) recommended.base.packages else base.packages package.dependencies <- function(pkg, lib, dependencies = c("Depends", "Imports", "LinkingTo"), pl = available.packages()) { if (!(pkg %in% rownames(pl))) { diff --git a/com.oracle.truffle.r.test.packages/r/install.packages.R b/com.oracle.truffle.r.test.packages/r/install.packages.R index ac41213d2f09d6117231ac521570215793b038e9..1aeeb63ee9fde081a8eb95e3f08a3f16cad02448 100644 --- a/com.oracle.truffle.r.test.packages/r/install.packages.R +++ b/com.oracle.truffle.r.test.packages/r/install.packages.R @@ -135,6 +135,8 @@ trim <- function (x) gsub("^\\s+|\\s+$", "", x) strip.version <- function(x) gsub("\\s*\\(.*\\)$", "", x) +initial.packages <- c("methods", "datasets", "utils", "grDevices", "graphics", "stats") + default.packages <- c("R", "base", "grid", "splines", "utils", "compiler", "grDevices", "methods", "stats", "stats4", "datasets", "graphics", "parallel", "tools", "tcltk") @@ -857,12 +859,16 @@ is.fastr <- function() { system.test <- function(pkgname) { script <- normalizePath("com.oracle.truffle.r.test.packages/r/test.package.R") + options <- character(0) if (is.fastr()) { rscript = file.path(R.home(), "bin", "Rscript") } else { - rscript = gnu_rscript() + # GnuR's Rscript command does not load the 'methods' package by default. + # But the examples are assumed to be run in a shell where the package is on the search path. + options <- paste0("--default-packages=", paste0(initial.packages, collapse=",")) + rscript = gnu_rscript() } - args <- c(script, pkgname, file.path(testdir, pkgname), lib.install) + args <- c(options, script, pkgname, file.path(testdir, pkgname), lib.install) # we want to stop tests that hang, but some packages have many tests # each of which spawns a sub-process (over which we have no control) # so we time out the entire set after 20 minutes.