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 1nM9Oa-0002Jn-A2 for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Feb 2022 14:10:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nM9OZ-000770-0G for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Feb 2022 14:10:31 +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 1nM9OY-00076r-N7 for pgsql-hackers@lists.postgresql.org; Mon, 21 Feb 2022 14:10:30 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nM9OR-0007fs-7e for pgsql-hackers@lists.postgresql.org; Mon, 21 Feb 2022 14:10:30 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 82D8B2F1E4FC for ; Mon, 21 Feb 2022 15:10:21 +0100 (CET) Received: from s645.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 73B742E28BBA; Mon, 21 Feb 2022 15:10:21 +0100 (CET) Received: from s470.loopia.se (unknown [172.22.191.5]) by s645.loopia.se (Postfix) with ESMTP id 5DF1C157BC34; Mon, 21 Feb 2022 15:10:21 +0100 (CET) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s899.loopia.se ([172.22.191.6]) by s470.loopia.se (s470.loopia.se [172.22.190.10]) (amavisd-new, port 10024) with LMTP id Tk367vqenrSc; Mon, 21 Feb 2022 15:10:20 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from [192.168.72.144] (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s899.loopia.se (Postfix) with ESMTPSA id AA32F2C99B22; Mon, 21 Feb 2022 15:10:20 +0100 (CET) From: Daniel Gustafsson Content-Type: multipart/mixed; boundary="Apple-Mail=_263FC140-DEEE-42D7-9C01-08E3C021AF57" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Using Test::More test functions for pg_rewind Message-Id: Date: Mon, 21 Feb 2022 15:10:20 +0100 To: PostgreSQL Developers , Heikki Linnakangas X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_263FC140-DEEE-42D7-9C01-08E3C021AF57 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii check_query() in RewindTest.pm currently has this comment before = handrolling tests for return code and stderr: # We don't use ok() for the exit code and stderr, because we want this # check to be just a single test. The code came with the initial import of pg_rewind, and there is no = further explanation but I guess it was to make test planning easier since each check_query would count as 1 test. (inspecting old pre-import pg_rewind = repos on Github didn't given any other insights). Does anymore remember the rationale for this? Since we moved to done_testing() with 549ec201d we no longer need be = concerned with test counts, so we can replace this with normal is() tests, as per = the attached, making the output in the errorpath consistent with other = tests. Unless I'm missing something important here. -- Daniel Gustafsson https://vmware.com/ --Apple-Mail=_263FC140-DEEE-42D7-9C01-08E3C021AF57 Content-Disposition: attachment; filename=0001-Use-test-functions-in-pg_rewind-test-module.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Use-test-functions-in-pg_rewind-test-module.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a10c2520372c672453e10115249ed9882e0345db=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Gustafsson=20=0A= Date:=20Mon,=2021=20Feb=202022=2014:25:02=20+0100=0ASubject:=20[PATCH]=20= Use=20test=20functions=20in=20pg_rewind=20test=20module=0A=0ACommit=20= 61081e75c=20introduced=20pg_rewind=20along=20with=20the=20test=20suite,=20= which=0Aensured=20that=20subroutines=20didn't=20incur=20more=20than=20= one=20planned=20test.=20Now=0Athat=20we=20no=20longer=20explicitly=20= plan=20test=20runs=20(since=20549ec201d)=20we=20can=0Ause=20the=20usual=20= Test::More=20functions.=0A---=0A=20src/bin/pg_rewind/t/RewindTest.pm=20|=20= 19=20++++---------------=0A=201=20file=20changed,=204=20insertions(+),=20= 15=20deletions(-)=0A=0Adiff=20--git=20= a/src/bin/pg_rewind/t/RewindTest.pm=20= b/src/bin/pg_rewind/t/RewindTest.pm=0Aindex=202fedc626cc..5651602858=20= 100644=0A---=20a/src/bin/pg_rewind/t/RewindTest.pm=0A+++=20= b/src/bin/pg_rewind/t/RewindTest.pm=0A@@=20-102,21=20+102,10=20@@=20sub=20= check_query=0A=20=09=20=20],=0A=20=09=20=20'>',=20\$stdout,=20'2>',=20= \$stderr;=0A=20=0A-=09#=20We=20don't=20use=20ok()=20for=20the=20exit=20= code=20and=20stderr,=20because=20we=20want=20this=0A-=09#=20check=20to=20= be=20just=20a=20single=20test.=0A-=09if=20(!$result)=0A-=09{=0A-=09=09= fail("$test_name:=20psql=20exit=20code");=0A-=09}=0A-=09elsif=20($stderr=20= ne=20'')=0A-=09{=0A-=09=09diag=20$stderr;=0A-=09=09fail("$test_name:=20= psql=20no=20stderr");=0A-=09}=0A-=09else=0A-=09{=0A-=09=09is($stdout,=20= $expected_stdout,=20"$test_name:=20query=20result=20matches");=0A-=09}=0A= +=09is($result,=201,=20"$test_name:=20psql=20exit=20code");=0A+=09= is($stderr,=20'',=20"$test_name:=20psql=20no=20stderr");=0A+=09= is($stdout,=20$expected_stdout,=20"$test_name:=20query=20result=20= matches");=0A+=0A=20=09return;=0A=20}=0A=20=0A--=20=0A2.24.3=20(Apple=20= Git-128)=0A=0A= --Apple-Mail=_263FC140-DEEE-42D7-9C01-08E3C021AF57--