You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to use an executable made by a custom_target() as command for test() ? #6567
with meson 0.53.1
I've a custom_target() that generate an executable.
I want to give it as the command to execute for the test() command.
How can I do that (if possible)?
@xclaesse yes this trick works fine. It fun to see that the string returned by full_path() doesn't work directly with test(), but with files() yes.
thanks!
I wonder if it could be an improvement to let test() works with full_path() directly.
I recently tried to do this assuming that it would work, and after a few searches ended up here. Is there a wide desire for this?
I looked into seeing what it would take to implement this and to my surprise it's a simple two line change to get the most basic example working (adding build.CustomTarget into the accepted types for Interpretor.func_test and Interpretor.make_test) but that's probably not a good idea as not all custom targets will be executable.
If the output of custom_target is something that can be executed as a test, then it should probably be an build.Executable, right? Would it make sense to add a new boolean kwarg to custom_target that users can set to true if the output is intended to be executable and which defaults to false?
Activity
xclaesse commentedon Feb 1, 2020
I think the short answer is it's not supported. That being said, judging by the code I think something like that could work around it:
lambda-code commentedon Feb 2, 2020
@xclaesse yes this trick works fine. It fun to see that the string returned by full_path() doesn't work directly with test(), but with files() yes.
thanks!
I wonder if it could be an improvement to let test() works with full_path() directly.
xclaesse commentedon Feb 3, 2020
Yes I think it should accept target[0] at least. Would be a nice contribution if you can make a pr ;)
eli-schwartz commentedon Aug 31, 2021
It doesn't seem to work at all for me,
File @target@ does not exist.find_program() doesn't work either...
This seems to be still relevant
amcn commentedon Mar 23, 2023
I recently tried to do this assuming that it would work, and after a few searches ended up here. Is there a wide desire for this?
I looked into seeing what it would take to implement this and to my surprise it's a simple two line change to get the most basic example working (adding
build.CustomTargetinto the accepted types forInterpretor.func_testandInterpretor.make_test) but that's probably not a good idea as not all custom targets will be executable.If the output of
custom_targetis something that can be executed as atest, then it should probably be anbuild.Executable, right? Would it make sense to add a new boolean kwarg tocustom_targetthat users can set totrueif the output is intended to be executable and which defaults tofalse?Allow using CustomTarget as test executable
Allow using CustomTarget as test executable
Allow using CustomTarget as test executable
Allow using CustomTarget as test executable
Allow using CustomTarget as test executable
Allow using CustomTarget as test executable
Allow using CustomTarget as test executable