R Under development (unstable) (2025-06-04 r88278 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## This runs testme test script inst/testme/test-globals,manual.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > future.callr:::testme("globals,manual") Test 'globals,manual' ... Sourcing 9 prologue scripts ... 01/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/001.load.R' 02/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/002.record-state.R' 03/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/030.imports.R' 04/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/050.utils.R' 05/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/090.context.R' 06/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/090.options.R' 07/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/091.envvars.R' 08/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/099.future-setup.R' 09/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/995.detrius-connections.R' Sourcing 9 prologue scripts ... done Running test script: 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/test-globals,manual.R' > library(future.callr) Loading required package: future > plan(callr) > message("*** Globals - manually ...") *** Globals - manually ... > message("*** Globals manually specified as named list ...") *** Globals manually specified as named list ... > globals <- list(a = 1, b = 2, sumtwo = function(x) x[1] + + x[2]) > attach_locally(globals) > v0 <- local({ + x <- 1:10 + sumtwo(a + b * x) + }) > message("*** Globals - automatic ...") *** Globals - automatic ... > attach_locally(globals) > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = TRUE) > print(f) CallrFuture: Label: Expression: { x <- 1:10 sumtwo(a + b * x) } Globals: 3 objects totaling 567 bytes (function 'sumtwo' of 174 bytes, numeric 'a' of 39 bytes, numeric 'b' of 39 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Capture standard output: TRUE Capture condition classes: 'condition' (excluding '') Immediate condition classes: 'immediateCondition' Lazy evaluation: FALSE Local evaluation: TRUE Asynchronous evaluation: TRUE Early signaling: FALSE Environment: R_GlobalEnv State: 'running' Resolved: FALSE Unique identifier: c080c283bbef55760d898a5a3776a251-1 Owner process: c080c283bbef55760d898a5a3776a251 Class: 'CallrFuture', 'Future' Value: Conditions captured: callr status: 'running' callr information: PID=181152, PROCESS 'Rterm', running, pid 181152. > rm(list = names(globals)) > y <- value(f) > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > attach_locally(globals) > y %<-% { + x <- 1:10 + sumtwo(a + b * x) + } %globals% TRUE > rm(list = names(globals)) > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > y %<-% { + 1 + } %globals% FALSE > print(y) [1] 1 > stopifnot(identical(y, 1)) > attach_locally(globals) > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = FALSE) > print(f) CallrFuture: Label: Expression: { x <- 1:10 sumtwo(a + b * x) } Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Capture standard output: TRUE Capture condition classes: 'condition' (excluding '') Immediate condition classes: 'immediateCondition' Lazy evaluation: FALSE Local evaluation: TRUE Asynchronous evaluation: TRUE Early signaling: FALSE Environment: R_GlobalEnv State: 'running' Resolved: FALSE Unique identifier: c080c283bbef55760d898a5a3776a251-4 Owner process: c080c283bbef55760d898a5a3776a251 Class: 'CallrFuture', 'Future' Value: Conditions captured: callr status: 'running' callr information: PID=32416, PROCESS 'Rterm', running, pid 32416. > rm(list = names(globals)) > y <- tryCatch(value(f), error = identity) > if (!inherits(f, c("MulticoreFuture"))) { + stopifnot(inherits(y, "error")) + } > message("*** Globals - automatic ... DONE") *** Globals - automatic ... DONE > message("*** Globals manually specified as named list ...") *** Globals manually specified as named list ... > rm(list = names(globals)) Warning in rm(list = names(globals)) : object 'a' not found Warning in rm(list = names(globals)) : object 'b' not found Warning in rm(list = names(globals)) : object 'sumtwo' not found > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = globals) > print(f) CallrFuture: Label: Expression: { x <- 1:10 sumtwo(a + b * x) } Globals: 3 objects totaling 567 bytes (function 'sumtwo' of 174 bytes, numeric 'a' of 39 bytes, numeric 'b' of 39 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Capture standard output: TRUE Capture condition classes: 'condition' (excluding '') Immediate condition classes: 'immediateCondition' Lazy evaluation: FALSE Local evaluation: TRUE Asynchronous evaluation: TRUE Early signaling: FALSE Environment: R_GlobalEnv State: 'running' Resolved: FALSE Unique identifier: c080c283bbef55760d898a5a3776a251-5 Owner process: c080c283bbef55760d898a5a3776a251 Class: 'CallrFuture', 'Future' Value: Conditions captured: callr status: 'running' callr information: PID=40492, PROCESS 'Rterm', running, pid 40492. > v <- value(f) > print(v) [1] 8 > stopifnot(all.equal(v, v0)) > y %<-% { + x <- 1:10 + sumtwo(a + b * x) + } %globals% globals > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > message("*** Globals manually specified as named list ... DONE") *** Globals manually specified as named list ... DONE > message("*** Globals manually specified by their names ...") *** Globals manually specified by their names ... > attach_locally(globals) > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = c("a", "b", "sumtwo")) > print(f) CallrFuture: Label: Expression: { x <- 1:10 sumtwo(a + b * x) } Globals: 3 objects totaling 567 bytes (function 'sumtwo' of 174 bytes, numeric 'a' of 39 bytes, numeric 'b' of 39 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Capture standard output: TRUE Capture condition classes: 'condition' (excluding '') Immediate condition classes: 'immediateCondition' Lazy evaluation: FALSE Local evaluation: TRUE Asynchronous evaluation: TRUE Early signaling: FALSE Environment: R_GlobalEnv State: 'running' Resolved: FALSE Unique identifier: c080c283bbef55760d898a5a3776a251-7 Owner process: c080c283bbef55760d898a5a3776a251 Class: 'CallrFuture', 'Future' Value: Conditions captured: callr status: 'running' callr information: PID=142780, PROCESS 'Rterm', running, pid 142780. > rm(list = names(globals)) > v <- value(f) > print(v) [1] 8 > stopifnot(all.equal(v, v0)) > attach_locally(globals) > y %<-% { + x <- 1:10 + sumtwo(a + b * x) + } %globals% c("a", "b", "sumtwo") > rm(list = names(globals)) > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > message("*** Globals manually specified by their names ... DONE") *** Globals manually specified by their names ... DONE > message("*** Globals - manually ... DONE") *** Globals - manually ... DONE Sourcing 6 epilogue scripts ... 01/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/001.undo-future.R' 02/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/002.undo-state.R' Failed to undo environment variables: - Expected environment variables: [n=213] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', ..., 'tempdirname' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: 03/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/090.gc.R' 04/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/099.session_info.R' 05/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/995.detritus-connections.R' 06/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/999.detritus-files.R' Skipping, because path appears not to be an 'R CMD check' folder: 'D:/temp/2025_06_05_18_50_16_8598' Sourcing 6 epilogue scripts ... done Test time: user.self=1s, sys.self=0.09s, elapsed=6s, user.child=NAs, sys.child=NAs Test 'tempdirname' ... success > > proc.time() user system elapsed 1.43 0.32 6.10