From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros)
Date: Mon, 7 Oct 2019 13:06:41 -0700
Message-ID: <20191007200641.qkq7klcnsvmianfw@alap3.anarazel.de> (raw)
In-Reply-To: <2144.1570471061@sss.pgh.pa.us>
References: <E1iGnXq-0001K7-Aj@gemulon.postgresql.org>
<20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de>
<2144.1570471061@sss.pgh.pa.us>
Hi,
On 2019-10-07 13:57:41 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2019-10-05 17:08:38 +0000, Noah Misch wrote:
> >> Report test_atomic_ops() failures consistently, via macros.
>
> > I wonder if we should put these (and a few more, for other types), into
> > a more general place. I would like to have them for writing both tests
> > like regress.c:test_atomic_ops(), and for writing assertions that
> > actually display useful error messages. For the former it makes sense
> > to ERROR out, for the latter they ought to abort, as currently.
>
> IMO, anything named like "assert" ought to act like Assert does now,
> ie (1) it's a no-op in a non-assert build and (2) you get an abort()
> on failure.
No disagreement at all.
> No strong opinions about what the test-and-elog variant
> should be called -- but it seems like we might have some difficulty
> agreeing on what the appropriate error level is for that. If it's
> morally like an Assert except we want it on all the time, should
> it be PANIC?
Perhaps it ought to just take elevel as a parameter? Could even be
useful for debugging...
> What will happen in frontend code?
Hm. Map to pg_log_*, and abort() if it's an erroring elevel?
> > Seems like putting ASSERT_{EQ,LT,...}_{U32,S32,...} (or Assert_Eq_...,
> > but that'd imo look weirder than the inconsistency) into c.h would make
> > sense, and EXPECT_ somewhere in common/pg_test.h or such?
>
> I'd just put them all in c.h. I see no reason why a new header
> is helpful.
WFM.
Greetings,
Andres Freund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, noah@leadboat.com, pgsql-hackers@lists.postgresql.org
Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros)
In-Reply-To: <20191007200641.qkq7klcnsvmianfw@alap3.anarazel.de>
References: <E1iGnXq-0001K7-Aj@gemulon.postgresql.org> <20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de> <2144.1570471061@sss.pgh.pa.us> <20191007200641.qkq7klcnsvmianfw@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox