From 8ae27816e804fe53ec6e6619ec1e8b13a5639a15 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 May 2025 06:26:36 -0500 Subject: [PATCH 1/6] Accommodate arm64 linux tests in continuous integration --- .github/workflows/macos.yaml | 1 + ChangeLog | 7 +++++++ inst/tinytest/test_sugar.R | 12 +++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 40c40340a..41564dd67 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -17,6 +17,7 @@ jobs: - {os: macos-latest} - {os: macos-13} #- {os: ubuntu-latest} + - {os: ubuntu-24.04-arm} runs-on: ${{ matrix.os }} diff --git a/ChangeLog b/ChangeLog index 413439bf6..6a00c1dd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-05-05 Dirk Eddelbuettel + + * inst/tinytest/test_sugar.R: Condition four NA-related tests away on + arm64 on Linux too + + * .github/workflows/macos.yaml (jobs): Add ubuntu-24.04-arm to matrix + 2025-04-15 Dirk Eddelbuettel * docker/ci-4.4/Dockerfile: Added based on r-base:4.4.3 diff --git a/inst/tinytest/test_sugar.R b/inst/tinytest/test_sugar.R index 44549d95f..95f63ad8e 100644 --- a/inst/tinytest/test_sugar.R +++ b/inst/tinytest/test_sugar.R @@ -1,5 +1,5 @@ -## Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2010 - 2025 Dirk Eddelbuettel and Romain Francois ## Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and IƱaki Ucar ## ## This file is part of Rcpp. @@ -24,6 +24,8 @@ Rcpp::sourceCpp("cpp/sugar.cpp") ## There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html) ## issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests isArmMacOs <- Sys.info()[["sysname"]] == "Darwin" && Sys.info()[["machine"]] == "arm64" +## This also seems to hit arm64 on Linux +isArmLinux <- Sys.info()[["sysname"]] == "Linux" && Sys.info()[["machine"]] == "arm64" ## Needed for a change in R 3.6.0 reducing a bias in very large samples suppressWarnings(RNGversion("3.5.0")) @@ -66,7 +68,7 @@ expect_true( ! fx( 1:10 ) ) expect_true( fx( 6:10 ) ) expect_true( fx( 5 ) ) expect_true( ! fx( c(NA, 1) ) ) -if (!isArmMacOs) expect_true( is.na( fx( c(NA, 6) ) ) ) +if (!isArmMacOs && !isArmLinux) expect_true( is.na( fx( c(NA, 6) ) ) ) # test.sugar.all.one.equal <- function( ){ @@ -74,7 +76,7 @@ fx <- runit_all_one_equal expect_true( ! fx( 1 ) ) expect_true( ! fx( 1:2 ) ) expect_true( fx( rep(5,4) ) ) -if (!isArmMacOs) expect_true( is.na( fx( c(5,NA) ) ) ) +if (!isArmMacOs && !isArmLinux) expect_true( is.na( fx( c(5,NA) ) ) ) expect_true(! fx( c(NA, 1) ) ) @@ -83,7 +85,7 @@ fx <- runit_all_not_equal_one expect_true( fx( 1 ) ) expect_true( fx( 1:2 ) ) expect_true( ! fx( 5 ) ) -if (!isArmMacOs) expect_true( is.na( fx( c(NA, 1) ) ) ) +if (!isArmMacOs && !isArmLinux) expect_true( is.na( fx( c(NA, 1) ) ) ) expect_true( ! fx( c(NA, 5) ) ) @@ -1620,7 +1622,7 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument") ## min/max # test.sugar.min.max <- function() { ## min(empty) gives NA for integer, Inf for numeric (#844) -if (!isArmMacOs) expect_true(is.na(intmin(integer(0))), "min(integer(0))") +if (!isArmMacOs && !isArmLinux) expect_true(is.na(intmin(integer(0))), "min(integer(0))") if (!isArmMacOs) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))") ## max(empty_ gives NA for integer, Inf for numeric (#844) From f8be28ca9c7151d4e2016c01ef525ba9834c928f Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 May 2025 06:42:55 -0500 Subject: [PATCH 2/6] Print Sys.info() and .Platform to double check --- .github/workflows/macos.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 41564dd67..4c56e7e1b 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -28,6 +28,9 @@ jobs: - name: Setup uses: eddelbuettel/github-actions/r-ci@master + - name: Sys.info + run: Rscript -e 'print(Sys.info()); print(.Platform)' + - name: Dependencies run: ./run.sh install_deps From 099dd73be62f39ef49cd9e52c1a0aa48c5247250 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 May 2025 06:46:58 -0500 Subject: [PATCH 3/6] And of course arm64 == aarch64 on leenucks --- .github/workflows/macos.yaml | 3 --- inst/tinytest/test_sugar.R | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 4c56e7e1b..41564dd67 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -28,9 +28,6 @@ jobs: - name: Setup uses: eddelbuettel/github-actions/r-ci@master - - name: Sys.info - run: Rscript -e 'print(Sys.info()); print(.Platform)' - - name: Dependencies run: ./run.sh install_deps diff --git a/inst/tinytest/test_sugar.R b/inst/tinytest/test_sugar.R index 95f63ad8e..16db89689 100644 --- a/inst/tinytest/test_sugar.R +++ b/inst/tinytest/test_sugar.R @@ -24,8 +24,8 @@ Rcpp::sourceCpp("cpp/sugar.cpp") ## There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html) ## issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests isArmMacOs <- Sys.info()[["sysname"]] == "Darwin" && Sys.info()[["machine"]] == "arm64" -## This also seems to hit arm64 on Linux -isArmLinux <- Sys.info()[["sysname"]] == "Linux" && Sys.info()[["machine"]] == "arm64" +## This also seems to hit arm64 on Linux (aka 'aarch64' here) +isArmLinux <- Sys.info()[["sysname"]] == "Linux" && Sys.info()[["machine"]] == "aarch64" ## Needed for a change in R 3.6.0 reducing a bias in very large samples suppressWarnings(RNGversion("3.5.0")) From a4bdd7d88dc071c107f0c253fb5bd7858ca101f5 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 May 2025 07:06:04 -0500 Subject: [PATCH 4/6] Use a single bigger hammer with one isArm predicate --- inst/tinytest/test_sugar.R | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/inst/tinytest/test_sugar.R b/inst/tinytest/test_sugar.R index 16db89689..c6b5e3961 100644 --- a/inst/tinytest/test_sugar.R +++ b/inst/tinytest/test_sugar.R @@ -23,9 +23,8 @@ Rcpp::sourceCpp("cpp/sugar.cpp") ## There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html) ## issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests -isArmMacOs <- Sys.info()[["sysname"]] == "Darwin" && Sys.info()[["machine"]] == "arm64" ## This also seems to hit arm64 on Linux (aka 'aarch64' here) -isArmLinux <- Sys.info()[["sysname"]] == "Linux" && Sys.info()[["machine"]] == "aarch64" +isArm <- Sys.info()[["machine"]] == "arm64" || Sys.info()[["machine"]] == "aarch64" ## Needed for a change in R 3.6.0 reducing a bias in very large samples suppressWarnings(RNGversion("3.5.0")) @@ -38,8 +37,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) ) # test.sugar.all.one.less <- function( ){ expect_true( runit_all_one_less( 1 ) ) expect_true( ! runit_all_one_less( 1:10 ) ) -if (!isArmMacOs) expect_true( is.na( runit_all_one_less( NA ) ) ) -if (!isArmMacOs) expect_true( is.na( runit_all_one_less( c( NA, 1) ) ) ) +if (!isArm) expect_true( is.na( runit_all_one_less( NA ) ) ) +if (!isArm) expect_true( is.na( runit_all_one_less( c( NA, 1) ) ) ) expect_true( ! runit_all_one_less( c( 6, NA) ) ) @@ -48,14 +47,14 @@ expect_true( ! runit_all_one_greater( 1 ) ) expect_true( ! runit_all_one_greater( 1:10 ) ) expect_true( runit_all_one_greater( 6:10 ) ) expect_true( ! runit_all_one_greater( c(NA, 1) ) ) -if (!isArmMacOs) expect_true( is.na( runit_all_one_greater( c(NA, 6) ) ) ) +if (!isArm) expect_true( is.na( runit_all_one_greater( c(NA, 6) ) ) ) # test.sugar.all.one.less.or.equal <- function( ){ expect_true( runit_all_one_less_or_equal( 1 ) ) expect_true( ! runit_all_one_less_or_equal( 1:10 ) ) -if (!isArmMacOs) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) ) -if (!isArmMacOs) expect_true( is.na( runit_all_one_less_or_equal( c( NA, 1) ) ) ) +if (!isArm) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) ) +if (!isArm) expect_true( is.na( runit_all_one_less_or_equal( c( NA, 1) ) ) ) expect_true( ! runit_all_one_less_or_equal( c( 6, NA) ) ) expect_true( runit_all_one_less_or_equal( 5 ) ) @@ -68,7 +67,7 @@ expect_true( ! fx( 1:10 ) ) expect_true( fx( 6:10 ) ) expect_true( fx( 5 ) ) expect_true( ! fx( c(NA, 1) ) ) -if (!isArmMacOs && !isArmLinux) expect_true( is.na( fx( c(NA, 6) ) ) ) +if (!isArm) expect_true( is.na( fx( c(NA, 6) ) ) ) # test.sugar.all.one.equal <- function( ){ @@ -76,7 +75,7 @@ fx <- runit_all_one_equal expect_true( ! fx( 1 ) ) expect_true( ! fx( 1:2 ) ) expect_true( fx( rep(5,4) ) ) -if (!isArmMacOs && !isArmLinux) expect_true( is.na( fx( c(5,NA) ) ) ) +if (!isArm) expect_true( is.na( fx( c(5,NA) ) ) ) expect_true(! fx( c(NA, 1) ) ) @@ -85,7 +84,7 @@ fx <- runit_all_not_equal_one expect_true( fx( 1 ) ) expect_true( fx( 1:2 ) ) expect_true( ! fx( 5 ) ) -if (!isArmMacOs && !isArmLinux) expect_true( is.na( fx( c(NA, 1) ) ) ) +if (!isArm) expect_true( is.na( fx( c(NA, 1) ) ) ) expect_true( ! fx( c(NA, 5) ) ) @@ -1622,8 +1621,8 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument") ## min/max # test.sugar.min.max <- function() { ## min(empty) gives NA for integer, Inf for numeric (#844) -if (!isArmMacOs && !isArmLinux) expect_true(is.na(intmin(integer(0))), "min(integer(0))") -if (!isArmMacOs) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))") +if (!isArm) expect_true(is.na(intmin(integer(0))), "min(integer(0))") +if (!isArm) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))") ## max(empty_ gives NA for integer, Inf for numeric (#844) expect_true(is.na(intmax(integer(0))), "max(integer(0))") From cf8da0d10ccd4ea64a7a62cf144d89113fc15dad Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 May 2025 11:37:29 -0500 Subject: [PATCH 5/6] Check for arm-linux in new yaml, macos.yaml back to mac only --- .github/workflows/linuxarm.yaml | 38 +++++++++++++++++++++++++++++++++ .github/workflows/macos.yaml | 2 +- ChangeLog | 3 ++- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/linuxarm.yaml diff --git a/.github/workflows/linuxarm.yaml b/.github/workflows/linuxarm.yaml new file mode 100644 index 000000000..fa328c13b --- /dev/null +++ b/.github/workflows/linuxarm.yaml @@ -0,0 +1,38 @@ +# Run CI for R using https://eddelbuettel.github.io/r-ci/ + +name: linuxarm + +on: + #push: + #pull_request: + workflow_dispatch: + +env: + _R_CHECK_FORCE_SUGGESTS_: "false" + +jobs: + ci: + strategy: + matrix: + include: + #- {os: ubuntu-latest} + - {os: ubuntu-24.04-arm} + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: eddelbuettel/github-actions/r-ci@master + + - name: Dependencies + run: ./run.sh install_deps + + - name: Test + run: ./run.sh run_tests + + #- name: Coverage + # if: ${{ matrix.os == 'ubuntu-latest' }} + # run: ./run.sh coverage diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 41564dd67..5bce62802 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -17,7 +17,7 @@ jobs: - {os: macos-latest} - {os: macos-13} #- {os: ubuntu-latest} - - {os: ubuntu-24.04-arm} + #- {os: ubuntu-24.04-arm} runs-on: ${{ matrix.os }} diff --git a/ChangeLog b/ChangeLog index 6a00c1dd4..efa6a87b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,8 @@ * inst/tinytest/test_sugar.R: Condition four NA-related tests away on arm64 on Linux too - * .github/workflows/macos.yaml (jobs): Add ubuntu-24.04-arm to matrix + * .github/workflows/linuxarm.yaml (jobs): Add ubuntu-24.04-arm as + optional workflow_dispatch run 2025-04-15 Dirk Eddelbuettel From 649688b93561ff3778f9006c7ce58768455273d1 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 May 2025 11:52:32 -0500 Subject: [PATCH 6/6] Update NEWS.Rd [ci skip] --- inst/NEWS.Rd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 2b1d9a3e6..d8f4ebe0b 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -33,6 +33,8 @@ \itemize{ \item \code{Rcpp.package.skeleton()} creates \sQuote{URL} and \sQuote{BugReports} if given a GitHub username (Dirk in \ghpr{1358}) + \item Tests involving NA propagation are skipped under linux-arm64 as + they are under macos-arm (Dirk in \ghpr{1379} closing \ghit{1378}) } } }