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 1qEAUY-0006tx-SO for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jun 2023 15:20:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qEAUW-00007Y-VM for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jun 2023 15:20:28 +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 1qEAUW-0008Vc-L0 for pgsql-hackers@lists.postgresql.org; Tue, 27 Jun 2023 15:20:28 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qEAUS-000nj1-FP for pgsql-hackers@lists.postgresql.org; Tue, 27 Jun 2023 15:20:27 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id D263440016; Tue, 27 Jun 2023 15:20:21 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------uKO0rsbPA079TGbMkNuQvgn8" Message-ID: Date: Tue, 27 Jun 2023 11:20:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: en-US To: Jacob Champion , PostgreSQL Hackers References: From: Andrew Dunstan Subject: Re: [PATCH] Honor PG_TEST_NOCLEAN for tempdirs In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------uKO0rsbPA079TGbMkNuQvgn8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2023-06-26 Mo 19:55, Jacob Champion wrote: > Hello, > > I was running the test_pg_dump extension suite, and I got annoyed that > I couldn't keep it from deleting its dump artifacts after a successful > run. Here's a patch to make use of PG_TEST_NOCLEAN (which currently > covers the test cluster's base directory) with the Test::Utils > tempdirs too. > > (Looks like this idea was also discussed last year [1]; let me know if > I missed any more recent suggestions.) -        CLEANUP => 1); +        CLEANUP => not defined $ENV{'PG_TEST_NOCLEAN'}); This doesn't look quite right. If PG_TEST_CLEAN had a value of 0 we would still do the cleanup. I would probably use something like:     CLEANUP => $ENV{'PG_TEST_NOCLEAN'} // 1 i.e. if it's not defined at all or has a value of undef, do the cleanup, otherwise use the value. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------uKO0rsbPA079TGbMkNuQvgn8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2023-06-26 Mo 19:55, Jacob Champion wrote:
Hello,

I was running the test_pg_dump extension suite, and I got annoyed that
I couldn't keep it from deleting its dump artifacts after a successful
run. Here's a patch to make use of PG_TEST_NOCLEAN (which currently
covers the test cluster's base directory) with the Test::Utils
tempdirs too.

(Looks like this idea was also discussed last year [1]; let me know if
I missed any more recent suggestions.)


-        CLEANUP => 1);
+        CLEANUP => not defined $ENV{'PG_TEST_NOCLEAN'});


This doesn't look quite right. If PG_TEST_CLEAN had a value of 0 we would still do the cleanup. I would probably use something like:

    CLEANUP => $ENV{'PG_TEST_NOCLEAN'} // 1

i.e. if it's not defined at all or has a value of undef, do the cleanup, otherwise use the value.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------uKO0rsbPA079TGbMkNuQvgn8--