Skip to content
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

ctest & meson test should be directly called in setup hooks instead of make check / ninja test #113829

Open
kira-bruneau opened this issue Feb 20, 2021 · 3 comments

Comments

@kira-bruneau
Copy link
Contributor

Issue description

The make check and ninja test targets generated by CMake & Meson are just wrappers around ctest & meson test. If we instead called these executables directly in the setup hooks, that would allow us to pass arguments to selectively disable tests, set timeout multipliers, etc... like we can with pytestCheckHook.

Examples:

CMake:

{
  ctestFlagsArray = [ "--timeout" "30" ];
  disabledTests = [ "bad-test" ];
}

Meson:

{
  mesonTestFlagsArray = [ "--timeout-multiplier" "10" ];
  disabledTests = [ "bad-test" ];
}
@kira-bruneau kira-bruneau changed the title ctest & meson test should be directly called in setup hooks instead of make check / ninja test "ctest" & "meson test" should be directly called in setup hooks instead of "make check" / "ninja test" Feb 20, 2021
@stale
Copy link

stale bot commented Aug 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 21, 2021
@nh2
Copy link
Contributor

nh2 commented Nov 3, 2021

Still very relevant.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 3, 2021
@kira-bruneau kira-bruneau changed the title "ctest" & "meson test" should be directly called in setup hooks instead of "make check" / "ninja test" ctest & meson test should be directly called in setup hooks instead of make check / ninja test Nov 20, 2021
alyssais added a commit to alyssais/nixpkgs that referenced this issue Jan 31, 2023
Meson now comes with its own set of commands for building, testing,
installing etc., that by default wrap around Ninja.  The reason to
prefer using the Meson commands is that they take additional
options (e.g. setting custom timeouts for tests — my motivation for
this change).

Here, I've modified the Meson setup hook so that Meson's test and
install commands will be used instead of Ninja's when Meson's
configurePhase is used.  This restriction is to avoid starting to run
Meson directly when dealing with custom build systems that wrap around
Meson, like QEMU's.  We don't use meson's compile command, as it just
runs ninja, and that's handled fine by the existing Ninja setup hook.

Naturally the Meson commands don't support entirely the same set of
options that the Ninja ones did, but I checked through Nixpkgs to find
any packages using Meson that used any options that wouldn't be picked
up by this new system.  I only found one, and it was just setting
checkTarget = "test", which is the default value for Ninja and has no
Meson equivalent (because we directly tell Meson to run the tests
rather than going through a generic job system like Ninja).

Link: NixOS#113829
alyssais added a commit to alyssais/nixpkgs that referenced this issue Feb 3, 2023
Meson now comes with its own set of commands for building, testing,
installing etc., that by default wrap around Ninja.  The reason to
prefer using the Meson commands is that they take additional
options (e.g. setting custom timeouts for tests — my motivation for
this change).

Here, I've modified the Meson setup hook so that Meson's test and
install commands will be used instead of Ninja's when Meson's
configurePhase is used.  This restriction is to avoid starting to run
Meson directly when dealing with custom build systems that wrap around
Meson, like QEMU's.  We don't use meson's compile command, as it just
runs ninja, and that's handled fine by the existing Ninja setup hook.

Naturally the Meson commands don't support entirely the same set of
options that the Ninja ones did, but I checked through Nixpkgs to find
any packages using Meson that used any options that wouldn't be picked
up by this new system.  I only found one, and it was just setting
checkTarget = "test", which is the default value for Ninja and has no
Meson equivalent (because we directly tell Meson to run the tests
rather than going through a generic job system like Ninja).

Link: NixOS#113829
alyssais added a commit to alyssais/nixpkgs that referenced this issue Feb 11, 2023
Meson now comes with its own set of commands for building, testing,
installing etc., that by default wrap around Ninja.  The reason to
prefer using the Meson commands is that they take additional
options (e.g. setting custom timeouts for tests — my motivation for
this change).

Here, I've modified the Meson setup hook so that Meson's test and
install commands will be used instead of Ninja's when Meson's
configurePhase is used.  This restriction is to avoid starting to run
Meson directly when dealing with custom build systems that wrap around
Meson, like QEMU's.  We don't use meson's compile command, as it just
runs ninja, and that's handled fine by the existing Ninja setup hook.

Naturally the Meson commands don't support entirely the same set of
options that the Ninja ones did, but I checked through Nixpkgs to find
any packages using Meson that used any options that wouldn't be picked
up by this new system.  I only found one, and it was just setting
checkTarget = "test", which is the default value for Ninja and has no
Meson equivalent (because we directly tell Meson to run the tests
rather than going through a generic job system like Ninja).

Link: NixOS#113829
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/building-only-specific-targets-with-cmake/31545/4

alyssais added a commit to alyssais/nixpkgs that referenced this issue Oct 6, 2023
Meson now comes with its own set of commands for building, testing,
installing etc., that by default wrap around Ninja.  The reason to
prefer using the Meson commands is that they take additional
options (e.g. setting custom timeouts for tests — my motivation for
this change).

Here, I've modified the Meson setup hook so that Meson's test and
install commands will be used instead of Ninja's when Meson's
configurePhase is used.  This restriction is to avoid starting to run
Meson directly when dealing with custom build systems that wrap around
Meson, like QEMU's.  We don't use meson's compile command, as it just
runs ninja, and that's handled fine by the existing Ninja setup hook.

Naturally the Meson commands don't support entirely the same set of
options that the Ninja ones did, but I checked through Nixpkgs to find
any packages using Meson that used any options that wouldn't be picked
up by this new system.  I only found one, and it was just setting
checkTarget = "test", which is the default value for Ninja and has no
Meson equivalent (because we directly tell Meson to run the tests
rather than going through a generic job system like Ninja).

Link: NixOS#113829
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
alyssais added a commit that referenced this issue Oct 9, 2023
Meson now comes with its own set of commands for building, testing,
installing etc., that by default wrap around Ninja.  The reason to
prefer using the Meson commands is that they take additional
options (e.g. setting custom timeouts for tests — my motivation for
this change).

Here, I've modified the Meson setup hook so that Meson's test and
install commands will be used instead of Ninja's when Meson's
configurePhase is used.  This restriction is to avoid starting to run
Meson directly when dealing with custom build systems that wrap around
Meson, like QEMU's.  We don't use meson's compile command, as it just
runs ninja, and that's handled fine by the existing Ninja setup hook.

Naturally the Meson commands don't support entirely the same set of
options that the Ninja ones did, but I checked through Nixpkgs to find
any packages using Meson that used any options that wouldn't be picked
up by this new system.  I only found one, and it was just setting
checkTarget = "test", which is the default value for Ninja and has no
Meson equivalent (because we directly tell Meson to run the tests
rather than going through a generic job system like Ninja).

Link: #113829
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants