diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d657787aa8e18028cb5d539f2a629db24ced5f4e..a95b86c279722366e067b6e45849272357685d65 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,10 @@ default: - R CMD INSTALL . - Rscript tests/scheduled_tests/regression.R dev - Rscript tests/scheduled_tests/regression.R compare + artifacts: + paths: + - tests/tmp/stable/timing.tsv + - tests/tmp/dev/timing.tsv .check: stage: check @@ -27,6 +31,10 @@ default: - Rscript tests/scheduled_tests/benchmarkRunModel.R - R CMD INSTALL . - Rscript tests/scheduled_tests/benchmarkRunModel.R + artifacts: + paths: + - tests/tmp/benchmark.tsv + - tests/tmp/mean_execution_time.tsv .check_not_cran: variables: diff --git a/tests/scheduled_tests/benchmarkRunModel.R b/tests/scheduled_tests/benchmarkRunModel.R index 922fa5a839aa12cd626a11e9c1e88cbc7865c422..a983b2f697b841cfafac9aea11affe9bee6c4376 100644 --- a/tests/scheduled_tests/benchmarkRunModel.R +++ b/tests/scheduled_tests/benchmarkRunModel.R @@ -24,7 +24,7 @@ colnames(dfBM) <- sModelNames dfBM <- cbind(version = as.character(packageVersion('airGR')), dfBM) -file <- "tests/tmp/benchmark.txt" +file <- "tests/tmp/benchmark.tsv" dir.create("tests/tmp", showWarnings = FALSE) write.table(dfBM, file = file, row.names = FALSE, col.names = !file.exists(file), quote = FALSE, @@ -39,7 +39,7 @@ if(length(unique(df$version)) > 1) { names(lV) <- unique(df$version) dfMean <- cbind(model = sModelNames, as.data.frame(t(do.call(rbind, lV)))) dfMean$evolution <- (dfMean[,3] - dfMean[,2]) / dfMean[,2] - write.table(dfMean, "tests/tmp/mean_execution_time.txt", row.names = FALSE, quote = F, sep = "\t") + write.table(dfMean, "tests/tmp/mean_execution_time.tsv", row.names = FALSE, quote = F, sep = "\t") res <- testthat::test_file("tests/testthat/benchmarkRunModel.R") dRes <- as.data.frame(res) if (any(dRes[, "failed"] > 0) | any(dRes[, "error"])) { diff --git a/tests/scheduled_tests/regression.R b/tests/scheduled_tests/regression.R index 069b143849db6c4ea9faaabafc694c5e1d3162be..317fae8b1a8116ce07163e3fa2ada718fab456cd 100644 --- a/tests/scheduled_tests/regression.R +++ b/tests/scheduled_tests/regression.R @@ -67,7 +67,7 @@ StoreTopicResults <- function(topic, package, path, run.dontrun = TRUE, run.dont dev.off() write.table(data.frame(topic = topic, time = end_time - start_time), - file.path(path, "timing.csv"), + file.path(path, "timing.tsv"), row.names = FALSE, col.names = FALSE, quote = FALSE, sep = "\t", append = TRUE) diff --git a/tests/testthat/benchmarkRunModel.R b/tests/testthat/benchmarkRunModel.R index aff3a83856a242bc2bae336fde22fd8e21bac1a5..67997d97cca6aa44d237d3acbcc322d505ca4306 100644 --- a/tests/testthat/benchmarkRunModel.R +++ b/tests/testthat/benchmarkRunModel.R @@ -1,7 +1,10 @@ -df <- read.table("../tmp/mean_execution_time.txt", sep = "\t", header = T) +df <- read.table("../tmp/mean_execution_time.tsv", sep = "\t", header = T) lapply(df$model, function(model) { test_that(paste(model, ": RunModel should be as fast as CRAN version"), { - expect_lt(df$evolution[df$model == model], 1.1) + sel <- df$model == model + threshold <- max(0.2, -0.15 * df[sel, 2] + 1) # decrease from 1 at 0.1ms to 0.2 at 5.5ms + expect_lt(df$evolution[sel], threshold) }) }) + diff --git a/tests/testthat/regression.R b/tests/testthat/regression.R index 147b73c500f537fa8ce0d7dba1c1983e1e9e5e05..13e774ab6a282989ee6886178a499d178af6175e 100644 --- a/tests/testthat/regression.R +++ b/tests/testthat/regression.R @@ -33,7 +33,9 @@ CompareWithStable <- function(refVarFile, testDir, regIgnore) { tmp_path <- file.path("../tmp", Sys.getenv("R_VERSION")); if (dir.exists(file.path(tmp_path, "stable")) & dir.exists(file.path(tmp_path, "dev"))) { - refVarFiles <- list.files(file.path(tmp_path, "stable"), recursive = TRUE, full.names = TRUE) + refVarFiles <- list.files(path = file.path(tmp_path, "stable"), + pattern = "\\.rds$", + recursive = TRUE, full.names = TRUE) regIgnoreFile <- "../../.regressionignore" if (file.exists(regIgnoreFile)) { message("Using .regressionignore file. The following variables are going to be skipped:")