-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Use locateFile in the dynamic module loader #18382
Conversation
c4b5fdf
to
4a3e598
Compare
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.
Great! Thanks for PR. Just a couple of nits in the test code.
test/test_core.py
Outdated
@needs_dylink | ||
def test_dylink_locate_file(self): | ||
name = 'liblib.so' | ||
with tempfile.TemporaryDirectory() as tmpdir: |
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.
I don't think there is any need to use a random tmpdir here.
How about just doing:`
so_dir = 'so_dir'
os.makedir(so_dir)
Each test already runs inside its own temporary sandbox directory anyway
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.
Sounds good to me. I was trying to clean up after myself but I can see now that tests run in a tmpdir anyway.
4a3e598
to
6481a95
Compare
Make the expected error in test_dlfcn_missing more general to support the addition of using `locateFile` in `loadLibData`.
6481a95
to
8c80559
Compare
With this change, in
loadLibData
the path tolibFile
is passed throughlocateFile
before attempting to download the data from an external source. Fixes #14502.A test for dynamic linking with
locateFile
is added that creates theliblib.so
side module in a temporary directory rather than in the current directory, as default. The side module is linked by passing the full file path toliblib.so
, andlocateFile
is then used to tell Emscripten at runtime where to find the file. The test only passes when the dynamic module loader is indeed able to uselocateFile
to find the side module for loading.