Skip to content

Commit bed01e3

Browse files
committed
Improve 'ignore suggests' configuration for pkgtest
1 parent 3d4fe51 commit bed01e3

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

com.oracle.truffle.r.test.packages/r/install.packages.R

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@ default.packages <- c("R", "base", "grid", "splines", "utils",
149149
# manually maintained list of packages that are OK to ignore when installing "suggests"
150150
# the name is that package and the values are regexps of suggests that can be ignored for that package
151151
# if this configuration gets too complex or updated too often, we can move it to separate config file
152+
ignore.all.but <- function(...) structure(as.vector(list(...)), class='negation')
152153
ignore.suggests <- list(
153-
rstudioapi = c('*'), # rstudioapi executes almost no real tests, it is mostly just test of install & load
154-
glmnet = c('knitr'), # probably used for vignettes only
155-
PerformanceAnalytics = c('dygraphs', 'Hmisc', 'MASS', 'quantmod', 'gamlss', 'gamlss.dist', 'robustbase', 'quantreg', 'gplots'), # TODO: to be verified
156-
quantmod = c('*') # probably not necessary, the tests output does not contain any 'library', 'require' or 'load' calls
154+
rstudioapi = '*', # rstudioapi executes almost no real tests, it is mostly just test of install & load
155+
glmnet = 'knitr', # probably used for vignettes only
156+
PerformanceAnalytics = ignore.all.but('testthat'), # not gated yet. We can run almost all tests except for few examples that use some suggests including data.table
157+
quantmod = '*' # probably not necessary, the tests output does not contain any 'library', 'require' or 'load' calls
157158
)
158159

159160
choice.depends <- function(pkg, choice=c("direct","suggests")) {
@@ -397,7 +398,7 @@ equal.fastr.error.log.sizes <- function(older, newer) {
397398
# An error log file has been removed or the file list did not change.
398399
# Compare sizes of the files.
399400
all(older[names(newer)] == newer)
400-
}
401+
}
401402
}
402403

403404
installed.ok <- function(pkgname, initial_error_log_size) {
@@ -412,7 +413,7 @@ installed.ok <- function(pkgname, initial_error_log_size) {
412413
if (file.exists(get.pkgdir(paste0("00LOCK-", pkgname)))) {
413414
return(FALSE)
414415
}
415-
416+
416417
if (!equal.fastr.error.log.sizes(initial_error_log_size, fastr.errors.log.sizes())) {
417418
# This is a really nasty case where the error happens during
418419
# the test load step. It is not detected by the package
@@ -643,10 +644,13 @@ install.pkgs <- function(pkgnames, dependents.install=F, log=T) {
643644
install.suggests <- function(pkgnames) {
644645
for (pkgname in pkgnames) {
645646
suggests <- install.order(avail.pkgs, avail.pkgs[pkgname, ], "suggests")
646-
ignore.pattern <- ignore.suggests[pkgname]
647+
ignore.pattern <- ignore.suggests[[pkgname]]
647648
if (!is.null(ignore.pattern)) {
648-
ignore <- suggests[grepl(ignore.pattern, suggests)]
649-
suggests <- setdiff(suggests, ignore)
649+
ignore <- character(0)
650+
for (i in seq_along(ignore.pattern)) {
651+
ignore <- c(ignore, suggests[grepl(ignore.pattern[[i]], suggests)])
652+
}
653+
suggests <- if (class(ignore.pattern) == 'negation') ignore else setdiff(suggests, ignore)
650654
cat("NOTE: ignoring suggested:", paste(ignore, collapse=','), '\n')
651655
}
652656
if (length(suggests) > 0) {
@@ -808,7 +812,7 @@ install.pkg <- function(pkgname) {
808812
if (rc == 0L) {
809813
# be paranoid and also check file system and log
810814
success <- installed.ok(pkgname, error_log_size)
811-
}
815+
}
812816
log.message(paste0("installation succeeded for ", pkgname, ": ", success), level=1)
813817
names(success) <- pkgname
814818
install.status <<- append(install.status, success)
@@ -1199,4 +1203,3 @@ important.pkg.table <- NULL
11991203
if (!interactive()) {
12001204
run()
12011205
}
1202-

0 commit comments

Comments
 (0)