-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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] prevent symbol lookup conflicts (fixes #4045) #4155
Merged
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7cb47d0
[R-package] prevent symbol lookup conflicts
jameslamb 791cf6c
add unit tests
jameslamb f2a584e
only run test on Windows
jameslamb cc3e6fc
Merge branch 'fix/r-registration' of github.com:microsoft/LightGBM
jameslamb 8ed693a
Merge branch 'master' of github.com:microsoft/LightGBM
jameslamb e7b254d
Merge branch 'master' of github.com:microsoft/LightGBM
jameslamb 6668390
move to .Call() calls
jameslamb a2ccac5
fix references
jameslamb f89aa2c
testing registration for CMake builds
jameslamb 2d8de84
revert NAMESPACE changes
jameslamb 42d01c8
revert testing changes
jameslamb d70071c
Merge branch 'master' into fix/r-registration
jameslamb ad229c7
Merge branch 'master' into fix/r-registration
jameslamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ON_WINDOWS <- .Platform$OS.type == "windows" | ||
|
||
# this test is used to catch silent errors in routine registration, | ||
# like the one documented in | ||
# https://github.com/microsoft/LightGBM/issues/4045#issuecomment-812289182 | ||
test_that("lightgbm routine registration worked", { | ||
testthat::skip_if_not(ON_WINDOWS) | ||
|
||
dll_info <- getLoadedDLLs()[["lightgbm"]] | ||
|
||
# check that dynamic lookup has been disabled | ||
expect_false(dll_info[["dynamicLookup"]]) | ||
|
||
# check that all the expected symbols show up | ||
registered_routines <- getDLLRegisteredRoutines(dll_info[["path"]])[[".Call"]] | ||
expect_gt(length(registered_routines), 20L) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
skip_if_not()
is to work around this error I saw on Linux jobs in CIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah! The problem with this test isn't actually about operating system. This test will fail with an error like the one above on LightGBM's CMake-based builds and pass on CRAN builds. That's because, by using
install.libs.R
to buildlib_lightgbm
instead of R's built-in machinery, the routine registration stuff doesn't work.Given that as of this PR the package will now use literal R symbols (e.g.
.Call(LGBM_BoosterGetCurrentIteration_R,...
), I don't think this test is necessary. Any failures in the registration will result in "object not found errors".I'm going to remove this test, and will provide more explanation in a separate comment for how to make this work with CMake-based builds.