Skip to content

Commit

Permalink
possibly the temporary file causes make error?
Browse files Browse the repository at this point in the history
  • Loading branch information
pearsonca committed Nov 23, 2023
1 parent e849065 commit 6df43d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,11 @@ test_that("as_mcmc.list() works", {
})

test_that("get_cmdstan_flags() can be used recursively in `make`", {
tmp <- withr::local_tempfile()
writeLines(
"test:\n\t@Rscript --vanilla -e 'cat(cmdstanr:::get_cmdstan_flags(\"STANCFLAGS\"))'",
tmp
)
mkfile <- normalizePath(test_path("testdata", "Makefile"))
nonrecursive_flags <- get_cmdstan_flags("STANCFLAGS")
recursive_flags <- readLines(textConnection(wsl_compatible_run(
command = "make", args = c("-f", tmp), wd = cmdstan_path()
)$stdout))
stdo <- wsl_compatible_run(
command = "make", args = sprintf("--file=%s", mkfile), wd = cmdstan_path()
)$stdout
recursive_flags <- readLines(textConnection(stdo))
expect_equal(nonrecursive_flags, recursive_flags)
})
3 changes: 3 additions & 0 deletions tests/testthat/testdata/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

test:
@$(R_HOME)/bin/Rscript --vanilla -e 'cat(cmdstanr:::get_cmdstan_flags("STANCFLAGS"))'

0 comments on commit 6df43d4

Please sign in to comment.