Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHXGh-0007RL-7j for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2019 17:57:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHXGg-0006mc-2C for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2019 17:57:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHXGf-0006mT-PU for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2019 17:57:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHXGa-0000hd-P7 for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2019 17:57:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x97Hvftu002145; Mon, 7 Oct 2019 13:57:42 -0400 From: Tom Lane To: Andres Freund cc: Noah Misch , pgsql-hackers@lists.postgresql.org Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros) In-reply-to: <20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de> References: <20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sat, 05 Oct 2019 12:07:29 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2143.1570471061.1@sss.pgh.pa.us> Date: Mon, 07 Oct 2019 13:57:41 -0400 Message-ID: <2144.1570471061@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund 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 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? What will happen in frontend code? > 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. regards, tom lane