Running 'demo.R' [2s]
  Running 'dotdotdot.R' [2s]
  Running 'future,labels.R' [2s]
  Running 'future,lazy.R' [1s]
  Running 'future.tests,mirai_cluster.R' [16s]
  Running 'future.tests-mirai_multisession.R' [18s]
  Running 'globals,formulas.R' [2s]
  Running 'globals,manual.R' [2s]
  Running 'globals,nested.R' [1s]
  Running 'globals,subassignment.R' [2s]
  Running 'globals,tricky.R' [2s]
  Running 'mirai_cluster,worker-termination.R' [1s]
  Running 'mirai_cluster.R' [1s]
  Running 'nbrOfWorkers.R' [1s]
  Running 'plan.R' [1s]
  Running 'rng.R' [1s]
  Running 'stdout.R' [2s]
  Running 'zzz,future_lapply.R' [7s]
Running the tests in 'tests/mirai_cluster.R' failed.
Complete output:
  > source("incl/start.R")
  Loading required package: future
  [12:36:36.843] plan(): Setting new future strategy stack:
  [12:36:36.844] List of future strategies:
  [12:36:36.844] 1. mirai_multisession:
  [12:36:36.844]    - args: function (expr, substitute = TRUE, envir = parent.frame(), ..., workers = availableCores())
  [12:36:36.844]    - tweaked: FALSE
  [12:36:36.844]    - call: future::plan(future.mirai::mirai_multisession)
  [12:36:36.858] plan(): plan_init() of 'mirai_multisession', 'mirai_cluster', 'mirai', 'multiprocess', 'future', 'function' ...
  [12:36:36.858] < mirai [$data] >
  [12:36:36.868] getGlobalsAndPackages() ...
  [12:36:36.869] Not searching for globals
  [12:36:36.869] - globals: [0] <none>
  [12:36:36.869] getGlobalsAndPackages() ... DONE
  [12:36:36.869] getGlobalsAndPackages() ...
  [12:36:36.870] 
  [12:36:36.870] - globals: [0] <none>
  [12:36:36.870] getGlobalsAndPackages() ... DONE
  [12:36:37.085] Packages needed by the future expression (n = 0): <none>
  [12:36:37.085] Packages needed by future strategies (n = 0): <none>
  [12:36:37.087] {
  [12:36:37.087]     {
  [12:36:37.087]         {
  [12:36:37.087]             ...future.startTime <- base::Sys.time()
  [12:36:37.087]             {
  [12:36:37.087]                 {
  [12:36:37.087]                   {
  [12:36:37.087]                     base::local({
  [12:36:37.087]                       has_future <- base::requireNamespace("future", 
  [12:36:37.087]                         quietly = TRUE)
  [12:36:37.087]                       if (has_future) {
  [12:36:37.087]                         ns <- base::getNamespace("future")
  [12:36:37.087]                         version <- ns[[".package"]][["version"]]
  [12:36:37.087]                         if (is.null(version)) 
  [12:36:37.087]                           version <- utils::packageVersion("future")
  [12:36:37.087]                       }
  [12:36:37.087]                       else {
  [12:36:37.087]                         version <- NULL
  [12:36:37.087]                       }
  [12:36:37.087]                       if (!has_future || version < "1.8.0") {
  [12:36:37.087]                         info <- base::c(r_version = base::gsub("R version ", 
  [12:36:37.087]                           "", base::R.version$version.string), 
  [12:36:37.087]                           platform = base::sprintf("%s (%s-bit)", 
  [12:36:37.087]                             base::R.version$platform, 8 * base::.Machine$sizeof.pointer), 
  [12:36:37.087]                           os = base::paste(base::Sys.info()[base::c("sysname", 
  [12:36:37.087]                             "release", "version")], collapse = " "), 
  [12:36:37.087]                           hostname = base::Sys.info()[["nodename"]])
  [12:36:37.087]                         info <- base::sprintf("%s: %s", base::names(info), 
  [12:36:37.087]                           info)
  [12:36:37.087]                         info <- base::paste(info, collapse = "; ")
  [12:36:37.087]                         if (!has_future) {
  [12:36:37.087]                           msg <- base::sprintf("Package 'future' is not installed on worker (%s)", 
  [12:36:37.087]                             info)
  [12:36:37.087]                         }
  [12:36:37.087]                         else {
  [12:36:37.087]                           msg <- base::sprintf("Package 'future' on worker (%s) must be of version >= 1.8.0: %s", 
  [12:36:37.087]                             info, version)
  [12:36:37.087]                         }
  [12:36:37.087]                         base::stop(msg)
  [12:36:37.087]                       }
  [12:36:37.087]                     })
  [12:36:37.087]                   }
  [12:36:37.087]                   ...future.strategy.old <- future::plan("list")
  [12:36:37.087]                   options(future.plan = NULL)
  [12:36:37.087]                   Sys.unsetenv("R_FUTURE_PLAN")
  [12:36:37.087]                   future::plan("default", .cleanup = FALSE, .init = FALSE)
  [12:36:37.087]                 }
  [12:36:37.087]                 ...future.workdir <- getwd()
  [12:36:37.087]             }
  [12:36:37.087]             ...future.oldOptions <- base::as.list(base::.Options)
  [12:36:37.087]             ...future.oldEnvVars <- base::Sys.getenv()
  [12:36:37.087]         }
  [12:36:37.087]         base::options(future.startup.script = FALSE, future.globals.onMissing = NULL, 
  [12:36:37.087]             future.globals.maxSize = NULL, future.globals.method = NULL, 
  [12:36:37.087]             future.globals.onMissing = NULL, future.globals.onReference = NULL, 
  [12:36:37.087]             future.globals.resolve = NULL, future.resolve.recursive = NULL, 
  [12:36:37.087]             future.rng.onMisuse = NULL, future.rng.onMisuse.keepFuture = NULL, 
  [12:36:37.087]             future.stdout.windows.reencode = NULL, width = 80L)
  [12:36:37.087]         ...future.futureOptionsAdded <- base::setdiff(base::names(base::.Options), 
  [12:36:37.087]             base::names(...future.oldOptions))
  [12:36:37.087]     }
  [12:36:37.087]     if (FALSE) {
  [12:36:37.087]     }
  [12:36:37.087]     else {
  [12:36:37.087]         if (TRUE) {
  [12:36:37.087]             ...future.stdout <- base::rawConnection(base::raw(0L), 
  [12:36:37.087]                 open = "w")
  [12:36:37.087]         }
  [12:36:37.087]         else {
  [12:36:37.087]             ...future.stdout <- base::file(base::switch(.Platform$OS.type, 
  [12:36:37.087]                 windows = "NUL", "/dev/null"), open = "w")
  [12:36:37.087]         }
  [12:36:37.087]         base::sink(...future.stdout, type = "output", split = FALSE)
  [12:36:37.087]         base::on.exit(if (!base::is.null(...future.stdout)) {
  [12:36:37.087]             base::sink(type = "output", split = FALSE)
  [12:36:37.087]             base::close(...future.stdout)
  [12:36:37.087]         }, add = TRUE)
  [12:36:37.087]     }
  [12:36:37.087]     ...future.frame <- base::sys.nframe()
  [12:36:37.087]     ...future.conditions <- base::list()
  [12:36:37.087]     ...future.rng <- base::globalenv()$.Random.seed
  [12:36:37.087]     if (FALSE) {
  [12:36:37.087]         ...future.globalenv.names <- c(base::names(base::.GlobalEnv), 
  [12:36:37.087]             "...future.value", "...future.globalenv.names", ".Random.seed")
  [12:36:37.087]     }
  [12:36:37.087]     ...future.result <- base::tryCatch({
  [12:36:37.087]         base::withCallingHandlers({
  [12:36:37.087]             ...future.value <- base::withVisible(base::local(NA))
  [12:36:37.087]             future::FutureResult(value = ...future.value$value, 
  [12:36:37.087]                 visible = ...future.value$visible, rng = !identical(base::globalenv()$.Random.seed, 
  [12:36:37.087]                   ...future.rng), globalenv = if (FALSE) 
  [12:36:37.087]                   list(added = base::setdiff(base::names(base::.GlobalEnv), 
  [12:36:37.087]                     ...future.globalenv.names))
  [12:36:37.087]                 else NULL, started = ...future.startTime, version = "1.8")
  [12:36:37.087]         }, condition = base::local({
  [12:36:37.087]             c <- base::c
  [12:36:37.087]             inherits <- base::inherits
  [12:36:37.087]             invokeRestart <- base::invokeRestart
  [12:36:37.087]             length <- base::length
  [12:36:37.087]             list <- base::list
  [12:36:37.087]             seq.int <- base::seq.int
  [12:36:37.087]             signalCondition <- base::signalCondition
  [12:36:37.087]             sys.calls <- base::sys.calls
  [12:36:37.087]             `[[` <- base::`[[`
  [12:36:37.087]             `+` <- base::`+`
  [12:36:37.087]             `<<-` <- base::`<<-`
  [12:36:37.087]             sysCalls <- function(calls = sys.calls(), from = 1L) {
  [12:36:37.087]                 calls[seq.int(from = from + 12L, to = length(calls) - 
  [12:36:37.087]                   3L)]
  [12:36:37.087]             }
  [12:36:37.087]             function(cond) {
  [12:36:37.087]                 is_error <- inherits(cond, "error")
  [12:36:37.087]                 ignore <- !is_error && !is.null(NULL) && inherits(cond, 
  [12:36:37.087]                   NULL)
  [12:36:37.087]                 if (is_error) {
  [12:36:37.087]                   sessionInformation <- function() {
  [12:36:37.087]                     list(r = base::R.Version(), locale = base::Sys.getlocale(), 
  [12:36:37.087]                       rngkind = base::RNGkind(), namespaces = base::loadedNamespaces(), 
  [12:36:37.087]                       search = base::search(), system = base::Sys.info())
  [12:36:37.087]                   }
  [12:36:37.087]                   ...future.conditions[[length(...future.conditions) + 
  [12:36:37.087]                     1L]] <<- list(condition = cond, calls = c(sysCalls(from = ...future.frame), 
  [12:36:37.087]                     cond$call), session = sessionInformation(), 
  [12:36:37.087]                     timestamp = base::Sys.time(), signaled = 0L)
  [12:36:37.087]                   signalCondition(cond)
  [12:36:37.087]                 }
  [12:36:37.087]                 else if (!ignore && TRUE && inherits(cond, "condition")) {
  [12:36:37.087]                   signal <- FALSE && inherits(cond, character(0))
  [12:36:37.087]                   ...future.conditions[[length(...future.conditions) + 
  [12:36:37.087]                     1L]] <<- list(condition = cond, signaled = base::as.integer(signal))
  [12:36:37.087]                   if (FALSE && !signal) {
  [12:36:37.087]                     muffleCondition <- function (cond, pattern = "^muffle") 
  [12:36:37.087]                     {
  [12:36:37.087]                       inherits <- base::inherits
  [12:36:37.087]                       invokeRestart <- base::invokeRestart
  [12:36:37.087]                       is.null <- base::is.null
  [12:36:37.087]                       muffled <- FALSE
  [12:36:37.087]                       if (inherits(cond, "message")) {
  [12:36:37.087]                         muffled <- grepl(pattern, "muffleMessage")
  [12:36:37.087]                         if (muffled) 
  [12:36:37.087]                           invokeRestart("muffleMessage")
  [12:36:37.087]                       }
  [12:36:37.087]                       else if (inherits(cond, "warning")) {
  [12:36:37.087]                         muffled <- grepl(pattern, "muffleWarning")
  [12:36:37.087]                         if (muffled) 
  [12:36:37.087]                           invokeRestart("muffleWarning")
  [12:36:37.087]                       }
  [12:36:37.087]                       else if (inherits(cond, "condition")) {
  [12:36:37.087]                         if (!is.null(pattern)) {
  [12:36:37.087]                           computeRestarts <- base::computeRestarts
  [12:36:37.087]                           grepl <- base::grepl
  [12:36:37.087]                           restarts <- computeRestarts(cond)
  [12:36:37.087]                           for (restart in restarts) {
  [12:36:37.087]                             name <- restart$name
  [12:36:37.087]                             if (is.null(name)) 
  [12:36:37.087]                               next
  [12:36:37.087]                             if (!grepl(pattern, name)) 
  [12:36:37.087]                               next
  [12:36:37.087]                             invokeRestart(restart)
  [12:36:37.087]                             muffled <- TRUE
  [12:36:37.087]                             break
  [12:36:37.087]                           }
  [12:36:37.087]                         }
  [12:36:37.087]                       }
  [12:36:37.087]                       invisible(muffled)
  [12:36:37.087]                     }
  [12:36:37.087]                     muffleCondition(cond, pattern = "^muffle")
  [12:36:37.087]                   }
  [12:36:37.087]                 }
  [12:36:37.087]                 else {
  [12:36:37.087]                   if (TRUE) {
  [12:36:37.087]                     muffleCondition <- function (cond, pattern = "^muffle") 
  [12:36:37.087]                     {
  [12:36:37.087]                       inherits <- base::inherits
  [12:36:37.087]                       invokeRestart <- base::invokeRestart
  [12:36:37.087]                       is.null <- base::is.null
  [12:36:37.087]                       muffled <- FALSE
  [12:36:37.087]                       if (inherits(cond, "message")) {
  [12:36:37.087]                         muffled <- grepl(pattern, "muffleMessage")
  [12:36:37.087]                         if (muffled) 
  [12:36:37.087]                           invokeRestart("muffleMessage")
  [12:36:37.087]                       }
  [12:36:37.087]                       else if (inherits(cond, "warning")) {
  [12:36:37.087]                         muffled <- grepl(pattern, "muffleWarning")
  [12:36:37.087]                         if (muffled) 
  [12:36:37.087]                           invokeRestart("muffleWarning")
  [12:36:37.087]                       }
  [12:36:37.087]                       else if (inherits(cond, "condition")) {
  [12:36:37.087]                         if (!is.null(pattern)) {
  [12:36:37.087]                           computeRestarts <- base::computeRestarts
  [12:36:37.087]                           grepl <- base::grepl
  [12:36:37.087]                           restarts <- computeRestarts(cond)
  [12:36:37.087]                           for (restart in restarts) {
  [12:36:37.087]                             name <- restart$name
  [12:36:37.087]                             if (is.null(name)) 
  [12:36:37.087]                               next
  [12:36:37.087]                             if (!grepl(pattern, name)) 
  [12:36:37.087]                               next
  [12:36:37.087]                             invokeRestart(restart)
  [12:36:37.087]                             muffled <- TRUE
  [12:36:37.087]                             break
  [12:36:37.087]                           }
  [12:36:37.087]                         }
  [12:36:37.087]                       }
  [12:36:37.087]                       invisible(muffled)
  [12:36:37.087]                     }
  [12:36:37.087]                     muffleCondition(cond, pattern = "^muffle")
  [12:36:37.087]                   }
  [12:36:37.087]                 }
  [12:36:37.087]             }
  [12:36:37.087]         }))
  [12:36:37.087]     }, error = function(ex) {
  [12:36:37.087]         base::structure(base::list(value = NULL, visible = NULL, 
  [12:36:37.087]             conditions = ...future.conditions, rng = !identical(base::globalenv()$.Random.seed, 
  [12:36:37.087]                 ...future.rng), started = ...future.startTime, 
  [12:36:37.087]             finished = Sys.time(), session_uuid = NA_character_, 
  [12:36:37.087]             version = "1.8"), class = "FutureResult")
  [12:36:37.087]     }, finally = {
  [12:36:37.087]         if (!identical(...future.workdir, getwd())) 
  [12:36:37.087]             setwd(...future.workdir)
  [12:36:37.087]         {
  [12:36:37.087]             if (identical(getOption("nwarnings"), ...future.oldOptions$nwarnings)) {
  [12:36:37.087]                 ...future.oldOptions$nwarnings <- NULL
  [12:36:37.087]             }
  [12:36:37.087]             base::options(...future.oldOptions)
  [12:36:37.087]             if (.Platform$OS.type == "windows") {
  [12:36:37.087]                 old_names <- names(...future.oldEnvVars)
  [12:36:37.087]                 envs <- base::Sys.getenv()
  [12:36:37.087]                 names <- names(envs)
  [12:36:37.087]                 common <- intersect(names, old_names)
  [12:36:37.087]                 added <- setdiff(names, old_names)
  [12:36:37.087]                 removed <- setdiff(old_names, names)
  [12:36:37.087]                 changed <- common[...future.oldEnvVars[common] != 
  [12:36:37.087]                   envs[common]]
  [12:36:37.087]                 NAMES <- toupper(changed)
  [12:36:37.087]                 args <- list()
  [12:36:37.087]                 for (kk in seq_along(NAMES)) {
  [12:36:37.087]                   name <- changed[[kk]]
  [12:36:37.087]                   NAME <- NAMES[[kk]]
  [12:36:37.087]                   if (name != NAME && is.element(NAME, old_names)) 
  [12:36:37.087]                     next
  [12:36:37.087]                   args[[name]] <- ...future.oldEnvVars[[name]]
  [12:36:37.087]                 }
  [12:36:37.087]                 NAMES <- toupper(added)
  [12:36:37.087]                 for (kk in seq_along(NAMES)) {
  [12:36:37.087]                   name <- added[[kk]]
  [12:36:37.087]                   NAME <- NAMES[[kk]]
  [12:36:37.087]                   if (name != NAME && is.element(NAME, old_names)) 
  [12:36:37.087]                     next
  [12:36:37.087]                   args[[name]] <- ""
  [12:36:37.087]                 }
  [12:36:37.087]                 NAMES <- toupper(removed)
  [12:36:37.087]                 for (kk in seq_along(NAMES)) {
  [12:36:37.087]                   name <- removed[[kk]]
  [12:36:37.087]                   NAME <- NAMES[[kk]]
  [12:36:37.087]                   if (name != NAME && is.element(NAME, old_names)) 
  [12:36:37.087]                     next
  [12:36:37.087]                   args[[name]] <- ...future.oldEnvVars[[name]]
  [12:36:37.087]                 }
  [12:36:37.087]                 if (length(args) > 0) 
  [12:36:37.087]                   base::do.call(base::Sys.setenv, args = args)
  [12:36:37.087]                 args <- names <- old_names <- NAMES <- envs <- common <- added <- removed <- NULL
  [12:36:37.087]             }
  [12:36:37.087]             else {
  [12:36:37.087]                 base::do.call(base::Sys.setenv, args = base::as.list(...future.oldEnvVars))
  [12:36:37.087]             }
  [12:36:37.087]             {
  [12:36:37.087]                 if (base::length(...future.futureOptionsAdded) > 
  [12:36:37.087]                   0L) {
  [12:36:37.087]                   opts <- base::vector("list", length = base::length(...future.futureOptionsAdded))
  [12:36:37.087]                   base::names(opts) <- ...future.futureOptionsAdded
  [12:36:37.087]                   base::options(opts)
  [12:36:37.087]                 }
  [12:36:37.087]                 {
  [12:36:37.087]                   NULL
  [12:36:37.087]                   options(future.plan = NULL)
  [12:36:37.087]                   if (is.na(NA_character_)) 
  [12:36:37.087]                     Sys.unsetenv("R_FUTURE_PLAN")
  [12:36:37.087]                   else Sys.setenv(R_FUTURE_PLAN = NA_character_)
  [12:36:37.087]                   future::plan(...future.strategy.old, .cleanup = FALSE, 
  [12:36:37.087]                     .init = FALSE)
  [12:36:37.087]                 }
  [12:36:37.087]             }
  [12:36:37.087]         }
  [12:36:37.087]     })
  [12:36:37.087]     if (TRUE) {
  [12:36:37.087]         base::sink(type = "output", split = FALSE)
  [12:36:37.087]         if (TRUE) {
  [12:36:37.087]             ...future.result$stdout <- base::rawToChar(base::rawConnectionValue(...future.stdout))
  [12:36:37.087]         }
  [12:36:37.087]         else {
  [12:36:37.087]             ...future.result["stdout"] <- base::list(NULL)
  [12:36:37.087]         }
  [12:36:37.087]         base::close(...future.stdout)
  [12:36:37.087]         ...future.stdout <- NULL
  [12:36:37.087]     }
  [12:36:37.087]     ...future.result$conditions <- ...future.conditions
  [12:36:37.087]     ...future.result$finished <- base::Sys.time()
  [12:36:37.087]     ...future.result
  [12:36:37.087] }
  [12:36:37.303] plan(): plan_init() of 'mirai_multisession', 'mirai_cluster', 'mirai', 'multiprocess', 'future', 'function' ... DONE
  [12:36:37.304] plan(): nbrOfWorkers() = 2
  > library("listenv")
  > 
  > message("*** mirai_multisession() ...")
  *** mirai_multisession() ...
  > 
  > for (cores in 1:min(2L, availableCores())) {
  +   ## FIXME:
  +   if (!fullTest && cores > 1) next
  + 
  +   mprintf("Testing with %d cores ...", cores)
  +   options(mc.cores = cores - 1L)
  + 
  +   for (globals in c(FALSE, TRUE)) {
  +     mprintf("*** mirai_multisession(..., globals = %s) without globals",
  +             globals)
  + 
  +     f <- mirai_multisession({
  +       42L
  +     }, globals = globals)
  +     stopifnot(inherits(f, "MiraiFuture"))
  + 
  +     print(resolved(f))
  +     y <- value(f)
  +     print(y)
  +     stopifnot(y == 42L)
  + 
  +     mprintf("*** mirai_multisession(..., globals = %s) with globals", globals)
  +     ## A global variable
  +     a <- 0
  +     f <- mirai_multisession({
  +       b <- 3
  +       c <- 2
  +       a * b * c
  +     }, globals = globals)
  +     print(f)
  + 
  + 
  +     ## A mirai_multisession future is evaluated in a separated
  +     ## process.  Changing the value of a global
  +     ## variable should not affect the result of the
  +     ## future.
  +     a <- 7  ## Make sure globals are frozen
  +     if (globals) {
  +       v <- value(f)
  +       print(v)
  +       stopifnot(v == 0)
  +     } else {
  +       res <- tryCatch({ value(f) }, error = identity)
  +       print(res)
  +       stopifnot(inherits(res, "error"))
  +     }
  + 
  + 
  +     mprintf("*** mirai_multisession(..., globals = %s) with globals and blocking", globals) #nolint
  +     x <- listenv()
  +     for (ii in 1:3) {
  +       mprintf(" - Creating mirai_multisession future #%d ...", ii)
  +       x[[ii]] <- mirai_multisession({ ii }, globals = globals)
  +     }
  +     mprintf(" - Resolving %d mirai_multisession futures", length(x))
  +     if (globals) {
  +       v <- sapply(x, FUN = value)
  +       stopifnot(all(v == 1:3))
  +     } else {
  +       v <- lapply(x, FUN = function(f) tryCatch(value(f), error = identity))
  +       stopifnot(all(sapply(v, FUN = inherits, "error")))
  +     }
  + 
  +     mprintf("*** mirai_multisession(..., globals = %s) and errors", globals)
  +     f <- mirai_multisession({
  +       stop("Whoops!")
  +       1
  +     }, globals = globals)
  +     print(f)
  +     v <- value(f, signal = FALSE)
  +     print(v)
  +     stopifnot(inherits(v, "error"))
  + 
  +     res <- tryCatch({
  +       v <- value(f)
  +     }, error = identity)
  +     print(res)
  +     stopifnot(inherits(res, "error"))
  + 
  +     ## Error is repeated
  +     res <- tryCatch({
  +       v <- value(f)
  +     }, error = identity)
  +     print(res)
  +     stopifnot(inherits(res, "error"))
  + 
  +   } # for (globals ...)
  + 
  + 
  +   message("*** mirai_multisession(..., workers = 1L) ...")
  + 
  +   a <- 2
  +   b <- 3
  +   y_truth <- a * b
  + 
  +   f <- mirai_multisession({ a * b }, workers = 1L)
  +   rm(list = c("a", "b"))
  + 
  +   v <- value(f)
  +   print(v)
  +   stopifnot(v == y_truth)
  + 
  +   message("*** mirai_multisession(..., workers = 1L) ... DONE")
  + 
  +   mprintf("Testing with %d cores ... DONE", cores)
  + } ## for (cores ...)
  [12:36:37.398] Testing with 1 cores ...[12:36:37.398] *** mirai_multisession(..., globals = FALSE) without globals[12:36:37.401] getGlobalsAndPackages() ...
  [12:36:37.401] Not searching for globals
  [12:36:37.402] - globals: [0] <none>
  [12:36:37.402] getGlobalsAndPackages() ... DONE
  [12:36:37.402] getGlobalsAndPackages() ...
  [12:36:37.403] 
  [12:36:37.403] - globals: [0] <none>
  [12:36:37.403] getGlobalsAndPackages() ... DONE