From 3accc5a8d4537a3644750df08d5cf7a76bbc88d4 Mon Sep 17 00:00:00 2001 From: Henrik Bengtsson Date: Tue, 11 Feb 2025 00:06:05 -0800 Subject: [PATCH] TESTS: Cleanup --- DESCRIPTION | 2 +- tests/ClusterRegistry.R | 3 -- tests/cluster,worker-termination.R | 61 ++++++++++++++---------------- tests/cluster-missing-future-pkg.R | 7 +--- tests/cluster.R | 15 +++----- tests/demo.R | 2 +- tests/dotdotdot.R | 3 -- tests/future,labels.R | 3 -- tests/future,optsenvvars.R | 3 -- tests/futureAssign.R | 3 -- tests/futureAssign_OP.R | 3 -- tests/futureCall.R | 3 -- tests/globals,NSE.R | 3 -- tests/globals,S4methods.R | 17 +-------- tests/globals,formulas.R | 3 -- tests/globals,locals.R | 29 +------------- tests/globals,manual.R | 2 +- tests/globals,subassignment.R | 3 -- tests/globals,tricky.R | 3 -- tests/immediateCondition.R | 26 ++++++------- tests/incl/start,load-only.R | 3 +- tests/multicore.R | 4 +- tests/multisession.R | 5 +-- tests/nbrOfWorkers.R | 5 +-- tests/nested_futures,mc.cores.R | 7 +--- tests/nested_futures.R | 3 -- tests/relaying,split.R | 6 +-- tests/relaying.R | 6 +-- tests/rng.R | 3 -- 29 files changed, 68 insertions(+), 168 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5bb7bcf3..a1d268e8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: future -Version: 1.34.0-9120 +Version: 1.34.0-9121 Title: Unified Parallel and Distributed Processing in R for Everyone Imports: digest, diff --git a/tests/ClusterRegistry.R b/tests/ClusterRegistry.R index c54a1f51..64a23e94 100644 --- a/tests/ClusterRegistry.R +++ b/tests/ClusterRegistry.R @@ -4,9 +4,6 @@ message("*** ClusterRegistry() ... ") allCores <- 1:availCores -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (isWin32) allCores <- NULL - for (cores in allCores) { message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/cluster,worker-termination.R b/tests/cluster,worker-termination.R index 64e4185a..504aeb6c 100644 --- a/tests/cluster,worker-termination.R +++ b/tests/cluster,worker-termination.R @@ -10,15 +10,12 @@ Sys.setenv(TMPDIR = tempdir()) message("*** cluster() - terminating worker ...") -message("Library paths: ", paste(sQuote(.libPaths()), collapse = ", ")) +message("Library paths: ", commaq(.libPaths())) message("Package path: ", sQuote(system.file(package = "future"))) message("TMPDIR for parallel workers: ", sQuote(Sys.getenv("TMPDIR"))) types <- "PSOCK" -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (isWin32) types <- NULL - if (supportsMulticore()) types <- c(types, "FORK") pid <- Sys.getpid() @@ -32,36 +29,36 @@ for (type in types) { ## Crashing FORK:ed processes seems too harsh on R (< 3.3.0) if (type != "FORK" || getRversion() >= "3.3.0") { - message("*** cluster() - crashed worker ...") - - plan(cluster, workers = cl, .skip = FALSE) - x %<-% 42L - stopifnot(x == 42L) + message("*** cluster() - crashed worker ...") + + plan(cluster, workers = cl, .skip = FALSE) + x %<-% 42L + stopifnot(x == 42L) + + ## Force R worker to terminate + ## It's not safe to use quit() here when using type = "FORK" [1] + ## [1] https://stat.ethz.ch/pipermail/r-devel/2021-August/080995.html + x %<-% tools::pskill(pid = Sys.getpid()) + res <- tryCatch(y <- x, error = identity) + print(res) + stopifnot( + inherits(res, "error"), + inherits(res, "FutureError") + ) - ## Force R worker to terminate - ## It's not safe to use quit() here when using type = "FORK" [1] - ## [1] https://stat.ethz.ch/pipermail/r-devel/2021-August/080995.html - x %<-% tools::pskill(pid = Sys.getpid()) - res <- tryCatch(y <- x, error = identity) - print(res) - stopifnot( - inherits(res, "error"), - inherits(res, "FutureError") - ) - - ## Cleanup - print(cl) - ## FIXME: Why doesn't this work here? It causes the below future to stall. - # parallel::stopCluster(cl) - - ## Verify that the reset worked - cl <- parallel::makeCluster(1L, type = type, timeout = 60) - print(cl) - plan(cluster, workers = cl, .skip = FALSE) - x %<-% 43L - stopifnot(x == 43L) + ## Cleanup + print(cl) + ## FIXME: Why doesn't this work here? It causes the below future to stall. + # parallel::stopCluster(cl) - message("*** cluster() - crashed worker ... DONE") + ## Verify that the reset worked + cl <- parallel::makeCluster(1L, type = type, timeout = 60) + print(cl) + plan(cluster, workers = cl, .skip = FALSE) + x %<-% 43L + stopifnot(x == 43L) + + message("*** cluster() - crashed worker ... DONE") } ## if (type != "FORK" || getRversion() >= "3.3.0") ## Sanity checks diff --git a/tests/cluster-missing-future-pkg.R b/tests/cluster-missing-future-pkg.R index 0c40bace..b97faeab 100644 --- a/tests/cluster-missing-future-pkg.R +++ b/tests/cluster-missing-future-pkg.R @@ -3,15 +3,12 @@ options(future.debug = FALSE) message("*** cluster() ...") -message("Library paths: ", paste(sQuote(.libPaths()), collapse = ", ")) +message("Library paths: ", commaq(.libPaths())) message("Package path: ", sQuote(system.file(package = "future"))) types <- "PSOCK" -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (isWin32) types <- NULL - -if (supportsMulticore() && !on_solaris) types <- c(types, "FORK") +if (supportsMulticore()) types <- c(types, "FORK") setupClusterWithoutPkgs <- function(type = "PSOCK", withouts = c("future")) { message("setupClusterWithoutPkgs() ...") diff --git a/tests/cluster.R b/tests/cluster.R index dd39c52b..50e76dae 100644 --- a/tests/cluster.R +++ b/tests/cluster.R @@ -2,15 +2,12 @@ source("incl/start.R") options(future.debug = FALSE) message("*** cluster() ...") -message("Library paths: ", paste(sQuote(.libPaths()), collapse = ", ")) +message("Library paths: ", commaq(.libPaths())) message("Package path: ", sQuote(system.file(package = "future"))) types <- "PSOCK" -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (isWin32) types <- NULL - -if (supportsMulticore() && !on_solaris) types <- c(types, "FORK") +if (supportsMulticore()) types <- c(types, "FORK") ## WORKAROUND: covr::package_coverage() -> merge_coverage() -> ... produces ## "Error in readRDS(x) : error reading from connection" for type = "FORK". @@ -49,7 +46,7 @@ for (type in types) { v <- grep("^[.][.][.]future[.]", v, invert = TRUE, value = TRUE) if (length(v) > 0) { stop(sprintf("Stray variables in the global environment of %s: %s", - class(f)[1], paste(sQuote(v), collapse = ", "))) + class(f)[1], commaq(v))) } ## No global variables @@ -116,7 +113,7 @@ for (type in types) { print(f) v <- value(f, signal = FALSE) print(v) - stopifnot(inherits(v, "simpleError")) + stopifnot(inherits(v, "error")) res <- tryCatch(value(f), error = identity) print(res) @@ -171,7 +168,7 @@ for (type in types) { v <- grep("^[.][.][.]future[.]", v, invert = TRUE, value = TRUE) if (length(v) > 0) { stop(sprintf("Stray variables in the global environment of %s: %s", - class(f)[1], paste(sQuote(v), collapse = ", "))) + class(f)[1], commaq(v))) } ## Sanity checks @@ -238,8 +235,6 @@ for (type in types) { library("parallel") for (type in types) { - if (on_solaris) next - message(sprintf("Test set #2 with cluster type %s ...", sQuote(type))) message("*** cluster() - setDefaultCluster() ...") diff --git a/tests/demo.R b/tests/demo.R index d8a15349..4e3dbc80 100644 --- a/tests/demo.R +++ b/tests/demo.R @@ -15,7 +15,7 @@ message("*** Fibonacci demo of the 'future' package ... DONE") message("*** Mandelbrot demo of the 'future' package ...") -if (getRversion() >= "3.2.0" && !isWin32) { +if (getRversion() >= "3.2.0") { options(future.demo.mandelbrot.nrow = 2L) options(future.demo.mandelbrot.resolution = 50L) options(future.demo.mandelbrot.delay = FALSE) diff --git a/tests/dotdotdot.R b/tests/dotdotdot.R index 75edc5b3..6f96459b 100644 --- a/tests/dotdotdot.R +++ b/tests/dotdotdot.R @@ -2,9 +2,6 @@ source("incl/start.R") library("listenv") for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/future,labels.R b/tests/future,labels.R index 416896fa..0f5c9b84 100644 --- a/tests/future,labels.R +++ b/tests/future,labels.R @@ -4,9 +4,6 @@ message("*** Futures - labels ...") strategies <- supportedStrategies() -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (!fullTest && isWin32) strategies <- NULL - for (strategy in strategies) { message(sprintf("- plan('%s') ...", strategy)) plan(strategy) diff --git a/tests/future,optsenvvars.R b/tests/future,optsenvvars.R index ecec179e..818ed944 100644 --- a/tests/future,optsenvvars.R +++ b/tests/future,optsenvvars.R @@ -4,9 +4,6 @@ message("*** Futures - undo R options and environment variables ...") strategies <- supportedStrategies() -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (!fullTest && isWin32) strategies <- NULL - options(digits = 6L) Sys.setenv(R_DEFAULT_INTERNET_TIMEOUT = "300") old_options <- options() diff --git a/tests/futureAssign.R b/tests/futureAssign.R index 6ebc6032..466e6735 100644 --- a/tests/futureAssign.R +++ b/tests/futureAssign.R @@ -32,9 +32,6 @@ message("*** futureAssign() - sequential w/ lazy evaluation ... DONE") message("*** futureAssign() - lazy = TRUE / FALSE ...") for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/futureAssign_OP.R b/tests/futureAssign_OP.R index 0efe4d88..c0aea727 100644 --- a/tests/futureAssign_OP.R +++ b/tests/futureAssign_OP.R @@ -3,9 +3,6 @@ source("incl/start.R") message("*** %<-% ...") for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/futureCall.R b/tests/futureCall.R index e7291e87..04011e9a 100644 --- a/tests/futureCall.R +++ b/tests/futureCall.R @@ -34,9 +34,6 @@ args <- list(x = 42, y = 12) v0 <- do.call(function(x, y) a * (x - y), args = args) for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) strategies <- supportedStrategies(cores) diff --git a/tests/globals,NSE.R b/tests/globals,NSE.R index 4c4f56e5..d99fcdfe 100644 --- a/tests/globals,NSE.R +++ b/tests/globals,NSE.R @@ -7,9 +7,6 @@ data <- data.frame(x = 1:5, y = 1:5) v0 <- subset(data, x < 3)$y for (strategy in supportedStrategies()) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("- Strategy: %s ...", strategy)) plan(strategy) diff --git a/tests/globals,S4methods.R b/tests/globals,S4methods.R index d13093e6..e6ae43fa 100644 --- a/tests/globals,S4methods.R +++ b/tests/globals,S4methods.R @@ -31,25 +31,12 @@ for (strategy in supportedStrategies()) { rm(list = "my_fcn") v <- tryCatch(value(f), error = identity) print(v) - if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) { - message("R_CHECK_IDEAL=TRUE") - if (getOption("future.globals.keepWhere", TRUE)) { - message("future.globals.keepWhere=TRUE") - stopifnot(identical(v, truth)) - } else { - message("future.globals.keepWhere=FALSE") - stopifnot(inherits(v, "error")) - } - } else if (isTRUE(getOption("future.globals.keepWhere", FALSE))) { + if (isTRUE(getOption("future.globals.keepWhere", FALSE))) { message("future.globals.keepWhere=TRUE") stopifnot(identical(v, truth)) } else { message("future.globals.keepWhere=FALSE") - if (strategy %in% c("sequential", "multicore")) { - stopifnot(inherits(v, "error")) - } else { - stopifnot(inherits(v, "error")) - } + stopifnot(inherits(v, "error")) } my_fcn <- org_my_fcn } diff --git a/tests/globals,formulas.R b/tests/globals,formulas.R index 76fd49ae..627d2e2b 100644 --- a/tests/globals,formulas.R +++ b/tests/globals,formulas.R @@ -59,9 +59,6 @@ str(y_iv) for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/globals,locals.R b/tests/globals,locals.R index faf636b1..d4ea1822 100644 --- a/tests/globals,locals.R +++ b/tests/globals,locals.R @@ -79,26 +79,7 @@ for (strategy in supportedStrategies()) { res <- tryCatch({ v <- value(f) }, error = identity) print(res) - - if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) { - stopifnot(identical(v, truth)) - } else if (isTRUE(getOption("future.globals.keepWhere", FALSE))) { - message("future.globals.keepWhere=TRUE") - if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) { - message("future.globals.globalsOf.locals=TRUE") - if (strategy %in% c("sequential", "multicore")) { - stopifnot(identical(v, truth)) - } else { - stopifnot(identical(v, truth)) - } - } else { - message("future.globals.globalsOf.locals=FALSE") - stopifnot(identical(v, truth)) - } - } else { - message("future.globals.keepWhere=FALSE") - stopifnot(identical(v, truth)) - } + stopifnot(identical(v, truth)) }) @@ -134,13 +115,7 @@ for (strategy in supportedStrategies()) { stopifnot(identical(v, truth)) } else if (isTRUE(getOption("future.globals.keepWhere", FALSE))) { message("future.globals.keepWhere=TRUE") - if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) { - message("future.globals.globalsOf.locals=TRUE") - stopifnot(identical(v, truth)) - } else { - message("future.globals.globalsOf.locals=FALSE") - stopifnot(identical(v, truth)) - } + stopifnot(identical(v, truth)) } else { message("future.globals.keepWhere=FALSE") if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) { diff --git a/tests/globals,manual.R b/tests/globals,manual.R index 75686af5..2a55da2e 100644 --- a/tests/globals,manual.R +++ b/tests/globals,manual.R @@ -130,7 +130,7 @@ for (strategy in supportedStrategies()) { rm(list = names(globals)) y <- tryCatch(value(f), error = identity) if (!inherits(f, c("SequentialFuture", "UniprocessFuture", "MulticoreFuture"))) { - stopifnot(inherits(y, "simpleError")) + stopifnot(inherits(y, "error")) } diff --git a/tests/globals,subassignment.R b/tests/globals,subassignment.R index f8922cbe..df9e2526 100644 --- a/tests/globals,subassignment.R +++ b/tests/globals,subassignment.R @@ -35,9 +35,6 @@ stopifnot(identical(y, y0)) stopifnot(identical(x, list())) for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/globals,tricky.R b/tests/globals,tricky.R index 3a365305..f9aa32f6 100644 --- a/tests/globals,tricky.R +++ b/tests/globals,tricky.R @@ -8,9 +8,6 @@ oopts <- c(oopts, options( message("*** Tricky use cases related to globals ...") for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) diff --git a/tests/immediateCondition.R b/tests/immediateCondition.R index 87edd353..dfcee361 100644 --- a/tests/immediateCondition.R +++ b/tests/immediateCondition.R @@ -78,8 +78,8 @@ for (ss in seq_along(strategies)) { 42L }, label = "single-future") }) - message(" class: ", paste(sQuote(class(f)), collapse = ", ")) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(" class: ", commaq(class(f))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { if (inherits(f, "UniprocessFuture")) { stopifnot(identical(msgs, c("IM1\n", "IW", "IM2\n"))) @@ -93,7 +93,7 @@ for (ss in seq_along(strategies)) { r <- resolved(f) }) message(" result: ", r) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { if (inherits(f, "MultiprocessFuture")) { stopifnot(identical(msgs, c("IM1\n", "IW", "IM2\n"))) @@ -106,7 +106,7 @@ for (ss in seq_along(strategies)) { msgs <- recordMessages({ f <- resolve(f) }) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { stopifnot(length(msgs) == 0L) }) @@ -115,7 +115,7 @@ for (ss in seq_along(strategies)) { msgs <- recordMessages({ f <- resolve(f, result = TRUE) }) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { if (inherits(f, c("UniprocessFuture", "MultiprocessFuture"))) { stopifnot(length(msgs) == 0L) @@ -129,7 +129,7 @@ for (ss in seq_along(strategies)) { v <- value(f) }) message(" value: ", v) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { if (inherits(f, c("UniprocessFuture", "MultiprocessFuture"))) { stopifnot(identical(msgs, "M\n")) @@ -178,8 +178,8 @@ for (ss in seq_along(strategies)) { 2L }, label = "future-2") }) - message(" class: ", paste(sQuote(class(fs[[1]])), collapse = ", ")) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(" class: ", commaq(class(fs[[1]]))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(fs[[1]], { if (inherits(fs[[1]], "UniprocessFuture")) { stopifnot(identical(msgs, c("IM1\n", "IW1", "IM2\n", "IW2"))) @@ -193,7 +193,7 @@ for (ss in seq_along(strategies)) { rs <- resolved(fs) }) message(" result: ", paste(rs, collapse = ", ")) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { if (inherits(f, "MultiprocessFuture")) { stopifnot(all(msgs %in% c("IM1\n", "IM2\n", "IW1", "IW2"))) @@ -211,7 +211,7 @@ for (ss in seq_along(strategies)) { msgs <- recordMessages({ fs <- resolve(fs) }) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { stopifnot(length(msgs) == 0L) }) @@ -220,7 +220,7 @@ for (ss in seq_along(strategies)) { msgs <- recordMessages({ fs <- resolve(fs, result = TRUE) }) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { if (inherits(fs[[1]], c("UniprocessFuture", "MultiprocessFuture", "CallrFuture", "BatchtoolsFuture"))) { stopifnot(length(msgs) == 0L) @@ -234,7 +234,7 @@ for (ss in seq_along(strategies)) { vs <- value(fs) }) message(" values: ", paste(vs, collapse = ", ")) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { stopifnot(identical(msgs, c("M1\n", "M2\n"))) }) @@ -244,7 +244,7 @@ for (ss in seq_along(strategies)) { vs <- value(fs) }) message(" values: ", paste(vs, collapse = ", ")) - message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + message(sprintf(" msgs [n=%d]: %s", length(msgs), commaq(msgs))) f_try(f, { stopifnot(identical(msgs, c("M1\n", "M2\n"))) }) diff --git a/tests/incl/start,load-only.R b/tests/incl/start,load-only.R index 3d5907c0..cbed9dba 100644 --- a/tests/incl/start,load-only.R +++ b/tests/incl/start,load-only.R @@ -8,7 +8,6 @@ oenvs <- oenvs0 <- Sys.getenv() oopts0 <- options() covr_testing <- ("covr" %in% loadedNamespaces()) -on_solaris <- grepl("^solaris", R.version$os) on_macos <- grepl("^darwin", R.version$os) on_githubactions <- as.logical(Sys.getenv("GITHUB_ACTIONS", "FALSE")) @@ -56,7 +55,6 @@ oplan <- future::plan() future::plan("sequential") fullTest <- (Sys.getenv("_R_CHECK_FULL_") != "") -isWin32 <- (.Platform$OS.type == "windows" && .Platform$r_arch == "i386") ## Private future functions .onLoad <- future:::.onLoad @@ -69,6 +67,7 @@ gassign <- future:::gassign get_future <- future:::get_future geval <- future:::geval grmall <- future:::grmall +commaq <- future:::commaq hpaste <- future:::hpaste importParallel <- future:::importParallel mdebug <- future:::mdebug diff --git a/tests/multicore.R b/tests/multicore.R index ae15d6da..fd2013eb 100644 --- a/tests/multicore.R +++ b/tests/multicore.R @@ -23,7 +23,7 @@ for (cores in 1:min(2L, availableCores("multicore"))) { f <- multicore({ 42L }, globals = globals) - stopifnot(inherits(f, "MulticoreFuture") || ((cores ==1 || !supportsMulticore()) && inherits(f, "SequentialFuture"))) + stopifnot(inherits(f, "MulticoreFuture") || ((cores == 1 || !supportsMulticore()) && inherits(f, "SequentialFuture"))) print(resolved(f)) y <- value(f) @@ -71,7 +71,7 @@ for (cores in 1:min(2L, availableCores("multicore"))) { print(f) v <- value(f, signal = FALSE) print(v) - stopifnot(inherits(v, "simpleError")) + stopifnot(inherits(v, "error")) res <- try(value(f), silent = TRUE) print(res) diff --git a/tests/multisession.R b/tests/multisession.R index 947c70d0..8eb3fca5 100644 --- a/tests/multisession.R +++ b/tests/multisession.R @@ -4,9 +4,6 @@ library("listenv") message("*** multisession() ...") for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores) @@ -71,7 +68,7 @@ for (cores in 1:availCores) { print(f) v <- value(f, signal = FALSE) print(v) - stopifnot(inherits(v, "simpleError")) + stopifnot(inherits(v, "error")) res <- try(value(f), silent = TRUE) print(res) diff --git a/tests/nbrOfWorkers.R b/tests/nbrOfWorkers.R index ffc0c499..702a538a 100644 --- a/tests/nbrOfWorkers.R +++ b/tests/nbrOfWorkers.R @@ -32,7 +32,7 @@ cores <- availableCores() message("Number of available cores: ", cores) workers <- availableWorkers() nworkers <- length(workers) -message(sprintf("Available workers: [n = %d] %s", nworkers, hpaste(sQuote(workers)))) +message(sprintf("Available workers: [n = %d] %s", nworkers, commaq(workers))) allButOneCore <- function() max(1L, future::availableCores() - 1L) allButOneWorker <- function() { @@ -41,9 +41,6 @@ allButOneWorker <- function() { } for (strategy in strategies) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message("Type of future: ", strategy) evaluator <- get(strategy, mode = "function") diff --git a/tests/nested_futures,mc.cores.R b/tests/nested_futures,mc.cores.R index 1f0527c6..64e5b63c 100644 --- a/tests/nested_futures,mc.cores.R +++ b/tests/nested_futures,mc.cores.R @@ -16,9 +16,7 @@ winWorkaround <- (.Platform$OS.type == "windows" && getRversion() >= "4.0.0") message("*** Nested futures - mc.cores ...") -strategies <- NULL -## Speed up CRAN checks: Skip on CRAN Windows 32-bit -if (!isWin32) strategies <- c(strategies, "multisession") +strategies <- "multisession" if (supportsMulticore()) strategies <- c(strategies, "multicore") pid <- Sys.getpid() cat(sprintf("Main PID: %d\n", pid)) @@ -28,9 +26,6 @@ cores <- availableCores() print(cores) for (mc in 1:2) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("- mc.cores = %d ...", mc)) options(mc.cores = mc) mc2 <- min(mc, cores) diff --git a/tests/nested_futures.R b/tests/nested_futures.R index 2cf59aae..f9e2e754 100644 --- a/tests/nested_futures.R +++ b/tests/nested_futures.R @@ -5,9 +5,6 @@ strategies <- supportedStrategies() message("*** Nested futures ...") for (strategy1 in strategies) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - for (strategy2 in strategies) { message(sprintf("- plan(list('%s', '%s')) ...", strategy1, strategy2)) plan(list(a = strategy1, b = strategy2)) diff --git a/tests/relaying,split.R b/tests/relaying,split.R index 8d770561..0877ed88 100644 --- a/tests/relaying,split.R +++ b/tests/relaying,split.R @@ -15,7 +15,7 @@ relay <- recordRelay({ 1L }) }) -message(" class: ", paste(sQuote(class(f)), collapse = ", ")) +message(" class: ", commaq(class(f))) stopifnot(length(relay$stdout) == 0L) stopifnot(length(relay$msgs) == 0L) relay <- recordRelay(v <- value(f)) @@ -34,7 +34,7 @@ relay <- recordRelay({ 1L }) }) -message(" class: ", paste(sQuote(class(f)), collapse = ", ")) +message(" class: ", commaq(class(f))) stopifnot(length(relay$stdout) == 0L) stopifnot(length(relay$msgs) == 0L) relay <- recordRelay(v <- value(f)) @@ -53,7 +53,7 @@ relay <- recordRelay({ 1L }) }) -message(" class: ", paste(sQuote(class(f)), collapse = ", ")) +message(" class: ", commaq(class(f))) stopifnot(identical(relay$stdout, "O\n")) stopifnot(identical(relay$msgs, "M\n")) relay <- recordRelay(v <- value(f)) diff --git a/tests/relaying.R b/tests/relaying.R index fa2b057f..a676339b 100644 --- a/tests/relaying.R +++ b/tests/relaying.R @@ -31,7 +31,7 @@ for (ss in seq_along(strategies)) { 1L }, conditions = structure("condition", exclude = exclude)) }) - message(" class: ", paste(sQuote(class(f)), collapse = ", ")) + message(" class: ", commaq(class(f))) stopifnot(length(relay$stdout) == 0L) stopifnot(length(relay$msgs) == 0L) @@ -85,7 +85,7 @@ for (ss in seq_along(strategies)) { fs[[1]] <- future({ cat("O1\n"); message("M1"); 1L }) fs[[2]] <- future({ cat("O2\n"); message("M2"); 2L }) }) - message(" class: ", paste(sQuote(class(fs[[1]])), collapse = ", ")) + message(" class: ", commaq(class(fs[[1]]))) stopifnot(length(relay$stdout) == 0L) stopifnot(length(relay$msgs) == 0L) @@ -142,7 +142,7 @@ for (ss in seq_along(strategies)) { fs[[1]] <- future({ cat("O1\n"); Sys.sleep(1); message("M1"); 1L }) fs[[2]] <- future({ cat("O2\n"); message("M2"); 2L }) }) - message(" class: ", paste(sQuote(class(fs[[1]])), collapse = ", ")) + message(" class: ", commaq(class(fs[[1]]))) stopifnot(length(relay$stdout) == 0L) stopifnot(length(relay$msgs) == 0L) diff --git a/tests/rng.R b/tests/rng.R index 02bf4c49..7d5aca0c 100644 --- a/tests/rng.R +++ b/tests/rng.R @@ -109,9 +109,6 @@ stopifnot( for (cores in 1:availCores) { - ## Speed up CRAN checks: Skip on CRAN Windows 32-bit - if (!fullTest && isWin32) next - message(sprintf("Testing with %d cores ...", cores)) options(mc.cores = cores)