Replies: 3 comments 3 replies
-
Prior art: https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests Meson does "support" this by the way, inasmuch as it is mentioned at https://mesonbuild.com/Installing.html#installation-tags as something that, if it is part of a project, meson knows how to add install_tag defaults for it such that they are installed with |
Beta Was this translation helpful? Give feedback.
-
The GnomeGoal has a slightly different angle, but the advantages are the same. The installation tags can work, but only if there is support within the project. I don't see a reason why Meson can't automatically detect the tests, e.g.
Meson sees Of course, if you do stuff like in this discussion, then that's on you and you need to include the necessary files yourself. But the standard case should be automateable. |
Beta Was this translation helpful? Give feedback.
-
A new
This would also allow finer control over which data is copied, as data for tests that are not included can be ignored. We can't enforce the use of the parameter right now, but the |
Beta Was this translation helpful? Give feedback.
-
Meson differentiates between the program to be build and the tests to test the program. The tests are run within the build environment after building the program, but there is the potential to completely separate the tests and allow them to be independently packaged and run to also test the installed program.
The current way of things
Meson currently builds the library during
meson build
, runs the tests against the local build artifacts viameson test
and then installs the library or executable usingmeson install
So, the workflow looks as follows:
build/
build/
This works fine to check that there are no issues with the code and to be confident before going into packaging and installing.
The proposal
The proposal here is to be able to build the tests independently in a way that, once built, they can be run against the installed package. That is:
Advantages
This does look somewhat more complicated, but has several advantages from a packaging standpoint.
meson
to do all that, instead separately packaged tests allow the packagers to do that.More concretely, suppose a package X depends on package P. If we update P, however minor the change, we get P' which isn't identical (being reproducible doesn't affect this). Running the tests for P against P', we can identify that P' has in fact the same behaviour as P (or not) and automatically determine whether we need to rebuild X, e.g. due to ABI changes. The same principle applies when updating a dependency of P or recompiling with a newer/different compiler.
Drawbacks
Depends on the implementation, and I don't think they are severe, but here are some I thought of:
Implementation
In terms of implementation, step 1 and 2 are trivial.
AFAICT, there are two options to implement the other steps. The favourable one, if possible, would be to have the tests build without first building the program from source, i.e. running
meson test
withoutmeson build
. The program would be installed in the system and accessible normally via $PATH.If that isn't enough, then I'd be fine with having to rebuild the entire thing. At that point, it's probably possible to combine the steps to only have to build it once, but the tests should still run and install independently as described above. This is most likely the option with the fewest changes.
Some context
I'm coming from the point of Arch Linux, which I personally use. As such, I'm quite familiar with the PKGBUILD way of packaging, where a check function is used for
meson test
. Ultimately, I'd like to see separate packages for testing that one can install after the fact, but for that to happen, the tooling must allow it via above changes. And once one tool has the feature, it's hopefully going to become widespread rather soon.And I've chosen Meson as a starting place because I'm interested in it - of course- but also because I'm rather proficient in Python, so with some guidance I can help implement this change.
If I've missed some option or trick to make this possible, then please point it out, but I've not found anything with regards to this in the documentation.
Thank you for reading all this! Please give your thoughts on this for some discussion. And questions are always welcome!
Beta Was this translation helpful? Give feedback.
All reactions