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

backends: Make ninja not build test executables by default #5867

Closed
wants to merge 1 commit into from

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Aug 30, 2019

When they're marked build_by_default : false

This soles the easy part, which is making ninja not build test dependencies if they're explicitly marked build_by_default : false. A completely fix will require some deeper changes to not affect backwards compatibility, as currently all targets default to build_by_default=True.

This shouldn't affect the VSCode backend since tests are generated separately, but I could be wrong.

I'm thinking moving to a tri-state value equivalent to Always, If-not-test, never.

Fixes #2518
Fixes #1704

@dcbaker dcbaker added the WIP label Aug 30, 2019
@dcbaker
Copy link
Member Author

dcbaker commented Aug 30, 2019

Also still needs to have some tests. I've stared doing that but haven't finished yet.

@dcbaker dcbaker force-pushed the test-depends branch 2 times, most recently from f3b3bf2 to fa8c8a7 Compare August 30, 2019 23:05
When they're marked `build_by_default : false`
@NNemec
Copy link
Contributor

NNemec commented Sep 1, 2019

Please have a look at my PR #5728 - this appears to address exactly the same issue...

@jpakkane
Copy link
Member

jpakkane commented Sep 1, 2019

It would be better if we could do without a tristate value. We need to check for people using not-built executables for tests and error out or print a warning anyway. Failing silently in that case is just bad UX.

So something like:

  • if a test is marked as build_by_default: false it will not be built with "ninja all"
  • however it will be built with "ninja test"

@dcbaker
Copy link
Member Author

dcbaker commented Sep 3, 2019

@jpakkane, that's exactly what I have now. If we were building this from scratch what I'd really want is build_by_default : false is the default, install : true overrides build_by_default, targets needed by tests would be pulled in during ninja test time. That would break backwards compatibility though so I don't think we can do that.

@dcbaker
Copy link
Member Author

dcbaker commented Sep 3, 2019

I'll go ahead and close this and take ownership of getting #5728 merged.

@dcbaker dcbaker closed this Sep 3, 2019
eli-schwartz added a commit to eli-schwartz/meson that referenced this pull request Jan 8, 2025
When running `ninja all` we shouldn't build testsuite programs as these
might not be wanted e.g. in order to just install the project. We do
want them to be built when running `ninja test`. Since meson 0.63 we
actually have a dedicated ninja alias for test dependencies -- move
these from the "all" rule to the dedicated test/benchmark rules.

Closes: mesonbuild#1704
Closes: mesonbuild#1949
Closes: mesonbuild#2518
Closes: mesonbuild#3662
Closes: mesonbuild#5728
Closes: mesonbuild#5867
Closes: mesonbuild#6511
Closes: mesonbuild#11317
Closes: mesonbuild#13378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test executable always built even when build_by_default is false Test target depends on all executables
3 participants