Skip to content

meson: always build the zstd binary when tests are enabled#3490

Merged
Cyan4973 merged 2 commits intofacebook:devfrom
eli-schwartz:meson-tests-noprograms
Feb 16, 2023
Merged

meson: always build the zstd binary when tests are enabled#3490
Cyan4973 merged 2 commits intofacebook:devfrom
eli-schwartz:meson-tests-noprograms

Conversation

@eli-schwartz
Copy link
Contributor

We need to run it for the tests, even if programs are disabled. So if they are disabled, create a build rule for the program, but don't install it. Just make it available for the test itself.

/cc @thesamesam

This allows zstd to build with -Dbin_programs=false -Dbin_tests=true, which is useful when you want to build a multilib library for libzstd, but not programs... and yet you also want to test that library.

It depends on the zstd program being built, and passes it as an env
variable. Just like datagen. But for datagen, we explicitly depend on
it, while for zstd, we assume it's built as part of "all".

This can be wrong in two cases:
- when running individual tests, meson can (re)build just what is needed
  for that one test
- a later patch will handle building zstd but not by default
We need to run it for the tests, even if programs are disabled. So if
they are disabled, create a build rule for the program, but don't
install it. Just make it available for the test itself.
@eli-schwartz eli-schwartz force-pushed the meson-tests-noprograms branch from d004414 to 97ab0e2 Compare February 10, 2023 05:33
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Feb 10, 2023
Thanks to Eli Schwartz for getting things to the point where we could
do this (a Meson bug fix [0] for the native override for find_program
and a zstd change [1] for letting us build tests but not install programs
for multilib).

[0] mesonbuild/meson#11372
[1] facebook/zstd#3490

Signed-off-by: Sam James <[email protected]>
@Cyan4973 Cyan4973 merged commit 4ebaf36 into facebook:dev Feb 16, 2023
@eli-schwartz eli-schwartz deleted the meson-tests-noprograms branch February 16, 2023 19:30
@Cyan4973 Cyan4973 self-assigned this Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants