Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tb3m0-007d2z-S8 for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 20:25:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tb3lz-004DD6-6m for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Jan 2025 20:25:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tb3lx-004DCy-Vx for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 20:25:54 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tb3lt-00193M-2p for pgsql-hackers@lists.postgresql.org; Thu, 23 Jan 2025 20:25:53 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id E04941140233; Thu, 23 Jan 2025 15:25:47 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Thu, 23 Jan 2025 15:25:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1737663947; x=1737750347; bh=L/Ns9AV3VU hdrIwGhcP+cfcry6R76/bJ7lryVhk21UM=; b=WlNGlBv/M14NuUzqOC2m4vRTmD mazdCrxskKz3PzBfCGsVVEFI1EBHvw7Gmjs+o8NKZLXWl74WZb/QhwVbealomEBP X7QyZ0syj9VfdMqi4p5MNT/7Wl7ptBHDQRsND5M7V5PK08LCnP0m5+WmmyWmGH/p xiNyOytazGGHgU7Lbg4Qix7wkQv2sy/2Z/PCULfrq5Oxy0lHtMN5Y97zOroTYTqm 2n+CGHOXPurNnotUj+zJslna2yMhzHx8lB93WJNOXWdVHV9pSmZen5PLezu/9GwK dpPPL5yZj7c+MYpNHx7imKiUNUQDFyfL3UIV6TIv31syloaT6vw/G2iJ9h0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1737663947; x=1737750347; bh=L/Ns9AV3VUhdrIwGhcP+cfcry6R76/bJ7lr yVhk21UM=; b=BYLcv1mVXUbYMuLaiGOLb1DyoPiclkGbHR064/mfCX51RlDgZnT W8mKj/G+5IIA8QmZPOMCrh55TyWG4FXxPg5jR4W6qDg/mEgATArfQIp9BICCYpzu uB63+YRYEbR9+dCdtkxSY4K9q8t0uhPgafgBsuXUYSu/lBJquCn9Lz6uEibafdOT yAklr/7qJKHGRvgeRAg/h7cTslFWRKwwl0HX7MEsoKfl2nLjSee4IDOPgOa912CQ CuT56rcC/IRKfU3Jt+2BGjVSKbqd59ieExEYQGMzvWLL9i7CHDNlfrzcHcbn4rG/ L/hZCgG/wZ+G4PPfCLP4g6PzGB3xO3LtPpQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgvdeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufhfffgjkfgfgggtsehmtderredtreej necuhfhrohhmpeffrghgfhhinhhnucfklhhmrghrihcuofgrnhhnshonkhgvrhcuoehilh hmrghrihesihhlmhgrrhhirdhorhhgqeenucggtffrrghtthgvrhhnpedvvdfhhedtfeek udfgtedufeehgffggeejieejheeugfethefggedtleegteetjeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhi rdhorhhgpdhnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtth hopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhr ghdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprgdruhhspdhrtghpthhtoheprg hnughrvgifseguuhhnshhlrghnvgdrnhgvthdprhgtphhtthhopehsmhhithhhphgsvddv hedtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhhitghhrggvlhesphgrqhhuihgvrh drgiihii X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Jan 2025 15:25:46 -0500 (EST) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Michael Paquier Cc: Peter Smith , Andrew Dunstan , Tom Lane , PostgreSQL Hackers Subject: Re: pg_createsubscriber TAP test wrapping makes command options hard to read. References: <0f5256ec-d63e-4e0f-9b71-750a7a4e5c01@dunslane.net> <651128.1734017715@sss.pgh.pa.us> <87jzc46d8u.fsf@wibble.ilmari.org> <5f41d6c6-1cbb-494d-a5c4-3c449fc4e9ad@dunslane.net> <105f432a-6b0b-42d4-9061-65d263279be7@app.fastmail.com> <87ldv542fk.fsf@wibble.ilmari.org> <87frlc45gg.fsf@wibble.ilmari.org> Date: Thu, 23 Jan 2025 20:25:45 +0000 In-Reply-To: (Michael Paquier's message of "Wed, 22 Jan 2025 14:50:47 +0900") Message-ID: <878qr146ra.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Michael Paquier writes: > Note that there are a few more under "Locale provider tests" in the > initdb tests. I've left that as a follow-up thing, that was already a > lot.. Here's a patch for that. - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-initdb-convert-more-TAP-test-to-long-option-fat-comm.patch From d787bf86ded9f66e12325a7460761d6d10fccbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Wed, 22 Jan 2025 16:06:17 +0000 Subject: [PATCH] initdb: convert more TAP test to long option fat comma style --- src/bin/initdb/t/001_initdb.pl | 116 ++++++++++++++++++++++----------- 1 file changed, 79 insertions(+), 37 deletions(-) diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl index 5cff5ce5e4d..b4d35e93c42 100644 --- a/src/bin/initdb/t/001_initdb.pl +++ b/src/bin/initdb/t/001_initdb.pl @@ -50,8 +50,7 @@ # while we are here, also exercise --text-search-config and --set options command_ok( [ - 'initdb', - '--no-sync', + 'initdb', '--no-sync', '--text-search-config' => 'german', '--set' => 'default_text_search_config=german', '--waldir' => $xlogdir, @@ -101,8 +100,7 @@ # Init a new db with group access my $datadir_group = "$tempdir/data_group"; - command_ok( - [ 'initdb', '-g', $datadir_group ], + command_ok([ 'initdb', '--allow-group-access', $datadir_group ], 'successful creation with group access'); ok(check_mode_recursive($datadir_group, 0750, 0640), @@ -114,14 +112,19 @@ if ($ENV{with_icu} eq 'yes') { command_fails_like( - [ 'initdb', '--no-sync', '--locale-provider=icu', "$tempdir/data2" ], + [ + 'initdb', '--no-sync', + '--locale-provider' => 'icu', + "$tempdir/data2" + ], qr/initdb: error: locale must be specified if provider is icu/, 'locale provider ICU requires --icu-locale'); command_ok( [ 'initdb', '--no-sync', - '--locale-provider=icu', '--icu-locale=en', + '--locale-provider' => 'icu', + '--icu-locale' => 'en', "$tempdir/data3" ], 'option --icu-locale'); @@ -129,11 +132,15 @@ command_like( [ 'initdb', '--no-sync', - '-A' => 'trust', - '--locale-provider=icu', '--locale=und', - '--lc-collate=C', '--lc-ctype=C', - '--lc-messages=C', '--lc-numeric=C', - '--lc-monetary=C', '--lc-time=C', + '--auth' => 'trust', + '--locale-provider' => 'icu', + '--locale' => 'und', + '--lc-collate' => 'C', + '--lc-ctype' => 'C', + '--lc-messages' => 'C', + '--lc-numeric' => 'C', + '--lc-monetary' => 'C', + '--lc-time' => 'C', "$tempdir/data4" ], qr/^\s+default collation:\s+und\n/ms, @@ -142,7 +149,8 @@ command_fails_like( [ 'initdb', '--no-sync', - '--locale-provider=icu', '--icu-locale=@colNumeric=lower', + '--locale-provider' => 'icu', + '--icu-locale' => '@colNumeric=lower', "$tempdir/dataX" ], qr/could not open collator for locale/, @@ -151,8 +159,10 @@ command_fails_like( [ 'initdb', '--no-sync', - '--locale-provider=icu', '--encoding=SQL_ASCII', - '--icu-locale=en', "$tempdir/dataX" + '--locale-provider' => 'icu', + '--encoding' => 'SQL_ASCII', + '--icu-locale' => 'en', + "$tempdir/dataX" ], qr/error: encoding mismatch/, 'fails for encoding not supported by ICU'); @@ -160,7 +170,8 @@ command_fails_like( [ 'initdb', '--no-sync', - '--locale-provider=icu', '--icu-locale=nonsense-nowhere', + '--locale-provider' => 'icu', + '--icu-locale' => 'nonsense-nowhere', "$tempdir/dataX" ], qr/error: locale "nonsense-nowhere" has unknown language "nonsense"/, @@ -169,7 +180,8 @@ command_fails_like( [ 'initdb', '--no-sync', - '--locale-provider=icu', '--icu-locale=@colNumeric=lower', + '--locale-provider' => 'icu', + '--icu-locale' => '@colNumeric=lower', "$tempdir/dataX" ], qr/could not open collator for locale "und-u-kn-lower": U_ILLEGAL_ARGUMENT_ERROR/, @@ -178,18 +190,27 @@ else { command_fails( - [ 'initdb', '--no-sync', '--locale-provider=icu', "$tempdir/data2" ], + [ + 'initdb', '--no-sync', + '--locale-provider' => 'icu', + "$tempdir/data2" + ], 'locale provider ICU fails since no ICU support'); } command_fails( - [ 'initdb', '--no-sync', '--locale-provider=builtin', "$tempdir/data6" ], + [ + 'initdb', '--no-sync', + '--locale-provider' => 'builtin', + "$tempdir/data6" + ], 'locale provider builtin fails without --locale'); command_ok( [ 'initdb', '--no-sync', - '--locale-provider=builtin', '--locale=C', + '--locale-provider' => 'builtin', + '--locale' => 'C', "$tempdir/data7" ], 'locale provider builtin with --locale'); @@ -197,18 +218,24 @@ command_ok( [ 'initdb', '--no-sync', - '--locale-provider=builtin', '-E UTF-8', - '--lc-collate=C', '--lc-ctype=C', - '--builtin-locale=C.UTF-8', "$tempdir/data8" + '--locale-provider' => 'builtin', + '--encoding' => 'UTF-8', + '--lc-collate' => 'C', + '--lc-ctype' => 'C', + '--builtin-locale' => 'C.UTF-8', + "$tempdir/data8" ], - 'locale provider builtin with -E UTF-8 --builtin-locale=C.UTF-8'); + 'locale provider builtin with --encoding=UTF-8 --builtin-locale=C.UTF-8'); command_fails( [ 'initdb', '--no-sync', - '--locale-provider=builtin', '-E SQL_ASCII', - '--lc-collate=C', '--lc-ctype=C', - '--builtin-locale=C.UTF-8', "$tempdir/data9" + '--locale-provider' => 'builtin', + '--encoding' => 'SQL_ASCII', + '--lc-collate' => 'C', + '--lc-ctype' => 'C', + '--builtin-locale' => 'C.UTF-8', + "$tempdir/data9" ], 'locale provider builtin with --builtin-locale=C.UTF-8 fails for SQL_ASCII' ); @@ -216,15 +243,18 @@ command_ok( [ 'initdb', '--no-sync', - '--locale-provider=builtin', '--lc-ctype=C', - '--locale=C', "$tempdir/data10" + '--locale-provider' => 'builtin', + '--lc-ctype' => 'C', + '--locale' => 'C', + "$tempdir/data10" ], 'locale provider builtin with --lc-ctype'); command_fails( [ 'initdb', '--no-sync', - '--locale-provider=builtin', '--icu-locale=en', + '--locale-provider' => 'builtin', + '--icu-locale' => 'en', "$tempdir/dataX" ], 'fails for locale provider builtin with ICU locale'); @@ -232,35 +262,47 @@ command_fails( [ 'initdb', '--no-sync', - '--locale-provider=builtin', '--icu-rules=""', + '--locale-provider' => 'builtin', + '--icu-rules' => '""', "$tempdir/dataX" ], 'fails for locale provider builtin with ICU rules'); command_fails( - [ 'initdb', '--no-sync', '--locale-provider=xyz', "$tempdir/dataX" ], + [ + 'initdb', '--no-sync', + '--locale-provider' => 'xyz', + "$tempdir/dataX" + ], 'fails for invalid locale provider'); command_fails( [ 'initdb', '--no-sync', - '--locale-provider=libc', '--icu-locale=en', + '--locale-provider' => 'libc', + '--icu-locale' => 'en', "$tempdir/dataX" ], 'fails for invalid option combination'); command_fails( - [ 'initdb', '--no-sync', '--set' => 'foo=bar', "$tempdir/dataX" ], + [ + 'initdb', '--no-sync', + '--set' => 'foo=bar', + "$tempdir/dataX" + ], 'fails for invalid --set option'); -# Make sure multiple invocations of -c parameters are added case insensitive +# Make sure multiple invocations of --set parameters are added case insensitive command_ok( [ - 'initdb', '-cwork_mem=128', - '-cWork_Mem=256', '-cWORK_MEM=512', + 'initdb', '--no-sync', + '--set' => 'work_mem=128', + '--set' => 'Work_Mem=256', + '--set' => 'WORK_MEM=512', "$tempdir/dataY" ], - 'multiple -c options with different case'); + 'multiple ---set options with different case'); my $conf = slurp_file("$tempdir/dataY/postgresql.conf"); ok($conf !~ qr/^WORK_MEM = /m, "WORK_MEM should not be configured"); -- 2.39.5 --=-=-=--