HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Program Files/R/R-4.4.0/library/MASS/tests/scripts.R
### This requires packages not declared in Suggests (and not otherwise used)
## GLMMGibbs Kernsmooth boot e1071 fastICA gee interp lattice mda
## mgcv multcomp nlme nnet polsplin rpart spatial splines tree

if(!nzchar(Sys.getenv("MASS_TESTING"))) q("no")
unlink("scripts", recursive = TRUE)
dir.create("scripts")
Sys.unsetenv("R_TESTS") # avoid startup using startup.Rs (which is in the dir above)
setwd("scripts")
writeLines(c(".Random.seed <- c(0L,1:3)",
              "options(width = 65, show.signif.stars=FALSE)"),
           ".Rprofile")

runone <- function(f)
{
    message("  Running ", sQuote(basename(f)))
    outfile <- paste(basename(f), "out", sep = "")
    failfile <- paste(outfile, "fail", sep=".")
    unlink(c(outfile, failfile))
    res <- system2(file.path(R.home("bin"), "R"),
                   c("CMD BATCH --vanilla", shQuote(f), shQuote(outfile)),
                   env = paste("R_LIBS", Sys.getenv("R_LIBS"), sep = "="))
    if (res) {
        cat(tail(readLines(outfile), 20), sep="\n")
        file.rename(outfile, failfile)
        return(1L)
    }
    0L
}


library(MASS)
dd <- system.file("scripts", package="MASS")
files <- list.files(dd, pattern="\\.R$", full.names=TRUE)
res <- 0L
for(f in files) res <- res + runone(f)

proc.time()

if(res) stop(gettextf("%d scripts failed", res))