Running ‘testthat.R’ [107s/126s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > Sys.setenv("R_TESTS" = "")
  > library(testthat)
  > library(rstansim)
  Loading required package: Rcpp
  > 
  > test_check("rstansim")
  
   *** caught segfault ***
  address 10, cause 'memory not mapped'
  
  Traceback:
   1: FUN(X[[i]], ...)
   2: lapply(name, function(id) {    v <- .Internal(getSymbolInfo(as.character(id), PACKAGE, as.logical(withRegistrationInfo)))    if (is.null(v)) {        msg <- paste("no such symbol", id)        if (length(pkgName) && nzchar(pkgName))             msg <- paste(msg, "in package", pkgName)        stop(msg, domain = NA)    }    names(v) <- c("name", "address", "package", "numParameters")[seq_along(v)]    v})
   3: getNativeSymbolInfo(name, PACKAGE)
   4: doTryCatch(return(expr), name, parentenv, handler)
   5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
   6: tryCatchList(expr, classes, parentenv, handlers)
   7: tryCatch(getNativeSymbolInfo(name, PACKAGE), error = function(e) e)
   8: Module(module, mustStart = TRUE)
   9: .getModulePointer(x)
  10: new("Module", .xData = <environment>)$stan_fit4model6986509b48b2_simtestreg
  11: new("Module", .xData = <environment>)$stan_fit4model6986509b48b2_simtestreg
  12: eval(call("$", mod, paste("stan_fit4", model_cppname, sep = "")))
  13: eval(call("$", mod, paste("stan_fit4", model_cppname, sep = "")))
  14: object@mk_cppmodule(object)
  15: .local(object, ...)
  16: rstan::sampling(object = cmodel, data = input_data, init = list(param_values),     iter = nsim, chains = 1, cores = use_cores, warmup = 0, algorithm = "Fixed_param",     seed = seed)
  17: rstan::sampling(object = cmodel, data = input_data, init = list(param_values),     iter = nsim, chains = 1, cores = use_cores, warmup = 0, algorithm = "Fixed_param",     seed = seed)
  18: simulate_internal(cmodel = compiled_model, input_data = input_data,     vars = vars, param_values = param_values, nsim = nsim, use_cores = use_cores,     sim_drop = sim_drop, seed = seed)
  19: simulate_data(file = "data-raw/simtestreg.stan", data_name = "saved stansim_data",     input_data = reg_data, nsim = 1, path = "testdir", param_values = test_vals,     vars = c("sim_x", "sim_y", "N"), use_cores = 1)
  20: withVisible(code)
  21: force(code)
  22: withr::with_output_sink(temp, withVisible(code))
  23: eval_with_output(code, print = print, width = width)
  24: capture_output_lines(code, print, width = width)
  25: capture_output(ss_data <- simulate_data(file = "data-raw/simtestreg.stan",     data_name = "saved stansim_data", input_data = reg_data,     nsim = 1, path = "testdir", param_values = test_vals, vars = c("sim_x",         "sim_y", "N"), use_cores = 1))
  26: eval(code, test_env)
  27: eval(code, test_env)
  28: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  29: doTryCatch(return(expr), name, parentenv, handler)
  30: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  31: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  32: doTryCatch(return(expr), name, parentenv, handler)
  33: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  34: tryCatchList(expr, classes, parentenv, handlers)
  35: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  36: test_code(desc, code, env = parent.frame())
  37: test_that("single_sim testing with stansim_data input", {    expect_false(dir.exists("testdir"))    catch <- capture_output(test_stanfit <- rstan::stan_model(file = "data-raw/simtestreg.stan"))    reg_sim <- function(N = 100) {        list(N = N, x = rep(0, N), y = rep(0, N))    }    reg_data <- reg_sim(100)    test_vals <- list(alpha = 100, beta = -5, sigma = 20)    catch <- capture_output(ss_data <- simulate_data(file = "data-raw/simtestreg.stan",         data_name = "saved stansim_data", input_data = reg_data,         nsim = 1, path = "testdir", param_values = test_vals,         vars = c("sim_x", "sim_y", "N"), use_cores = 1))    ss_data <- ss_data$dataset    expect_true(dir.exists("testdir"))    test_stan_args <- list(object = test_stanfit, iter = 500,         chains = 4)    catch <- capture_output(catch_out <- rstansim:::single_sim(dataset = ss_data,         stan_args = test_stan_args, calc_loo = F, parameters = c("alpha",             "beta", "sigma"), probs = c(0.025, 0.25, 0.5, 0.75,             0.975), estimates = c("mean", "se_mean", "sd", "n_eff",             "Rhat"), stan_warnings = "suppress", cache = F))    expect_type(catch_out, "list")    expect_s3_class(catch_out, "stansim_uni")    expect_equal(length(catch_out), 10)    expect_equal(names(catch_out), c("data_name", "ran_at", "elapsed_time",         "stan_inits", "stan_args", "seed", "out_data", "model_name",         "model_code", "warnings"))    expect_type(catch_out$data_name, "character")    is_date <- function(mydate, date.format = "%d/%m/%y") {        tryCatch(!is.na(as.Date(mydate, date.format, tz = "UTC")),             error = function(err) FALSE)    }    expect_true(is_date(catch_out$ran_at))    expect_equal(dim(catch_out$elapsed_time), c(test_stan_args$chains,         2))    expect_equal(colnames(catch_out$elapsed_time), c("warmup",         "sample"))    expect_type(catch_out$stan_inits, "list")    expect_equal(length(catch_out$stan_inits), 4)    ident <- function(...) {        args <- c(...)        if (length(args) > 2L) {            out <- c(identical(args[1], args[2]), ident(args[-1]))        }        else {            out <- identical(args[1], args[2])        }        return(all(out))    }    expect_true(ident(catch_out$stan_args[[1]]$iter, catch_out$stan_args[[2]]$iter,         catch_out$stan_args[[3]]$iter, catch_out$stan_args[[4]]$iter))    expect_true(ident(catch_out$stan_args[[1]]$thin, catch_out$stan_args[[2]]$thin,         catch_out$stan_args[[3]]$thin, catch_out$stan_args[[4]]$thin))    expect_true(ident(catch_out$stan_args[[1]]$warmup, catch_out$stan_args[[2]]$warmup,         catch_out$stan_args[[3]]$warmup, catch_out$stan_args[[4]]$warmup))    expect_true(ident(catch_out$stan_args[[1]]$init, catch_out$stan_args[[2]]$init,         catch_out$stan_args[[3]]$init, catch_out$stan_args[[4]]$init))    expect_true(ident(catch_out$stan_args[[1]]$algorithm, catch_out$stan_args[[2]]$algorithm,         catch_out$stan_args[[3]]$algorithm, catch_out$stan_args[[4]]$algorithm))    expect_true(ident(catch_out$stan_args[[1]]$check_unknown_args,         catch_out$stan_args[[2]]$check_unknown_args, catch_out$stan_args[[3]]$check_unknown_args,         catch_out$stan_args[[4]]$check_unknown_args))    expect_true(ident(catch_out$stan_args[[1]]$sampling, catch_out$stan_args[[2]]$sampling,         catch_out$stan_args[[3]]$sampling, catch_out$stan_args[[4]]$sampling))    expect_type(catch_out$seed, "integer")    expect_equal(catch_out$model_name, "simtestreg")    expect_type(catch_out$model_code, "character")    expect_true(dir.exists("testdir"))    unlink("testdir", recursive = T)    expect_false(dir.exists("testdir"))})
  38: eval(code, test_env)
  39: eval(code, test_env)
  40: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  41: doTryCatch(return(expr), name, parentenv, handler)
  42: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  43: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  44: doTryCatch(return(expr), name, parentenv, handler)
  45: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  46: tryCatchList(expr, classes, parentenv, handlers)
  47: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  48: test_code(NULL, exprs, env)
  49: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  50: force(code)
  51: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,     {        lister$start_file(basename(path))        source_file(path, new.env(parent = env), chdir = TRUE,             wrap = wrap)        end_context()    })
  52: FUN(X[[i]], ...)
  53: lapply(paths, test_file, env = env, reporter = current_reporter,     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  54: force(code)
  55: with_reporter(reporter = current_reporter, results <- lapply(paths,     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,     load_helpers = FALSE, wrap = wrap))
  56: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,     stop_on_warning = stop_on_warning, wrap = wrap)
  57: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     wrap = wrap)
  58: test_package_dir(package = package, test_path = test_path, filter = filter,     reporter = reporter, ..., stop_on_failure = stop_on_failure,     stop_on_warning = stop_on_warning, wrap = wrap)
  59: test_check("rstansim")
  An irrecoverable exception occurred. R is aborting now ...