dinit icon indicating copy to clipboard operation
dinit copied to clipboard

meson build should build test objects with correct compilation flags

Open davmac314 opened this issue 6 months ago • 3 comments

According to https://github.com/davmac314/dinit/pull/461 the tests are not being built correctly in the meson builds (the test objects are being compiled with the same flags as the primary build). That should be fixed.

davmac314 avatar May 06 '25 21:05 davmac314

I remember now that this is documented in BUILD_MESON:

1. Sanitizers cannot be enabled only for tests, as they are by default in a Make-based build.

This was fine during development but needs to be sorted. It's not ok that this newer build system has limitations that are trivially overcome by a traditional build.

davmac314 avatar May 06 '25 22:05 davmac314

This is trivially overcome in meson too. The existing meson.build file has simply chosen not to build a second copy of the test objects with different flags.

The fuzzer already enables sanitizers manually, without using meson's global builtin toggle to build "the whole project" with sanitizers. There's absolutely no reason you can't set that up consistently in meson, all you need to do is define your own build option rather than relying on Meson's generic builtin.

The Meson built-in for sanitizer support is intended for people who want to sideload sanitizers into an existing project, usually to run it live on a test system by installing it and emulating normal workflows. It's quite different from "the test suite has dedicated sanitizer targets that must always be run", and people doing the latter are NOT constrained by the existence of helper options intended for people doing the former.

eli-schwartz avatar May 30 '25 20:05 eli-schwartz

This is trivially overcome in meson too. The existing meson.build file has simply chosen not to build a second copy of the test objects with different flags.

That may be the case. The problem is that Dinit has a contributed meson.build file, which was an unasked-for contribution and was accepted only on the basis that it would be properly maintained by the contributor. This issue is for tracking the fact that it is currently lacking in a specific way that the traditional build handles just fine. The comment about "this newer build system" above is not talking about Meson in general, just Dinit's Meson-based build.

davmac314 avatar Jun 01 '25 05:06 davmac314