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 1iHZKg-0004Kg-5R for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2019 20:10:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHZKd-0006Gp-CH for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2019 20:10:11 +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 1iHZHO-0003lq-6b for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2019 20:06:52 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHZHJ-00020z-9k for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2019 20:06:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 8C25320A34; Mon, 7 Oct 2019 16:06:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 07 Oct 2019 16:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=gJ6SGk4COCBoxUSqpTBmglvaSDX Dg0ezEIGjxjAnsGI=; b=SpuEvLOvLvtqP+S48pWz+/SLOiwKx2lWFRcN+gLeBY+ Y4nB64ioi95/tILVBX89CWj6ldkJP3wAksspPFN1fihKbdX1MhGYtlOhrvh1KtrN O6cUtjLwMo/H1TLsJnw6jECg5jUnKLKW3atlKkhAPzAO7x6qvJ9U1CpjnbjeFxJ4 5MFlcjei09FaV4o3skveN8Yi8Nw8sTJiPx83kYdzWH5AaLbDAV3bz3GEG4RL5IXX rLCCyJhnEFN5TOu8oxKOgIHRAAoSKGl7VqUnAtG76zW1QrRwpqN2i4JaQQAqilQD HVDukat/nbnW/asd0Dts66Hk0IVKeia48yirEmr06IQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=gJ6SGk 4COCBoxUSqpTBmglvaSDXDg0ezEIGjxjAnsGI=; b=xTXgXumlFxQXBhDQrXFw1x 76wZbNIBxBc7xZ/TNO6r1eEnbNcyv+o4qdW4KwePDluTiLYd1zP2vudnBnlVYf8T aj1FEhZZEKURTd9gaI/o9mZF4+3UFM+hiClOc9tTutZ9Ce1FrMcoF5cNT1ymVX2t cQbPXbgR5/mDk5iqo/UwbwhP2lVwINJWWVqNXnkqzliuh7lJM0MBfDeOHLK95/pA d7fWTCVfzixgjbeigPhpa6N45RMTNwMwqKVP5SSAn1TOhLk9EkfmpuXdBi0aMFDq lDa965z7v09dG486vArnmRa+AwmKeVw1jgW7aCvd8k4QtvqIVo05e8hfXlJyHXPg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrheejgddufeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkphepie ejrdduiedtrddvudekrddvfeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgv shesrghnrghrrgiivghlrdguvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-218-237.hsd1.ca.comcast.net [67.160.218.237]) by mail.messagingengine.com (Postfix) with ESMTPA id 89F9280059; Mon, 7 Oct 2019 16:06:42 -0400 (EDT) Date: Mon, 7 Oct 2019 13:06:41 -0700 From: Andres Freund To: Tom Lane Cc: Noah Misch , pgsql-hackers@lists.postgresql.org Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros) Message-ID: <20191007200641.qkq7klcnsvmianfw@alap3.anarazel.de> References: <20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de> <2144.1570471061@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2144.1570471061@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-10-07 13:57:41 -0400, Tom Lane wrote: > 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 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