Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Skip one more test on macOS#1324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
eddelbuettel merged 3 commits intomasterfrombugfix/arm64_macOS_test
Aug 20, 2024
Merged

Conversation

@eddelbuettel
Copy link
Member

We are seeing an additional (new) failure on macOS and arm64 at r-universe (recent build log). We already skip a number ofNA related tests on that platform so I added one. I cannot test this locally -- anybody reading this who has an arm64 mac and theclang that@jeroen reports, namely

clang --versionApple clang version 15.0.0 (clang-1500.1.0.2.5)Target: arm64-apple-darwin22.6.0Thread model: posixInstalledDir: /Library/Developer/CommandLineTools/usr/bin

Checklist

  • Code compiles correctly
  • R CMD check still passes all tests
  • Preferably, new tests were added which fail without the change
  • Document the changes by file inChangeLog

Copy link
Member

@Enchufa2Enchufa2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Weird. Especially because the max version, right below, seems to work fine.

@eddelbuettel
Copy link
MemberAuthor

eddelbuettel commentedAug 20, 2024
edited
Loading

Do you happen to have suitable hardware to test this? It could well be thatmax now fails too. We could cheat and just merge and let@jeroen's builders take the discovery brunt. (Or we could add a new CI action...)

@Enchufa2
Copy link
Member

No, I don't. There's a Mac at home that I could borrow, but unfortunately it's Intel.

eddelbuettel reacted with thumbs up emoji

@eddelbuettel
Copy link
MemberAuthor

eddelbuettel commentedAug 20, 2024
edited
Loading

We'll find a creative solution.

@jeroen
Copy link
Contributor

jeroen commentedAug 20, 2024
edited
Loading

@Enchufa2 note that this test is not executed for the "release" versions of Rcpp, but only for thex.x.x.x versions so that is why the problem did not surface on CRAN or Debian arm64 machines either. But it has always been there.

I have confirmed manually that when we forceRunAllRcppTests=TRUE then also the CRAN release fails.

if (length(strsplit(packageDescription("Rcpp")$Version,"\\.")[[1]])>3) {# dev rel, and
if (Sys.getenv("RunAllRcppTests")!="no") {# if env.var not yet set
message("Setting\"RunAllRcppTests\"=\"yes\" for development release\n")
Sys.setenv("RunAllRcppTests"="yes")
}
if (Sys.getenv("RunVerboseRcppTests")!="no") {# if env.var not yet set
message("Setting\"RunVerboseRcppTests\"=\"yes\" for development release\n")
Sys.setenv("RunVerboseRcppTests"="yes")
}
}

@eddelbuettel
Copy link
MemberAuthor

Looks like this worked with an additional CI runner for macOS. Yay. (And thanks for the suggestion earlier,@jeroen)

@eddelbuetteleddelbuettel merged commit9db1de4 intomasterAug 20, 2024
@Enchufa2
Copy link
Member

@jeroen Yes, I noted that. I was referring to line 1574, which has a similar test but withintmax instead ofintmin, and the build log at r-universe reports no ERROR for that one.

@eddelbuettel
Copy link
MemberAuthor

Don't we die immediately? So it may not get to that line?

@Enchufa2
Copy link
Member

AFAIK, unless the session aborts or something, everything runs. E.g., put the following into a test file:

library(tinytest)expect_true(FALSE)expect_true(TRUE)expect_true(FALSE)

Then:

$ Rscript -e'tinytest::run_test_file("test.R")'test.R........................    3 tests 2 fails 25ms----- FAILED[data]: test.R<2--2> call| expect_true(FALSE) diff| Expected TRUE, got FALSE ----- FAILED[data]: test.R<4--4> call| expect_true(FALSE) diff| Expected TRUE, got FALSE Showing 2 out of 3 results: 2 fails, 1 passes (25ms)

@eddelbuettel
Copy link
MemberAuthor

Yes you are correct. I think I confused myself mentally comparing with "another popular flavour" for unit tests which we still use in another package that keeps me busy at work.

@kevinushey
Copy link
Contributor

Looking at the sugar code, we try to castR_PosInf to the appropriate storage type here:

R_xlen_t n = obj.size();
if (n ==0)return(static_cast<STORAGE>(R_PosInf));

Distilling this into a smaller example, I used:

#include <Rcpp.h>using namespace Rcpp;// [[Rcpp::export]]SEXP casting_test() {    int value = static_cast<int>(R_PosInf);    return Rf_ScalarInteger(value);}/*** Rcasting_test()*/

On my ARM macOS machine:

$ R -s -e 'Rcpp::sourceCpp("abc.cpp")'> casting_test()[1] 2147483647

And on an x86_64 Docker image:

root@f00a2fde26d3:~/scratch# R -s -e 'Rcpp::sourceCpp("test.cpp")'> casting_test()[1] NA

And some StackOverflow searching suggests that attempting to castINFINITY to an integer is undefined behavior, e.g.https://stackoverflow.com/questions/38795544/is-casting-of-infinity-to-integer-undefined.

To wit -- should we just returnNA here? (if the storage type is notdouble)

@eddelbuettel
Copy link
MemberAuthor

eddelbuettel commentedAug 20, 2024
edited
Loading

Yes. That seems like a bit of logic error / thinko given

>Inf      [1]Inf> as.integer(Inf) [1]NAWarningmessage:NAsintroducedbycoerciontointegerrange>

Should we warn just like R does here?

@kevinushey
Copy link
Contributor

Perhaps... I'm not sure how closely we try to model the base R equivalents in the sugar functions.

It is a little awkward for us thatmin(integer()) returnsInf, which is adouble value, whereas our sugar functions try to preserve the same type. So we're forced to diverge a bit no matter what.

> class(min(integer()))[1] "numeric"Warning message:In min(integer()) : no non-missing arguments to min; returning Inf

@eddelbuettel
Copy link
MemberAuthor

Hoh boy. Isn'tmin(integer()) == Inf a bug? Maybe-Inf ? Hm.

@eddelbuetteleddelbuettel deleted the bugfix/arm64_macOS_test branchAugust 20, 2024 18:14
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@Enchufa2Enchufa2Enchufa2 approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@eddelbuettel@Enchufa2@jeroen@kevinushey

[8]ページ先頭

©2009-2025 Movatter.jp