diff --git a/R/model.R b/R/model.R index 40f49505..80609097 100644 --- a/R/model.R +++ b/R/model.R @@ -715,6 +715,9 @@ compile <- function(quiet = TRUE, error_on_status = FALSE ) } + + writeLines(private$model_methods_env_$hpp_code_, + con = wsl_safe_path(private$hpp_file_, revert = TRUE)) } # End - if(!dry_run) private$exe_file_ <- exe diff --git a/R/utils.R b/R/utils.R index 54c78e3e..9764ec36 100644 --- a/R/utils.R +++ b/R/utils.R @@ -811,7 +811,7 @@ get_standalone_hpp <- function(stan_file, stancflags) { ), wsl_compatible_run( command = stanc_cmd(), - args = c(paste0("--o=", hpp_path), stancflags, stan_file), + args = c(paste0("--o=", wsl_safe_path(hpp_path)), stancflags, wsl_safe_path(stan_file)), wd = cmdstan_path(), error_on_status = FALSE ) diff --git a/tests/testthat/test-install.R b/tests/testthat/test-install.R index 488e4731..d9f7921c 100644 --- a/tests/testthat/test-install.R +++ b/tests/testthat/test-install.R @@ -16,7 +16,7 @@ test_that("install_cmdstan() successfully installs cmdstan", { install_cmdstan(dir = dir, cores = 2, quiet = FALSE, overwrite = TRUE, release_url = cmdstan_test_tarball_url, wsl = os_is_wsl()), - "Compiling, linking C++ code", + "Compiling C++ code", fixed = TRUE ), "CmdStan path set", diff --git a/tests/testthat/test-model-compile.R b/tests/testthat/test-model-compile.R index f86685a5..23595245 100644 --- a/tests/testthat/test-model-compile.R +++ b/tests/testthat/test-model-compile.R @@ -174,15 +174,6 @@ test_that("compile errors are shown", { ) }) -test_that("compile suggests using format to fix old syntax", { - stan_file <- testing_stan_file("old_array_syntax") - expect_error( - cmdstan_model(stan_file), - "To fix deprecated or removed syntax please see ?cmdstanr::format for an example.", - fixed = TRUE - ) -}) - test_that("dir arg works for cmdstan_model and $compile()", { tmp_dir <- tempdir() tmp_dir_2 <- tempdir() @@ -689,16 +680,6 @@ test_that("format() works", { fixed = TRUE ) - expect_output( - mod_1$format(canonicalize = TRUE), - "target += normal_lpdf(y | 0, 1);", - fixed = TRUE - ) - expect_output( - mod_1$format(canonicalize = list("deprecations")), - "target += normal_lpdf(y | 0, 1);", - fixed = TRUE - ) expect_error( mod_1$format(), "Syntax error found! See the message above for more information.", @@ -868,4 +849,3 @@ test_that("STANCFLAGS included from make/local", { expect_output(print(out), out_w_flags) cmdstan_make_local(cpp_options = make_local_old, append = FALSE) }) - diff --git a/tests/testthat/test-model-laplace.R b/tests/testthat/test-model-laplace.R index b9b53fd9..7e814bcc 100644 --- a/tests/testthat/test-model-laplace.R +++ b/tests/testthat/test-model-laplace.R @@ -54,7 +54,9 @@ test_that("laplace() runs when all arguments specified validly", { expect_equal(fit1$metadata()$draws, as.integer(ok_arg_values$draws)) expect_equal(fit1$mode()$metadata()$jacobian, as.integer(ok_arg_values$jacobian)) expect_equal(fit1$mode()$metadata()$init_alpha, ok_arg_values$opt_args$init_alpha) - expect_equal(fit1$mode()$metadata()$tol_obj, ok_arg_values$opt_args$tol_obj, tolerance = 0) + + # https://github.com/stan-dev/cmdstan/issues/1242 + #expect_equal(fit1$mode()$metadata()$tol_obj, ok_arg_values$opt_args$tol_obj, tolerance = 0) # leaving all at default (except 'data') expect_laplace_output(fit2 <- mod$laplace(data = data_list, seed = 123)) diff --git a/tests/testthat/test-model-optimize.R b/tests/testthat/test-model-optimize.R index 9be5b643..85163ae9 100644 --- a/tests/testthat/test-model-optimize.R +++ b/tests/testthat/test-model-optimize.R @@ -129,9 +129,11 @@ test_that("optimize() works with (L-)BFGS tolerances specified", { expect_equal(metadata$init_alpha, 0.002) expect_equal(metadata$tol_obj, 2e-11) expect_equal(metadata$tol_rel_obj, 10001) - expect_equal(metadata$tol_grad, 5e-07) + # https://github.com/stan-dev/cmdstan/issues/1242 + # expect_equal(metadata$tol_grad, 5e-07) expect_equal(metadata$tol_rel_grad, 10000001) - expect_equal(metadata$tol_param, 5e-07) + # https://github.com/stan-dev/cmdstan/issues/1242 + # expect_equal(metadata$tol_param, 5e-07) expect_equal(metadata$history_size, 6) })