Skip to content

Commit 4a26f7e

Browse files
authored
Accommodate NA behavior on arm64/aarch64 for Linux as well (#1379)
* Accommodate arm64 linux tests in continuous integration * Print Sys.info() and .Platform to double check * And of course arm64 == aarch64 on leenucks * Use a single bigger hammer with one isArm predicate * Check for arm-linux in new yaml, macos.yaml back to mac only * Update NEWS.Rd [ci skip]
1 parent 130ec69 commit 4a26f7e

File tree

5 files changed

+62
-12
lines changed

5 files changed

+62
-12
lines changed

.github/workflows/linuxarm.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Run CI for R using https://eddelbuettel.github.io/r-ci/
2+
3+
name: linuxarm
4+
5+
on:
6+
#push:
7+
#pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
_R_CHECK_FORCE_SUGGESTS_: "false"
12+
13+
jobs:
14+
ci:
15+
strategy:
16+
matrix:
17+
include:
18+
#- {os: ubuntu-latest}
19+
- {os: ubuntu-24.04-arm}
20+
21+
runs-on: ${{ matrix.os }}
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup
28+
uses: eddelbuettel/github-actions/r-ci@master
29+
30+
- name: Dependencies
31+
run: ./run.sh install_deps
32+
33+
- name: Test
34+
run: ./run.sh run_tests
35+
36+
#- name: Coverage
37+
# if: ${{ matrix.os == 'ubuntu-latest' }}
38+
# run: ./run.sh coverage

.github/workflows/macos.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- {os: macos-latest}
1818
- {os: macos-13}
1919
#- {os: ubuntu-latest}
20+
#- {os: ubuntu-24.04-arm}
2021

2122
runs-on: ${{ matrix.os }}
2223

ChangeLog

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2025-05-05 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/tinytest/test_sugar.R: Condition four NA-related tests away on
4+
arm64 on Linux too
5+
6+
* .github/workflows/linuxarm.yaml (jobs): Add ubuntu-24.04-arm as
7+
optional workflow_dispatch run
8+
19
2025-04-15 Dirk Eddelbuettel <[email protected]>
210

311
* docker/ci-4.4/Dockerfile: Added based on r-base:4.4.3

inst/NEWS.Rd

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
\itemize{
3434
\item \code{Rcpp.package.skeleton()} creates \sQuote{URL} and
3535
\sQuote{BugReports} if given a GitHub username (Dirk in \ghpr{1358})
36+
\item Tests involving NA propagation are skipped under linux-arm64 as
37+
they are under macos-arm (Dirk in \ghpr{1379} closing \ghit{1378})
3638
}
3739
}
3840
}

inst/tinytest/test_sugar.R

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
## Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
2+
## Copyright (C) 2010 - 2025 Dirk Eddelbuettel and Romain Francois
33
## Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
44
##
55
## This file is part of Rcpp.
@@ -23,7 +23,8 @@ Rcpp::sourceCpp("cpp/sugar.cpp")
2323

2424
## There are some (documented, see https://blog.r-project.org/2020/11/02/will-r-work-on-apple-silicon/index.html)
2525
## issues with NA propagation on arm64 / macOS. We not (yet ?) do anything special so we just skip some tests
26-
isArmMacOs <- Sys.info()[["sysname"]] == "Darwin" && Sys.info()[["machine"]] == "arm64"
26+
## This also seems to hit arm64 on Linux (aka 'aarch64' here)
27+
isArm <- Sys.info()[["machine"]] == "arm64" || Sys.info()[["machine"]] == "aarch64"
2728

2829
## Needed for a change in R 3.6.0 reducing a bias in very large samples
2930
suppressWarnings(RNGversion("3.5.0"))
@@ -36,8 +37,8 @@ expect_equal( runit_abs(x,y) , list( abs(x), abs(y) ) )
3637
# test.sugar.all.one.less <- function( ){
3738
expect_true( runit_all_one_less( 1 ) )
3839
expect_true( ! runit_all_one_less( 1:10 ) )
39-
if (!isArmMacOs) expect_true( is.na( runit_all_one_less( NA ) ) )
40-
if (!isArmMacOs) expect_true( is.na( runit_all_one_less( c( NA, 1) ) ) )
40+
if (!isArm) expect_true( is.na( runit_all_one_less( NA ) ) )
41+
if (!isArm) expect_true( is.na( runit_all_one_less( c( NA, 1) ) ) )
4142
expect_true( ! runit_all_one_less( c( 6, NA) ) )
4243

