Skip to content

Commit

Permalink
rephrase nixlib test compilation messages
Browse files Browse the repository at this point in the history
update tests
  • Loading branch information
assignUser committed Nov 30, 2023
1 parent 9e9cead commit a7eb7d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions r/tools/nixlibs.R
Original file line number Diff line number Diff line change
Expand Up @@ -295,32 +295,32 @@ determine_binary_from_stderr <- function(errs) {
if (is.null(attr(errs, "status"))) {
# There was no error in compiling: so we found libcurl and OpenSSL >= 1.1,
# openssl is < 3.0
lg("Found libcurl and OpenSSL >= 1.1")
lg("Found headers for libcurl and OpenSSL >= 1.1")
return("openssl-1.1")
# Else, check for dealbreakers:
} else if (!on_macos && any(grepl("Using libc++", errs, fixed = TRUE))) {
# Our linux binaries are all built with GNU stdlib so they fail with libc++
lg("Linux binaries incompatible with libc++")
return(NULL)
} else if (header_not_found("curl/curl", errs)) {
lg("libcurl not found")
lg("Headers for libcurl not found")
return(NULL)
} else if (header_not_found("openssl/opensslv", errs)) {
lg("OpenSSL not found")
lg("Headers for OpenSSL not found")
return(NULL)
} else if (any(grepl("OpenSSL version too old", errs))) {
lg("OpenSSL found but version >= 1.0.2 is required for some features")
lg("Headers for OpenSSL found but version >= 1.0.2 is required for some features")
return(NULL)
# Else, determine which other binary will work
} else if (any(grepl("Using OpenSSL version 1.0", errs))) {
if (on_macos) {
lg("OpenSSL 1.0 is not supported on macOS")
return(NULL)
}
lg("Found libcurl and OpenSSL < 1.1")
lg("Found headers for libcurl and OpenSSL < 1.1")
return("openssl-1.0")
} else if (any(grepl("Using OpenSSL version 3", errs))) {
lg("Found libcurl and OpenSSL >= 3.0.0")
lg("Found headers for libcurl and OpenSSL >= 3.0.0")
return("openssl-3.0")
}
NULL
Expand Down
20 changes: 10 additions & 10 deletions r/tools/test-nixlibs.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test_that("determine_binary_from_stderr", {
determine_binary_from_stderr(compile_test_program("int a;")),
"openssl-1.1"
),
"Found libcurl and OpenSSL >= 1.1"
"Found headers for libcurl and OpenSSL >= 1.1"
)

nixlibs_env$on_macos <- FALSE
Expand All @@ -61,7 +61,7 @@ test_that("determine_binary_from_stderr", {
determine_binary_from_stderr(compile_test_program("#error Using OpenSSL version 1.0")),
"openssl-1.0"
),
"Found libcurl and OpenSSL < 1.1"
"Found headers for libcurl and OpenSSL < 1.1"
)
nixlibs_env$on_macos <- TRUE
expect_output(
Expand All @@ -75,7 +75,7 @@ test_that("determine_binary_from_stderr", {
determine_binary_from_stderr(compile_test_program("#error Using OpenSSL version 3")),
"openssl-3.0"
),
"Found libcurl and OpenSSL >= 3.0.0"
"Found headers for libcurl and OpenSSL >= 3.0.0"
)
expect_output(
expect_null(
Expand All @@ -92,50 +92,50 @@ test_that("select_binary() with test program", {
select_binary("linux", "x86_64", "int a;"),
"linux-openssl-1.1"
),
"Found libcurl and OpenSSL >= 1.1"
"Found headers for libcurl and OpenSSL >= 1.1"
)
expect_output(
expect_identical(
select_binary("linux", "x86_64", "#error Using OpenSSL version 1.0"),
"linux-openssl-1.0"
),
"Found libcurl and OpenSSL < 1.1"
"Found headers for libcurl and OpenSSL < 1.1"
)
expect_output(
expect_identical(
select_binary("linux", "x86_64", "#error Using OpenSSL version 3"),
"linux-openssl-3.0"
),
"Found libcurl and OpenSSL >= 3.0.0"
"Found headers for libcurl and OpenSSL >= 3.0.0"
)
nixlibs_env$on_macos <- TRUE
expect_output(
expect_identical(
select_binary("darwin", "x86_64", "int a;"),
"darwin-x86_64-openssl-1.1"
),
"Found libcurl and OpenSSL >= 1.1"
"Found headers for libcurl and OpenSSL >= 1.1"
)
expect_output(
expect_identical(
select_binary("darwin", "x86_64", "#error Using OpenSSL version 3"),
"darwin-x86_64-openssl-3.0"
),
"Found libcurl and OpenSSL >= 3.0.0"
"Found headers for libcurl and OpenSSL >= 3.0.0"
)
expect_output(
expect_identical(
select_binary("darwin", "arm64", "int a;"),
"darwin-arm64-openssl-1.1"
),
"Found libcurl and OpenSSL >= 1.1"
"Found headers for libcurl and OpenSSL >= 1.1"
)
expect_output(
expect_identical(
select_binary("darwin", "arm64", "#error Using OpenSSL version 3"),
"darwin-arm64-openssl-3.0"
),
"Found libcurl and OpenSSL >= 3.0.0"
"Found headers for libcurl and OpenSSL >= 3.0.0"
)
expect_output(
expect_null(
Expand Down

0 comments on commit a7eb7d5

Please sign in to comment.