[R] testInstalledBasic

Cody Hamilton cody.shawn at yahoo.com
Fri Jul 1 18:07:12 CEST 2011


Hi Uwe,

Thank you for taking the time to look into this!

I created the function my.test by modifying testInstalledBasic with the line change you list below and then ran:

Sys.setenv(LC_COLLATE="C")
my.test('basic')

I get the same error message as before:

> my.test('basic')
running strict specific tests
  running code in ‘eval-etc.R’
  comparing ‘eval-etc.Rout’ to ‘eval-etc.Rout.save’ ...[1] 1

Here is the function my.test:

my.test<-function (scope = c("basic", "devel", "both")) 
{
    scope <- match.arg(scope)
    Sys.setlocale("LC_COLLATE", "C")
    tests1 <- c("eval-etc", "simple-true", "arith-true", "lm-tests", 
        "ok-errors", "method-dispatch", "d-p-q-r-tests")
    tests2 <- c("complex", "print-tests", "lapack", "datasets")
    tests3 <- c("reg-tests-1a", "reg-tests-1b", "reg-tests-2", "reg-IO", "reg-IO2", "reg-S4")

    runone <- function(f, diffOK = FALSE, inC = TRUE) {
        f <- paste(f, "R", sep = ".")
        if (!file.exists(f)) {
            if (!file.exists(fin <- paste(f, "in", sep = ""))) 
                stop("file ", sQuote(f), " not found", domain = NA)
            message("creating ", sQuote(f))
            cmd <- paste(shQuote(file.path(R.home("bin"), "R")), 
                "CMD BATCH --no-timing --vanilla --slave", fin)
            if (system(cmd)) 
                stop("creation of ", sQuote(f), " failed")
            on.exit(unlink(f))
        }
        message("  running code in ", sQuote(f))
        outfile <- paste(f, "out", sep = "")
        cmd <- paste(shQuote(file.path(R.home("bin"), "R")), 
            "CMD BATCH --vanilla --no-timing", shQuote(f), shQuote(outfile))
        extra <- paste("LANGUAGE=C", "R_DEFAULT_PACKAGES=", "SRCDIR=.")
        if (inC) 
            extra <- paste(extra, "LC_ALL=C")
        if (.Platform$OS.type == "windows") {
            Sys.setenv(LANGUAGE = "C")
            Sys.setenv(R_DEFAULT_PACKAGES = "")
            Sys.setenv(SRCDIR = ".")
        }
        else cmd <- paste(extra, cmd)
        res <- system(cmd)
        if (res) {
            file.rename(outfile, paste(outfile, "fail", sep = "."))
            message("FAILED")
            return(1L)
        }
        savefile <- paste(outfile, "save", sep = ".")
        if (file.exists(savefile)) {
            message("  comparing ", sQuote(outfile), " to ", 
                sQuote(savefile), " ...", appendLF = FALSE)
            res <- Rdiff(outfile, savefile, TRUE)
            if (!res) 
                message(" OK")
            else if (!diffOK) 
                return(1L)
        }
        0L
    }
    owd <- setwd(file.path(R.home(), "tests"))
    on.exit(setwd(owd))
    if (scope %in% c("basic", "both")) {
        message("running strict specific tests")
        for (f in tests1) if (runone(f)) 
            return(1L)
        message("running sloppy specific tests")
        for (f in tests2) runone(f, TRUE)
        message("running regression tests")
        for (f in tests3) {
            if (runone(f)) 
                return(invisible(1L))
            if (f == "reg-plot") {
                message("  comparing 'reg-plot.ps' to 'reg-plot.ps.save' ...", 
                  appendLF = FALSE)
                system("diff reg-plot.ps reg-plot.ps.save")
                message("OK")
            }
        }
        runone("reg-tests-3", TRUE)
        message("running tests of plotting Latin-1")
        message("  expect failure or some differences if not in a Latin or UTF-8 locale")
        runone("reg-plot-latin1", TRUE, FALSE)
        message("  comparing 'reg-plot-latin1.ps' to 'reg-plot-latin1.ps.save' ...", 
            appendLF = FALSE)
        system("diff reg-plot-latin1.ps reg-plot-latin1.ps.save")
        message("OK")
    }
    if (scope %in% c("devel", "both")) {
        message("running tests of consistency of as/is.*")
        runone("isas-tests")
        message("running tests of random deviate generation -- fails occasionally")
        runone("p-r-random-tests", TRUE)
        message("running tests of primitives")
        if (runone("primitives")) 
            return(invisible(1L))
        message("running regexp regression tests")
        if (runone("utf8-regex", inC = FALSE)) 
            return(invisible(1L))
        message("running tests to possibly trigger segfaults")
        if (runone("no-segfault")) 
            return(invisible(1L))
    }
    invisible(0L)
}


--- On Fri, 7/1/11, Uwe Ligges <ligges at statistik.tu-dortmund.de> wrote:

> From: Uwe Ligges <ligges at statistik.tu-dortmund.de>
> Subject: Re: [R] testInstalledBasic
> To: "Cody Hamilton" <cody.shawn at yahoo.com>
> Cc: r-help at r-project.org
> Date: Friday, July 1, 2011, 6:04 AM
> 
> 
> On 01.07.2011 01:17, Cody Hamilton wrote:
> > Hello,
> >
> > I installed R 2.13.0 on a Windows 2003 server.  I
> downloaded the Rtools213.exe from http://www.murdoch-sutherland.com/Rtools/
> and placed it in the path (C:\Program
> Files\R\R-2.13.0\bin).
> >
> > I submitted the following code:
> >
> > library(tools)
> > Sys.setenv(LC_COLLATE=C)
> > testInstalledBasic('basic')
> >
> > I get the following message in the R Console, which I
> believe corresponds to a failure of the test:
> >
> >> library(tools)
> >> Sys.setenv(LC_COLLATE=C)
> >> testInstalledBasic('basic')
> > running strict specific tests
> >    running code in ‘eval-etc.R’
> >    comparing ‘eval-etc.Rout’ to
> ‘eval-etc.Rout.save’ ...[1] 1
> >
> > Is there something wrong with my install?
> 
> 
> 
> I took a closer look and your problem is that you want
> 
> Sys.setenv(LC_COLLATE="C")
> 
> rather than
> 
> Sys.setenv(LC_COLLATE=C)
> 
> since C is a function but "C" the character you actually
> want to set.
> 
> 
> 
> 
> Anyway, there is a bug in ./src/library/tools/R/testing.R
> (e.g. for 
> today's R-devel):
> 
> The line
> 
>      tests3 <- c("reg-tests-1",
> "reg-tests-2", "reg-IO", "reg-IO2", 
> "reg-S4")
> 
> needs to be replaced by
> 
>      tests3 <- c("reg-tests-1a",
> "reg-tests-1b", "reg-tests-2", 
> "reg-IO", "reg-IO2", "reg-S4")
> 
> Any R core member around to fix this?
> 
> 
> Best,
> Uwe Ligges
> 
> 
> 
> 
> > Regards,
> >     -Cody
> >
> > ______________________________________________
> > R-help at r-project.org
> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list