On 08/09/2015 08:41 AM, Michael Paquier wrote:
On Sun, Aug 9, 2015 at 1:40 AM, Andrew Dunstan <and...@dunslane.net> wrote:
On 08/08/2015 09:31 AM, Robert Haas wrote:
On Fri, Aug 7, 2015 at 7:17 PM, Andrew Dunstan <and...@dunslane.net>
wrote:
That certainly isn't what happens, and given the way this is done in
TestLib.pm, using the CLEANUP parameter of File::Temp's tempdir()
function,
it's not clear how we could do that easily.
<shot-in-the-dark>

Set cleanup to false and manually remove the directory later in the
code, so that stuff runs only if we haven't died sooner?

</shot-in-the-dark>

Yeah, maybe. I'm thinking of trying to do it more globally, like in
src/Makefile.global.in. That way we wouldn't have to add new code to every
test file.
If we rely on END to clean up the temporary data folder, there is no
need to impact each test file, just the test functions called in
TestLib.pm that could switch a flag to not perform any cleanup at the
end of the run should an unexpected result be found. Now I am as well
curious to see what you have in mind with manipulating
Makefile.global.


See attached. If you have a better idea please post your patch.

cheers

andrew
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 39a7879..b379376 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -349,12 +349,12 @@ endef
 ifeq ($(enable_tap_tests),yes)
 
 define prove_installcheck
-cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
+cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl && rm -rf $(CURDIR)/tmp_test*
 endef
 
 define prove_check
 rm -rf $(CURDIR)/tmp_check/log
-cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
+cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl && rm -rf $(CURDIR)/tmp_test*
 endef
 
 else
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 4927d45..174566c 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -113,7 +113,7 @@ sub tempdir
 	return File::Temp::tempdir(
 		'tmp_testXXXX',
 		DIR => $ENV{TESTDIR} || cwd(),
-		CLEANUP => 1);
+		CLEANUP => 0);
 }
 
 sub tempdir_short
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to