Skip to content

Refine heuristic regarding when to run all tests #1433

@eddelbuettel

Description

@eddelbuettel

For a number of years we have relied on the code in tests/tinytest.R that examines the version number and switches to running all tests if it has at least four elements (as our development releases do) or when CI is seen (based on environment variables).

This has worked reasonably well. We get tests, CRAN releases do not. However, it created trouble two or three times when R-devel made (breaking) changes and CRAN asked us for an interim release. We obliged, but I failed to adjust the heuristic and all tests run at CRAN. Not what we want given that they have not run for years (and obviously fall over when we, say, locally build a test package in extended tests and Kurt adds a test for read-only filesystem (which we could accommodate, of course, by a setwd() to the temporary directory),

Long story short I had been puzzling over best to 'tell' if we are in a situation where we may not want to run all tests, and I think I have found one following the refinments on OpenMP setup for Rcpp{Armadillo,Eigen}. CRAN sets OMP_THREAD_LIMIT to 2, which is an unusual enough combination. We can test if a) the variable is set and b) if its value is 2. All 'serious' users of OpenMP likely have a much higher value if one is set at all. So I think I will PR something like the following (locally tested) sketch:

    ## if OMP_THREAD_LIMIT is set, and its value is 2, we have a good
    ## idea of where we are and we likely do not want to run all tests
    if (Sys.getenv("OMP_THREAD_LIMIT", unset="") != "" &&   # it is set
        Sys.getenv("OMP_THREAD_LIMIT") == "2") {            # value is two
        if (Sys.getenv("RunAllRcppTests", "") != "") {      # if unset
            Sys.setenv("RunAllRcppTests"="no")
        }
        if (Sys.getenv("RunVerboseRcppTests", "") != "") {  # if unset
            Sys.setenv("RunVerboseRcppTests"="no")
        }
    }

That should be reliable enough as we do not override a setting of "no" for these two.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions