From 9c067a5070f03c9fcd5d8ce5fd1274691b08c9a4 Mon Sep 17 00:00:00 2001 From: Greg Lin Date: Fri, 6 Jan 2023 18:37:52 -0600 Subject: [PATCH] Fix failing test on CRAN's r-devel-linux-x86_64-fedora-clang platform --- NEWS.md | 2 ++ tests/testthat/test-reactable.R | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/NEWS.md b/NEWS.md index a2bee15a..57f23668 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # reactable 0.4.2.9000 (Unreleased) +* Fixed a failing CRAN check on the `r-devel-linux-x86_64-fedora-clang` platform. ([#308](https://github.com/glin/reactable/issues/308)) + # reactable 0.4.2 [Documentation - reactable 0.4.2](https://v0-4-2--reactable-docs.netlify.app/) diff --git a/tests/testthat/test-reactable.R b/tests/testthat/test-reactable.R index bd31a8fc..fa9e5a02 100644 --- a/tests/testthat/test-reactable.R +++ b/tests/testthat/test-reactable.R @@ -1350,6 +1350,22 @@ test_that("static rendering", { # R package using DOWNLOAD_STATIC_LIBV8=true. # https://github.com/jeroen/V8/issues/65 # https://bugzilla.redhat.com/show_bug.cgi?id=1755114 + # + # On CRAN's fedora-clang platform, where V8 is installed with g++ and not clang, all + # uncaught exceptions cause V8 to seg fault, which causes this check and other error handling + # tests to fail. Skip all tests if running on a platform with this issue. + # See notes on CRAN's fedora-clang platform: https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-clang + # + # The test for the uncaught exception seg fault must be run in a separate R process. + # If a seg fault occurs, the output is typically: "free(): double free detected in tcache 2" + code <- "V8::new_context()$eval('not_defined')" + output <- suppressWarnings( + system2(R.home("bin/R"), c("-e", shQuote(code)), stdout = TRUE, stderr = TRUE) + ) + if (attr(output, "status") > 0 && !grepl("ReferenceError", paste(output, collapse = "\n"))) { + skip(sprintf("V8 crashed on an uncaught exception, unable to run error handling tests.\nThis is probably V8 installed with g++ on fedora-clang. Test output:\n%s", paste(output, collapse = "\n"))) + } + tryCatch({ V8::new_context()$eval("''.localeCompare('')") }, error = function(e) {