Skip to content

Commit

Permalink
faster make test. After rebase, add EU21 run
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Feb 5, 2024
1 parent e80dff4 commit 30814d1
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 49 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ check-fix: ## Check if the GAMS code follows the coding etiquette
Rscript -e 'invisible(gms::codeCheck(strict = TRUE, interactive = TRUE))'

test: ## Test if the model compiles and runs without running a full
## scenario. Tests take about 10 minutes to run.
$(info Tests take about 20 minutes to run, please be patient)
## scenario. Tests take about 15 minutes to run.
$(info Tests take about 15 minutes to run, please be patient)
@Rscript -e 'testthat::test_dir("tests/testthat")'

test-coupled: ## Test if the coupling with MAgPIE works. Takes significantly
Expand All @@ -81,9 +81,10 @@ test-coupled-slurm: ## test-coupled, but on slurm
@sbatch --qos=priority --wrap="make test-coupled" --job-name=test-coupled --mail-type=END --output=test-coupled.log --comment="test-coupled.log"

test-full: ## Run all tests, including coupling tests and a default
## REMIND scenario. Takes significantly longer than 10 minutes to run.
## REMIND scenario. Takes several hours to run.
$(info Full tests take more than an hour to run, please be patient)
@TESTTHAT_RUN_SLOW=TRUE Rscript -e 'testthat::test_dir("tests/testthat")'

test-validation: ## Run validation tests, requires a full set of runs in the output folder
$(info Run validation tests, requires a full set of runs in the output folder)
@TESTTHAT_RUN_SLOW=TRUE Rscript -e 'testthat::test_dir("tests/testthat/validation")'
Expand Down
72 changes: 36 additions & 36 deletions config/scenario_config.csv

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions config/tests/scenario_config_compile.csv

This file was deleted.

5 changes: 0 additions & 5 deletions start_bundle_coupled.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ if (any(! file.exists(c(path_settings_coupled, path_settings_remind))) ||
stop("Missing files or directories, see in red above.")
}

if ("--gamscompile" %in% flags && ! file.exists("input/source_files.log")) {
message("\n### Input data missing, need to compile REMIND first (2 min.)\n")
system("Rscript start.R config/tests/scenario_config_compile.csv")
}

####################################################
############## F U N C T I O N S ###################
####################################################
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/helper_skipIfFast.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# | Contact: [email protected]
skipIfFast <- function() {
if (identical(Sys.getenv("TESTTHAT_RUN_SLOW"), "")) {
skip("Not run in default tests, use `make test-full` to run (takes significantly longer than 10 minutes).")
skip("Not run in default tests, use `make test-full` to run (takes several hours).")
}
else {
return(invisible(TRUE))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_02-compile.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# | Contact: [email protected]
test_that("remind compiles", {
skipIfPreviousFailed()
output <- localSystem2("Rscript", c("start.R", "config/tests/scenario_config_compile.csv"))
output <- localSystem2("Rscript", c("start.R", "--gamscompile"))
printIfFailed(output)
expectSuccessStatus(output)
})
2 changes: 1 addition & 1 deletion tests/testthat/test_04-gamscompile.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_that("start.R --gamscompile startgroup=AMT config/scenario_config.csv works
testthat::with_mocked_bindings({
skipIfPreviousFailed()
output <- localSystem2("Rscript",
c("start.R", "--gamscompile", "startgroup=AMT", titletag, csvfile))
c("start.R", "--gamscompile", "startgroup=compileInTests", titletag, csvfile))
printIfFailed(output)
expectSuccessStatus(output)
},
Expand Down

0 comments on commit 30814d1

Please sign in to comment.