11context(" install" )
22
3+ # avoid parallel on Mac due to strange intermittent TBB errors on Github Actions
4+ CORES <- if (os_is_macos()) 1 else 2
5+
36cmdstan_test_tarball_url <- Sys.getenv(" CMDSTAN_TEST_TARBALL_URL" )
47if (! nzchar(cmdstan_test_tarball_url )) {
58 cmdstan_test_tarball_url <- NULL
@@ -13,7 +16,7 @@ test_that("install_cmdstan() successfully installs cmdstan", {
1316 }
1417 expect_message(
1518 expect_output(
16- install_cmdstan(dir = dir , cores = 2 , quiet = FALSE , overwrite = TRUE ,
19+ install_cmdstan(dir = dir , cores = CORES , quiet = FALSE , overwrite = TRUE ,
1720 release_url = cmdstan_test_tarball_url ,
1821 wsl = os_is_wsl()),
1922 " Compiling C++ code" ,
@@ -52,7 +55,7 @@ test_that("install_cmdstan() errors if it times out", {
5255 expect_warning(
5356 expect_message(
5457 install_cmdstan(dir = dir , timeout = 1 , quiet = TRUE , overwrite = dir_exists ,
55- release_url = cmdstan_test_tarball_url , wsl = os_is_wsl()),
58+ cores = CORES , wsl = os_is_wsl()),
5659 if (dir_exists ) " * Removing the existing installation" else " * * Installing CmdStan from https://github.com" ,
5760 fixed = TRUE
5861 ),
@@ -64,8 +67,7 @@ test_that("install_cmdstan() errors if it times out", {
6467 expect_warning(
6568 expect_message(
6669 install_cmdstan(dir = dir , timeout = 1 , quiet = FALSE , overwrite = dir_exists ,
67- release_url = cmdstan_test_tarball_url ,
68- wsl = os_is_wsl()),
70+ cores = CORES , wsl = os_is_wsl()),
6971 if (dir_exists ) " * Removing the existing installation" else " * * Installing CmdStan from https://github.com" ,
7072 fixed = TRUE
7173 ),
@@ -91,6 +93,9 @@ test_that("install_cmdstan() errors if invalid version or URL", {
9193})
9294
9395test_that(" install_cmdstan() works with version and release_url" , {
96+ # this test is irrelevant if tests are using a release candidate tarball URL so skip
97+ skip_if(! is.null(cmdstan_test_tarball_url ))
98+
9499 if (getRversion() < ' 3.5.0' ) {
95100 dir <- tempdir()
96101 } else {
@@ -99,8 +104,8 @@ test_that("install_cmdstan() works with version and release_url", {
99104
100105 expect_message(
101106 expect_output(
102- install_cmdstan(dir = dir , overwrite = TRUE , cores = 4 ,
103- release_url = " https://github.com/stan-dev/cmdstan/releases/download/v2.35 .0/cmdstan-2.35 .0.tar.gz" ,
107+ install_cmdstan(dir = dir , overwrite = TRUE , cores = CORES ,
108+ release_url = " https://github.com/stan-dev/cmdstan/releases/download/v2.36 .0/cmdstan-2.36 .0.tar.gz" ,
104109 wsl = os_is_wsl()),
105110 " Compiling C++ code" ,
106111 fixed = TRUE
@@ -111,8 +116,8 @@ test_that("install_cmdstan() works with version and release_url", {
111116 expect_warning(
112117 expect_message(
113118 expect_output(
114- install_cmdstan(dir = dir , overwrite = TRUE , cores = 4 ,
115- version = " 2.35 .0" ,
119+ install_cmdstan(dir = dir , overwrite = TRUE , cores = CORES ,
120+ version = " 2.36 .0" ,
116121 # the URL is intentionally invalid to test that the version has higher priority
117122 release_url = " https://github.com/stan-dev/cmdstan/releases/download/v2.27.3/cmdstan-2.27.3.tar.gz" ,
118123 wsl = os_is_wsl()),
@@ -125,7 +130,7 @@ test_that("install_cmdstan() works with version and release_url", {
125130 " version and release_url shouldn't both be specified" ,
126131 fixed = TRUE
127132 )
128- expect_true(dir.exists(file.path(dir , " cmdstan-2.35 .0" )))
133+ expect_true(dir.exists(file.path(dir , " cmdstan-2.36 .0" )))
129134 set_cmdstan_path(cmdstan_default_path())
130135})
131136
@@ -187,7 +192,7 @@ test_that("toolchain checks on Windows with RTools 3.5 work", {
187192
188193test_that(" clean and rebuild works" , {
189194 expect_output(
190- rebuild_cmdstan(),
195+ rebuild_cmdstan(cores = CORES ),
191196 paste0(" CmdStan v" , cmdstan_version(), " built" ),
192197 fixed = TRUE
193198 )
@@ -215,11 +220,11 @@ test_that("Downloads respect quiet argument", {
215220 # expect_message has trouble capturing the messages from download.file
216221 # so handle manually
217222 install_normal <- suppressWarnings(
218- capture.output(install_cmdstan(dir = dir , overwrite = TRUE , quiet = FALSE ),
223+ capture.output(install_cmdstan(dir = dir , overwrite = TRUE , quiet = FALSE , cores = CORES ),
219224 type = " message" )
220225 )
221226 install_quiet <- suppressWarnings(
222- capture.output(install_cmdstan(dir = dir , overwrite = TRUE , quiet = TRUE ),
227+ capture.output(install_cmdstan(dir = dir , overwrite = TRUE , quiet = TRUE , cores = CORES ),
223228 type = " message" )
224229 )
225230
@@ -256,15 +261,15 @@ test_that("Install from release file works", {
256261 dir <- tempdir(check = TRUE )
257262 }
258263
259- destfile = file.path(dir , " cmdstan-2.35 .0.tar.gz" )
264+ destfile <- file.path(dir , " cmdstan-2.36 .0.tar.gz" )
260265
261266 download_with_retries(
262- " https://github.com/stan-dev/cmdstan/releases/download/v2.35 .0/cmdstan-2.35 .0.tar.gz" ,
267+ " https://github.com/stan-dev/cmdstan/releases/download/v2.36 .0/cmdstan-2.36 .0.tar.gz" ,
263268 destfile )
264269
265270 expect_message(
266271 expect_output(
267- install_cmdstan(dir = dir , cores = 2 , quiet = FALSE , overwrite = TRUE ,
272+ install_cmdstan(dir = dir , cores = CORES , quiet = FALSE , overwrite = TRUE ,
268273 release_file = destfile ,
269274 wsl = os_is_wsl()),
270275 " Compiling C++ code" ,
0 commit comments