4344

@@ -46,14 +47,14 @@ expect_true( ! runit_all_one_greater( 1 ) )
4647
expect_true( ! runit_all_one_greater( 1:10 ) )
4748
expect_true( runit_all_one_greater( 6:10 ) )
4849
expect_true( ! runit_all_one_greater( c(NA, 1) ) )
49-
if (!isArmMacOs) expect_true( is.na( runit_all_one_greater( c(NA, 6) ) ) )
50+
if (!isArm) expect_true( is.na( runit_all_one_greater( c(NA, 6) ) ) )
5051

5152

5253
# test.sugar.all.one.less.or.equal <- function( ){
5354
expect_true( runit_all_one_less_or_equal( 1 ) )
5455
expect_true( ! runit_all_one_less_or_equal( 1:10 ) )
55-
if (!isArmMacOs) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
56-
if (!isArmMacOs) expect_true( is.na( runit_all_one_less_or_equal( c( NA, 1) ) ) )
56+
if (!isArm) expect_true( is.na( runit_all_one_less_or_equal( NA ) ) )
57+
if (!isArm) expect_true( is.na( runit_all_one_less_or_equal( c( NA, 1) ) ) )
5758
expect_true( ! runit_all_one_less_or_equal( c( 6, NA) ) )
5859
expect_true( runit_all_one_less_or_equal( 5 ) )
5960

@@ -66,15 +67,15 @@ expect_true( ! fx( 1:10 ) )
6667
expect_true( fx( 6:10 ) )
6768
expect_true( fx( 5 ) )
6869
expect_true( ! fx( c(NA, 1) ) )
69-
if (!isArmMacOs) expect_true( is.na( fx( c(NA, 6) ) ) )
70+
if (!isArm) expect_true( is.na( fx( c(NA, 6) ) ) )
7071

7172

7273
# test.sugar.all.one.equal <- function( ){
7374
fx <- runit_all_one_equal
7475
expect_true( ! fx( 1 ) )
7576
expect_true( ! fx( 1:2 ) )
7677
expect_true( fx( rep(5,4) ) )
77-
if (!isArmMacOs) expect_true( is.na( fx( c(5,NA) ) ) )
78+
if (!isArm) expect_true( is.na( fx( c(5,NA) ) ) )
7879
expect_true(! fx( c(NA, 1) ) )
7980

8081

@@ -83,7 +84,7 @@ fx <- runit_all_not_equal_one
8384
expect_true( fx( 1 ) )
8485
expect_true( fx( 1:2 ) )
8586
expect_true( ! fx( 5 ) )
86-
if (!isArmMacOs) expect_true( is.na( fx( c(NA, 1) ) ) )
87+
if (!isArm) expect_true( is.na( fx( c(NA, 1) ) ) )
8788
expect_true( ! fx( c(NA, 5) ) )
8889

8990

@@ -1620,8 +1621,8 @@ expect_error(strimws(x[1], "invalid"), info = "strimws -- bad `which` argument")
16201621
## min/max
16211622
# test.sugar.min.max <- function() {
16221623
## min(empty) gives NA for integer, Inf for numeric (#844)
1623-
if (!isArmMacOs) expect_true(is.na(intmin(integer(0))), "min(integer(0))")
1624-
if (!isArmMacOs) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))")
1624+
if (!isArm) expect_true(is.na(intmin(integer(0))), "min(integer(0))")
1625+
if (!isArm) expect_equal(doublemin(numeric(0)), Inf, info = "min(numeric(0))")
16251626

16261627
## max(empty_ gives NA for integer, Inf for numeric (#844)
16271628
expect_true(is.na(intmax(integer(0))), "max(integer(0))")

0 commit comments

Comments
 (0)