Commit 4df67cf0 authored by Dorchies David's avatar Dorchies David
Browse files

ci: debug regression tests

- distinction between R versions which produce the results to test
- add Gitlab artefact instruction for making results available for tests in next jobs in the pipeline

Refs #59
parent c6869e74
Pipeline #14370 passed with stages
in 30 minutes and 49 seconds
...@@ -40,6 +40,10 @@ default: ...@@ -40,6 +40,10 @@ default:
- Rscript -e 'source("tests/testthat/store_examples.R"); StoreRefExampleResults("airGR");' - Rscript -e 'source("tests/testthat/store_examples.R"); StoreRefExampleResults("airGR");'
- R CMD INSTALL . - R CMD INSTALL .
- Rscript -e 'source("tests/testthat/store_examples.R"); StoreTestExampleResults("airGR");' - Rscript -e 'source("tests/testthat/store_examples.R"); StoreTestExampleResults("airGR");'
artifacts:
paths:
- tests/tmp/
expire_in: 1 week
.check_not_cran: .check_not_cran:
stage: tests stage: tests
......
...@@ -4,7 +4,11 @@ StoreRefExampleResults <- function(package, ...) { ...@@ -4,7 +4,11 @@ StoreRefExampleResults <- function(package, ...) {
} }
StoreTestExampleResults <- function(package, ...) { StoreTestExampleResults <- function(package, ...) {
StoreExampleResults(package = package, path = "tests/tmp/test", ...) StoreExampleResults(
package = package,
path = file.path("tests/tmp", Sys.getenv("R_VERSION", "test")),
...
)
} }
#' Run examples of a package and store the output variables in RDS files for further testing. #' Run examples of a package and store the output variables in RDS files for further testing.
......
...@@ -8,7 +8,10 @@ CompareWithRef <- function(refVarFile, testDir, regIgnore) { ...@@ -8,7 +8,10 @@ CompareWithRef <- function(refVarFile, testDir, regIgnore) {
if(is.null(regIgnore) || all(apply(regIgnore, 1, function(x) {!all(x == v)}))) { if(is.null(regIgnore) || all(apply(regIgnore, 1, function(x) {!all(x == v)}))) {
test_that(paste("Compare", v$topic, v$var), { test_that(paste("Compare", v$topic, v$var), {
skip_on_cran() skip_on_cran()
testVarFile <- paste0("../tmp/test/", file.path(v$topic, v$var), ".rds") testVarFile <- paste0(
file.path("../tmp", Sys.getenv("R_VERSION", "test"), v$topic, v$var),
".rds"
)
expect_true(file.exists(testVarFile)) expect_true(file.exists(testVarFile))
if(file.exists(testVarFile)) { if(file.exists(testVarFile)) {
testVar <- readRDS(testVarFile) testVar <- readRDS(testVarFile)
...@@ -24,8 +27,8 @@ if(dir.exists("../tmp/ref") & dir.exists("../tmp/test")) { ...@@ -24,8 +27,8 @@ if(dir.exists("../tmp/ref") & dir.exists("../tmp/test")) {
regIgnoreFile <- "../../.regressionignore2" regIgnoreFile <- "../../.regressionignore2"
if(file.exists(regIgnoreFile)) { if(file.exists(regIgnoreFile)) {
regIgnore <- read.table( regIgnore <- read.table(
file = regIgnoreFile, file = regIgnoreFile,
sep = " ", header = FALSE, skip = 5, col.names = c("topic", "var"), sep = " ", header = FALSE, skip = 5, col.names = c("topic", "var"),
stringsAsFactors = FALSE stringsAsFactors = FALSE
) )
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment