Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-package] [ci] unit test failures don't cause MSVC CI jobs to fail #5439

Closed
jameslamb opened this issue Aug 25, 2022 · 2 comments · Fixed by #5448
Closed

[R-package] [ci] unit test failures don't cause MSVC CI jobs to fail #5439

jameslamb opened this issue Aug 25, 2022 · 2 comments · Fixed by #5448

Comments

@jameslamb
Copy link
Collaborator

Description

The R-package CI jobs which compile the library with CMake + MSVC do not fail if the R package's unit tests fail.

  • r-package (windows-2019, MSVC, R 3.6, cmake)
  • r-package (windows-2022, MSVC, R 4.1, cmake)

Reproducible example

I noticed this while looking at test failures on #5437 (build link), but I suspect that this would happen for any change that causes the R unit tests to fail.

For example, I suspect (haven't confirmed) that adding something like that following anywhere in an R test case would reproduce this issue.

stop("intentionally failing")

Screen Shot 2022-08-25 at 12 05 55 AM

But at the end of the tests, I see logs like the following.

Error: Test failures
Execution halted

== Failed ======================================================================
-- 1. Failure (test_basic.R:93:3): train and predict binary classification
...
-- 10. Failure (test_basic.R:3190:5): lgb.train() only prints eval metrics when 

Maximum number of 10 failures reached, some test results may be missing.

Additional Comments

I haven't investigated this much yet, just creating this issue so it isn't forgotten.

@jameslamb jameslamb changed the title [R-package] [ci] unit test failure don't cause MSVC CI jobs to fail [R-package] [ci] unit test failures don't cause MSVC CI jobs to fail Aug 25, 2022
@jameslamb
Copy link
Collaborator Author

I tried to reproduce the relevant code on my Mac tonight.

function Run-R-Code-Redirect-Stderr {
param(
[string]$rcode
)
$decorated_code = "out_file <- file(tempfile(), open = 'wt'); sink(out_file, type = 'message'); $rcode; sink()"
Rscript --vanilla -e $decorated_code
}

if ($env:COMPILER -eq "MSVC") {
Write-Output "Running tests with testthat.R"
cd R-package/tests
Run-R-Code-Redirect-Stderr "source('testthat.R')" ; Check-Output $?
}

Like this:

cd R-package/tests
Rscript \
    --vanilla \
    -e "out_file <- file(tempfile(), open = 'wt'); sink(out_file, type = 'message'); source('testthat.R'); sink()"

And saw that a non-0 exit code was raised as expected

echo $?
# 1

That is evidence that this might be something specific to Windows, and not a generic problem with the pattern of using Rscript -e "source('testthat.R')" to run the tests.

Will open a draft PR to test some approaches.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant