Skip to content

Commit

Permalink
Address build failures on CRAN (#17)
Browse files Browse the repository at this point in the history
* Do not expect a particular error message on MacOS.

* Skip exception throwing tests on Solaris
  • Loading branch information
rstub authored Mar 11, 2019
1 parent 7333922 commit ff3d564
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: dqrng
Type: Package
Title: Fast Pseudo Random Number Generators
Version: 0.1.0
Version: 0.1.1
Authors@R: c(
person("Ralf", "Stubner", email = "ralf.stubner@daqana.com", role = c("aut", "cre")),
person("daqana GmbH", role = "cph"),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# dqrng 0.1.1

* Use template specializations to avoid compiler warnings during tests (Aaron Lun in [#16](https://github.com/daqana/dqrng/pull/16))
* Do not expect a particular error message on MacOS and skip exception throwing tests on Solaris.

# dqrng 0.1.0

## Breaking changes
Expand Down
16 changes: 14 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Bug fix release to address build failures on CRAN:

* On CRAN-MacOS the text given to a C++ exception is not propagated to R. The
tests have been adjusted to not expect a particular error message on MacOS.

* On CRAN-Solaris (at least) one test that intentionally triggers a C++ exception
leads to a segmentation fault. Since I cannot reproduce this behavior
anywhere else, I have disabled exception throwing tests on Solaris.

* Some template specializations where introduced to inhibit (false-positive)
compiler warnings during the tests.

## Test environments
* local: Debian stable with R 3.5
* Travis-CI:
Expand All @@ -10,9 +22,9 @@

0 errors | 0 warnings | 0 notes

The reported UBSAN errors seem to be false posititves, c.f.
The reported UBSAN errors seem to be false positives, c.f.
<https://github.com/RcppCore/Rcpp/issues/832>.

## Reverse dependencies

dqrng currently has no reverse dependencies.
dqrng currently has no reverse dependencies on CRAN.
24 changes: 18 additions & 6 deletions tests/testthat/test-convert.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
context("conversion")

safe_expect_error <- function(..., msg) {
os.type <- Sys.info()["sysname"]
if (os.type == "Darwin") {
expect_error(...)
} else {
expect_error(..., msg)
}
}

Rcpp::sourceCpp("cpp/convert.cpp") # Warnings about shifts can be ignored.

test_that("conversion to 16-bit integers works correctly", {
Expand All @@ -12,10 +21,11 @@ test_that("conversion to 16-bit integers works correctly", {
expect_identical(convert_16(c(0, 0, 65535)), "65535")

# Reports errors.
expect_error(convert_16(-1), "seed element out of range")
expect_error(convert_16(NA_integer_), "seed element out of range")
expect_error(convert_16(65536), "seed element out of range")
expect_error(convert_16(c(1, 0)), "vector implies an out-of-range seed")
skip_on_os("solaris")
safe_expect_error(convert_16(-1), msg = "seed element out of range")
safe_expect_error(convert_16(NA_integer_), msg = "seed element out of range")
safe_expect_error(convert_16(65536), msg = "seed element out of range")
safe_expect_error(convert_16(c(1, 0)), msg = "vector implies an out-of-range seed")
})

test_that("conversion to 32-bit integers works correctly", {
Expand All @@ -30,7 +40,8 @@ test_that("conversion to 32-bit integers works correctly", {
expect_identical(convert_32(c(0, 0, -1)), "4294967295")

# Reports errors.
expect_error(convert_32(c(1, 0)), "vector implies an out-of-range seed")
skip_on_os("solaris")
safe_expect_error(convert_32(c(1, 0)), msg = "vector implies an out-of-range seed")
})

test_that("conversion to 64-bit integers works correctly", {
Expand All @@ -52,7 +63,8 @@ test_that("conversion to 64-bit integers works correctly", {
expect_identical(convert_64(c(-1, -1)), "18446744073709551615")

# Reports errors.
expect_error(convert_64(c(1, 1, 0)), "vector implies an out-of-range seed")
skip_on_os("solaris")
safe_expect_error(convert_64(c(1, 1, 0)), msg = "vector implies an out-of-range seed")
})

test_that("unsigned/signed methods are consistent", {
Expand Down

0 comments on commit ff3d564

Please sign in to comment.