Running ‘testthat.R’ [14s/29s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(cnefetools)
  > 
  > test_check("cnefetools")
  v All 6 CNEFE points were captured within the provided polygon.
  Assuming columns 1 and 2 contain x, y coordinates in EPSG:4326
  v All 5 CNEFE points were captured within the provided polygon.
  [gannet:3528491:0:3529667] Caught signal 11 (Segmentation fault: address not mapped to object at address 0x5)
  ==== backtrace (tid:3529667) ====
   0  /lib64/libucs.so.0(ucs_handle_error+0x2e4) [0x7fe5e0db2df4]
   1  /lib64/libucs.so.0(+0x17aed) [0x7fe5e0db4aed]
   2  /lib64/libucs.so.0(+0x17cbd) [0x7fe5e0db4cbd]
   3  /lib64/libc.so.6(+0x19c30) [0x7fe60d227c30]
   4  /data/gannet/ripley/.local/share/R/duckdb/extensions/v1.4.4/linux_amd64/spatial.duckdb_extension(+0x10ecf30) [0x7fe3b84ecf30]
   5  /data/gannet/ripley/.local/share/R/duckdb/extensions/v1.4.4/linux_amd64/spatial.duckdb_extension(+0x10cbeb8) [0x7fe3b84cbeb8]
   6  /data/gannet/ripley/.local/share/R/duckdb/extensions/v1.4.4/linux_amd64/spatial.duckdb_extension(+0x7d8bb4) [0x7fe3b7bd8bb4]
   7  /data/gannet/ripley/.local/share/R/duckdb/extensions/v1.4.4/linux_amd64/spatial.duckdb_extension(+0x7d7159) [0x7fe3b7bd7159]
   8  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb15ExtensionHelper29LoadExternalExtensionInternalERNS_16DatabaseInstanceERNS_10FileSystemERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERNS_19ExtensionActiveLoadE+0x1b4) [0x7fe4115734a4]
   9  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb15ExtensionHelper21LoadExternalExtensionERNS_16DatabaseInstanceERNS_10FileSystemERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE+0x4a) [0x7fe41157322a]
  10  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZNK6duckdb12PhysicalLoad7GetDataERNS_16ExecutionContextERNS_9DataChunkERNS_19OperatorSourceInputE+0x151) [0x7fe4123a9511]
  11  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb16PipelineExecutor15FetchFromSourceERNS_9DataChunkE+0x9f) [0x7fe412b5e6cf]
  12  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb16PipelineExecutor7ExecuteEm+0x133) [0x7fe412b5b163]
  13  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb12PipelineTask11ExecuteTaskENS_17TaskExecutionModeE+0x15b) [0x7fe412b5addb]
  14  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb12ExecutorTask7ExecuteENS_17TaskExecutionModeE+0xa0) [0x7fe412b546b0]
  15  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(_ZN6duckdb13TaskScheduler14ExecuteForeverEPNSt3__16atomicIbEE+0x379) [0x7fe412b619b9]
  16  /data/gannet/ripley/R/test-clang/duckdb/libs/duckdb.so(+0x196c87c) [0x7fe412b6c87c]
  17  /lib64/libc.so.6(+0x711d4) [0x7fe60d27f1d4]
  18  /lib64/libc.so.6(+0xf3cec) [0x7fe60d301cec]
  =================================
  
   *** caught segfault ***
  address 0x4d20035d72b, cause 'unknown'
  
  Traceback:
   1: rapi_execute(stmt, convert_opts)
   2: withCallingHandlers(expr, condition = function(cnd) {    {        .__handler_frame__. <- TRUE        .__setup_frame__. <- frame        if (inherits(cnd, "message")) {            except <- c("warning", "error")        }        else if (inherits(cnd, "warning")) {            except <- "error"        }        else {            except <- ""        }    }    while (!is_null(cnd)) {        if (inherits(cnd, "error")) {            out <- handlers[[1L]](cnd)            if (!inherits(out, "rlang_zap"))                 throw(out)        }        inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")        if (is_false(inherit)) {            return()        }        cnd <- .subset2(cnd, "parent")    }})
   3: doTryCatch(return(expr), name, parentenv, handler)
   4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
   5: tryCatchList(expr, classes, parentenv, handlers)
   6: tryCatch(withCallingHandlers(expr, condition = function(cnd) {    {        .__handler_frame__. <- TRUE        .__setup_frame__. <- frame        if (inherits(cnd, "message")) {            except <- c("warning", "error")        }        else if (inherits(cnd, "warning")) {            except <- "error"        }        else {            except <- ""        }    }    while (!is_null(cnd)) {        if (inherits(cnd, "error")) {            out <- handlers[[1L]](cnd)            if (!inherits(out, "rlang_zap"))                 throw(out)        }        inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")        if (is_false(inherit)) {            return()        }        cnd <- .subset2(cnd, "parent")    }}), stackOverflowError = handlers[[1L]])
   7: rlang::try_fetch(rapi_execute(stmt, convert_opts), error = function(e) {    rethrow_error_from_rapi(e, call)})
   8: rethrow_rapi_execute(res@stmt_lst$ref, duckdb_convert_opts_impl(res@connection@convert_opts,     arrow = res@arrow))
   9: duckdb_execute(res)
  10: duckdb_result(connection = conn, stmt_lst = stmt_lst, arrow = arrow)
  11: .local(conn, statement, ...)
  12: dbSendQuery(conn, statement, ...)
  13: dbSendQuery(conn, statement, ...)
  14: dbSendStatement(conn, statement, ...)
  15: dbSendStatement(conn, statement, ...)
  16: DBI::dbExecute(con_check, "LOAD spatial;")
  17: DBI::dbExecute(con_check, "LOAD spatial;")
  18: doTryCatch(return(expr), name, parentenv, handler)
  19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  20: tryCatchList(expr, classes, parentenv, handlers)
  21: tryCatch({    DBI::dbExecute(con_check, "LOAD spatial;")    TRUE}, error = function(e) {    tryCatch({        DBI::dbExecute(con_check, "INSTALL spatial; LOAD spatial;")        TRUE    }, error = function(e2) FALSE)})
  22: eval(code, test_env)
  23: eval(code, test_env)
  24: withCallingHandlers({    eval(code, test_env)    new_expectations <- the$test_expectations > starting_expectations    if (snapshot_skipped) {        skip("On CRAN")    }    else if (!new_expectations && skip_on_empty) {        skip_empty()    }}, expectation = handle_expectation, packageNotFoundError = function(e) {    if (on_cran()) {        skip(paste0("{", e$package, "} is not installed."))    }}, snapshot_on_cran = function(cnd) {    snapshot_skipped <<- TRUE    invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message,     error = handle_error, interrupt = handle_interrupt)
  25: doTryCatch(return(expr), name, parentenv, handler)
  26: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  27: tryCatchList(expr, classes, parentenv, handlers)
  28: tryCatch(withCallingHandlers({    eval(code, test_env)    new_expectations <- the$test_expectations > starting_expectations    if (snapshot_skipped) {        skip("On CRAN")    }    else if (!new_expectations && skip_on_empty) {        skip_empty()    }}, expectation = handle_expectation, packageNotFoundError = function(e) {    if (on_cran()) {        skip(paste0("{", e$package, "} is not installed."))    }}, snapshot_on_cran = function(cnd) {    snapshot_skipped <<- TRUE    invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message,     error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
  29: doWithOneRestart(return(expr), restart)
  30: withOneRestart(expr, restarts[[1L]])
  31: withRestarts(tryCatch(withCallingHandlers({    eval(code, test_env)    new_expectations <- the$test_expectations > starting_expectations    if (snapshot_skipped) {        skip("On CRAN")    }    else if (!new_expectations && skip_on_empty) {        skip_empty()    }}, expectation = handle_expectation, packageNotFoundError = function(e) {    if (on_cran()) {        skip(paste0("{", e$package, "} is not installed."))    }}, snapshot_on_cran = function(cnd) {    snapshot_skipped <<- TRUE    invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message,     error = handle_error, interrupt = handle_interrupt), error = handle_fatal),     end_test = function() {    })
  32: test_code(code, parent.frame())
  33: testthat::test_that("tracts_to_h3 returns an sf object with requested variables",     {        testthat::skip_if_not_installed("duckdb")        testthat::skip_if_not_installed("duckspatial")        testthat::skip_if_not_installed("h3jsr")        con_check <- DBI::dbConnect(duckdb::duckdb(), dbdir = ":memory:")        on.exit(DBI::dbDisconnect(con_check, shutdown = TRUE),             add = TRUE)        ok_zipfs <- tryCatch({            DBI::dbExecute(con_check, "LOAD zipfs;")            TRUE        }, error = function(e) {            tryCatch({                DBI::dbExecute(con_check, "INSTALL zipfs; LOAD zipfs;")                TRUE            }, error = function(e2) FALSE)        })        ok_h3 <- tryCatch({            DBI::dbExecute(con_check, "LOAD h3;")            TRUE        }, error = function(e) {            tryCatch({                DBI::dbExecute(con_check, "INSTALL h3; LOAD h3;")                TRUE            }, error = function(e2) FALSE)        })        ok_spatial <- tryCatch({            DBI::dbExecute(con_check, "LOAD spatial;")            TRUE        }, error = function(e) {            tryCatch({                DBI::dbExecute(con_check, "INSTALL spatial; LOAD spatial;")                TRUE            }, error = function(e2) FALSE)        })        if (!ok_zipfs) {            testthat::skip("DuckDB zipfs extension not available.")        }        if (!ok_h3) {            testthat::skip("DuckDB h3 extension not available.")        }        if (!ok_spatial) {            testthat::skip("DuckDB spatial extension not available.")        }        res <- NULL        testthat::with_mocked_bindings({            testthat::expect_message(res <- cnefetools::tracts_to_h3(code_muni = 2927408,                 h3_resolution = 9, vars = c("pop_ph", "avg_inc_resp",                   "n_resp", "female", "age_70m"), cache = TRUE,                 verbose = FALSE), "Dasymetric interpolation diagnostics",                 fixed = TRUE)            testthat::expect_s3_class(res, "sf")            needed <- c("id_hex", "pop_ph", "avg_inc_resp", "n_resp",                 "female", "age_70m")            testthat::expect_true(all(needed %in% names(res)))            timing <- attr(res, "timing", exact = TRUE)            testthat::expect_true(is.list(timing) || is.null(timing))            testthat::expect_true(is.numeric(res$pop_ph))            testthat::expect_gt(sum(res$pop_ph, na.rm = TRUE),                 0)            testthat::expect_equal(round(sum(res$pop_ph, na.rm = TRUE)),                 100)            testthat::expect_true(is.numeric(res$avg_inc_resp) ||                 all(is.na(res$avg_inc_resp)))        }, .sc_create_views_in_duckdb = function(con, code_muni,             cache, verbose) {            DBI::dbExecute(con, "\n        CREATE OR REPLACE VIEW sc_muni AS\n        SELECT\n          '292740800000001' AS code_tract,\n          100::INTEGER AS pop_ph,\n          60::INTEGER  AS female,\n          5::INTEGER   AS age_70m,\n          40::INTEGER  AS n_resp,\n          2000.0::DOUBLE AS avg_inc_resp,\n          ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))') AS geom\n        UNION ALL\n        SELECT\n          '292740800000002' AS code_tract,\n          50::INTEGER  AS pop_ph,\n          20::INTEGER  AS female,\n          2::INTEGER   AS age_70m,\n          10::INTEGER  AS n_resp,\n          3000.0::DOUBLE AS avg_inc_resp,\n          ST_GeomFromText('POLYGON((2 0, 3 0, 3 1, 2 1, 2 0))') AS geom\n      ")        }, .cnefe_create_points_view_in_duckdb = function(con,             code_muni, index, cache, verbose) {            DBI::dbExecute(con, "\n        CREATE OR REPLACE VIEW cnefe_pts AS\n        SELECT\n          1::BIGINT AS COD_UNICO_ENDERECO,\n          1::INTEGER AS COD_ESPECIE,\n          0.2::DOUBLE AS lon,\n          0.2::DOUBLE AS lat,\n          ST_Point(0.2, 0.2) AS geom\n        UNION ALL\n        SELECT 2, 1, 0.2, 0.8, ST_Point(0.2, 0.8)\n        UNION ALL\n        SELECT 3, 1, 0.8, 0.2, ST_Point(0.8, 0.2)\n        UNION ALL\n        SELECT 4, 1, 0.8, 0.8, ST_Point(0.8, 0.8)\n        UNION ALL\n        SELECT 5, 1, 10.0, 10.0, ST_Point(10.0, 10.0)\n      ")        })    })
  34: eval(code, test_env)
  35: eval(code, test_env)
  36: withCallingHandlers({    eval(code, test_env)    new_expectations <- the$test_expectations > starting_expectations    if (snapshot_skipped) {        skip("On CRAN")    }    else if (!new_expectations && skip_on_empty) {        skip_empty()    }}, expectation = handle_expectation, packageNotFoundError = function(e) {    if (on_cran()) {        skip(paste0("{", e$package, "} is not installed."))    }}, snapshot_on_cran = function(cnd) {    snapshot_skipped <<- TRUE    invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message,     error = handle_error, interrupt = handle_interrupt)
  37: doTryCatch(return(expr), name, parentenv, handler)
  38: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  39: tryCatchList(expr, classes, parentenv, handlers)
  40: tryCatch(withCallingHandlers({    eval(code, test_env)    new_expectations <- the$test_expectations > starting_expectations    if (snapshot_skipped) {        skip("On CRAN")    }    else if (!new_expectations && skip_on_empty) {        skip_empty()    }}, expectation = handle_expectation, packageNotFoundError = function(e) {    if (on_cran()) {        skip(paste0("{", e$package, "} is not installed."))    }}, snapshot_on_cran = function(cnd) {    snapshot_skipped <<- TRUE    invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message,     error = handle_error, interrupt = handle_interrupt), error = handle_fatal)
  41: doWithOneRestart(return(expr), restart)
  42: withOneRestart(expr, restarts[[1L]])
  43: withRestarts(tryCatch(withCallingHandlers({    eval(code, test_env)    new_expectations <- the$test_expectations > starting_expectations    if (snapshot_skipped) {        skip("On CRAN")    }    else if (!new_expectations && skip_on_empty) {        skip_empty()    }}, expectation = handle_expectation, packageNotFoundError = function(e) {    if (on_cran()) {        skip(paste0("{", e$package, "} is not installed."))    }}, snapshot_on_cran = function(cnd) {    snapshot_skipped <<- TRUE    invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message,     error = handle_error, interrupt = handle_interrupt), error = handle_fatal),     end_test = function() {    })
  44: test_code(code = exprs, env = env, reporter = get_reporter() %||%     StopReporter$new())
  45: source_file(path, env = env(env), desc = desc, shuffle = shuffle,     error_call = error_call)
  46: FUN(X[[i]], ...)
  47: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle,     error_call = error_call)
  48: doTryCatch(return(expr), name, parentenv, handler)
  49: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  50: tryCatchList(expr, classes, parentenv, handlers)
  51: tryCatch(code, testthat_abort_reporter = function(cnd) {    cat(conditionMessage(cnd), "\n")    NULL})
  52: with_reporter(reporters$multi, lapply(test_paths, test_one_file,     env = env, desc = desc, shuffle = shuffle, error_call = error_call))
  53: test_files_serial(test_dir = test_dir, test_package = test_package,     test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,     env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     desc = desc, load_package = load_package, shuffle = shuffle,     error_call = error_call)
  54: test_files(test_dir = path, test_paths = test_paths, test_package = package,     reporter = reporter, load_helpers = load_helpers, env = env,     stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     load_package = load_package, parallel = parallel, shuffle = shuffle)
  55: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")
  56: test_check("cnefetools")
  An irrecoverable exception occurred. R is aborting now ...