Re: git: 6f3445006aa0 - main - [tests] lib/libc/gen:assert_test: skip tests when NDEBUG set

From: Enji Cooper (yaneurabeya) <yaneurabeya_at_gmail.com>
Date: Fri, 02 Oct 2026 19:34:07 UTC
> On Oct 2, 2026, at 4:24 AM, Kyle Evans <kevans@FreeBSD.org> wrote:
> 
> On 9/22/26 08:14, Kyle Evans wrote:
>> On 9/22/26 01:30, Enji Cooper wrote:
>>> The branch main has been updated by ngie:
>>> 
>>> URL: https://cgit.FreeBSD.org/src/commit/?id=6f3445006aa05550f14af65b04276c3d25169941
>>> 
>>> commit 6f3445006aa05550f14af65b04276c3d25169941
>>> Author:     Enji Cooper <ngie@FreeBSD.org>
>>> AuthorDate: 2026-09-22 06:22:57 +0000
>>> Commit:     Enji Cooper <ngie@FreeBSD.org>
>>> CommitDate: 2026-09-22 06:30:30 +0000
>>> 
>>>      [tests] lib/libc/gen:assert_test: skip tests when NDEBUG set
>>>      In the event that NDEBUG is specified in CFLAGS--which is most likely
>>>      triggered via `MK_ASSERT_DEBUG` == "no" -- all assert(3) statements are
>>>      optimized out by design. This breaks the assert(3) tests as they
>>>      specifically rely on assert(3) actually raising a `SIGABRT` instead of
>>>      quietly succeeding.
>>>      Skip both tests if `NDEBUG` is set. There's no sense running the
>>>      `assert(true)` test if the result could instead be a false positive.
>>>      MFC after:      2 weeks
>>> ---
>>>   contrib/netbsd-tests/lib/libc/gen/t_assert.c | 20 ++++++++++++++++++++
>>>   1 file changed, 20 insertions(+)
>>> 
>> Hi,
>> Why not just #undef NDEBUG right before we include <assert.h>?  Given that it's a test of the feature,
>> I think it makes plenty of sense to ignore the user-requested preference for just this one scenario
>> where we want to confirm that the feature isn't coincidentally broken.
>> Thanks,
>> Kyle Evans
> 
> Ping?  I really don't think this is the approach we should be taking here, particularly when
> the alternative is robust and easy to implement.

Thanks for the poke: https://reviews.freebsd.org/D60253 !
-Enji