Skip to content

Commit 8d4f37e

Browse files
committed
Cover make/local inheritance across a real recompile
The existing make/local test goes through cmdstan_model(); the route the fix was about, a recompile through an existing object, was untested. Real make/local, real build, and assert_valid_threads() asked directly whether it still objects. Confirmed to fail on both assertions without the post-commit merge.
1 parent b2689f3 commit 8d4f37e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/testthat/test-model-compile.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,19 @@ test_that("cpp_options work with settings in make/local", {
968968
cmdstan_make_local(cpp_options = backup, append = FALSE)
969969
})
970970

971+
test_that("a recompile records options inherited from make/local", {
972+
local_cmdstan_make_local(cpp_options = list(STAN_THREADS = "true"))
973+
stan_file <- file.path(withr::local_tempdir(), "bernoulli.stan")
974+
file.copy(stan_program, stan_file)
975+
976+
mod <- cmdstan_model(stan_file, compile = FALSE)
977+
mod$compile(force_recompile = TRUE)
978+
979+
# Nothing was passed to $compile(), so only the binary can report threading.
980+
expect_true(cpp_option_value(mod$cpp_options(), "stan_threads"))
981+
expect_silent(assert_valid_threads(2, mod$cpp_options(), multiple_chains = TRUE))
982+
})
983+
971984
test_that("cpp_options() excludes the Stan version reported by the executable", {
972985
mod <- cmdstan_model(stan_file = stan_program)
973986
expect_null(mod$cpp_options()$STAN_VERSION)

0 commit comments

Comments
 (0)