Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faster make test #1538

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 6 additions & 6 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")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is not needed anymore, as runGamsCompile does that alone

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
Loading