-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
test() dependencies not added to PATH #4668
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
Comments
The problem is you having a layout like: and mod.py needs foo.dll? |
yes test() -> foo.py -> bar.pyd -> subproject/baz/baz.dll |
I don't believe there is a robust solution for this ATM. if you only need dll's out of one directory you can probably use the |
I wonder if we could use an |
We already have the machinery to do this when you pass a build target or a custom target as an argument to a test; we should just do the same when you pass one of those to |
We’re hitting this in GLib too, where we have some tests written in Python, which then spawn a native binary in the builddir when they’re run. The native built binary is correctly listed in For the moment I’ve copied Christoph’s workaround, as fixing and testing Meson issues on Windows is not something I’m set up to do (sorry). Mentioning it here so the use case of running a native built binary from a Python unit test is recorded somewhere, as it’s slightly different from Christoph’s original case of a built Python module. |
Rather than iterating over t.cmd_args, iterate over the function-local depends variable. This set is constructed from all of t.depends and t.cmd_args that are Targets or CustomTargetIndex. Fixes mesonbuild#4668
This works around a Meson bug (mesonbuild/meson#4668). If we have a Python test which spawns a built native binary, that binary is listed in the `depends` argument of the `test()`. On Linux, this results in the directories containing the built libraries which the binary depends on being added to the `LD_LIBRARY_PATH` of the test invocation. On Windows, however, Meson currently doesn’t add those directories to `PATH` (which is the equivalent of `LD_LIBRARY_PATH`), so we have to do it manually. This takes the same approach as Christoph Reiter did in gobject-introspection (https://gitlab.gnome.org/GNOME/gobject-introspection/blob/13e8c7ff80f9ff2dc77e9d0da4b7396182c63612/tests/meson.build#L2). Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Uh oh!
There was an error while loading. Please reload this page.
Hey, support question:
(context: https://gitlab.gnome.org/GNOME/gobject-introspection/blob/master/tests/scanner/annotationparser/meson.build)
We have a test() which calls Python, which uses some Python module and we set PYTHONPATH there so it can find it. The Python module in turn links against various DLLs when the dependencies are build in subprojects they are obviously not in PATH and things fail.
I tried adding the Python module target as a test depends, but that doesn't add anything to PATH. I can add everything manually to PATH, but well...
Is this something which needs fixing in meson or am I missing something?
The text was updated successfully, but these errors were encountered: