Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lxYsJ-0004hc-Tq for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Jun 2021 17:47:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lxYsI-0000Bj-Qz for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Jun 2021 17:47:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lx9o6-0005Ox-5m; Sat, 26 Jun 2021 15:01:18 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lx9o0-0007ZZ-HG; Sat, 26 Jun 2021 15:01:14 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 290E5C0003; Sat, 26 Jun 2021 15:01:09 +0000 (UTC) Subject: Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench To: Fabien COELHO , Michael Paquier Cc: pgsql-committers@lists.postgresql.org, PostgreSQL Developers References: <0f49303e-7784-b3ee-200b-cbf67be2eb9e@dunslane.net> From: Andrew Dunstan Message-ID: <9f70b570-9aa2-29cc-8732-34cc6d16d798@dunslane.net> Date: Sat, 26 Jun 2021 11:01:07 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/26/21 2:47 AM, Fabien COELHO wrote: > > Hello Andrew & Michaël, > > My 0.02¤: > >> There's a whole lot wrong with this code. To start with, why is that >> unchecked eval there. > > Yep. The idea was that other tests would go on being collected eg if > the file is not found, but it should have been checked anyway. > >> And why is it reading in log files on its own instead of using >> TestLib::slurp_file, which, among other things, normalizes line endings? > > Indeed. > > However, if slurp_file fails it raises an exception and aborts the > whole TAP unexpectedly, which is pretty unclean. So I'd suggest to > keep the eval, as attached. I tested it by changing the file name so > that the slurp fails. Seem quite unnecessary. We haven't found that to be an issue elsewhere in the code where slurp_file is used. And in the present case we know the file exists because we got its name from list_files(). cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com