From 8544e2bb6a50bce5e2b380069ef0d62d6ea7ed3e Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 14 Feb 2022 21:47:07 -0800 Subject: [PATCH v10 14/16] wip: split TESTDIR into two --- src/bin/psql/t/010_tab_completion.pl | 34 +++++++++++++------------- src/test/perl/PostgreSQL/Test/Utils.pm | 2 +- src/Makefile.global.in | 9 ++++--- src/tools/msvc/vcregress.pl | 2 ++ 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index 2eea515e871..1e4e79fe7e1 100644 --- a/src/bin/psql/t/010_tab_completion.pl +++ b/src/bin/psql/t/010_tab_completion.pl @@ -70,23 +70,23 @@ delete $ENV{LS_COLORS}; # to run in the build directory so that we can use relative paths to # access the tmp_check subdirectory; otherwise the output from filename # completion tests is too variable. -if ($ENV{TESTDIR}) +if ($ENV{TESTOUTDIR}) { - chdir $ENV{TESTDIR} or die "could not chdir to \"$ENV{TESTDIR}\": $!"; + chdir "$ENV{TESTOUTDIR}" or die "could not chdir to \"$ENV{TESTOUTDIR}\": $!"; } # Create some junk files for filename completion testing. my $FH; -open $FH, ">", "tmp_check/somefile" - or die("could not create file \"tmp_check/somefile\": $!"); +open $FH, ">", "somefile" + or die("could not create file \"somefile\": $!"); print $FH "some stuff\n"; close $FH; -open $FH, ">", "tmp_check/afile123" - or die("could not create file \"tmp_check/afile123\": $!"); +open $FH, ">", "afile123" + or die("could not create file \"afile123\": $!"); print $FH "more stuff\n"; close $FH; -open $FH, ">", "tmp_check/afile456" - or die("could not create file \"tmp_check/afile456\": $!"); +open $FH, ">", "afile456" + or die("could not create file \"afile456\": $!"); print $FH "other stuff\n"; close $FH; @@ -272,16 +272,16 @@ clear_query(); # check filename completion check_completion( - "\\lo_import tmp_check/some\t", - qr|tmp_check/somefile |, + "\\lo_import some\t", + qr|somefile |, "filename completion with one possibility"); clear_query(); # note: readline might print a bell before the completion check_completion( - "\\lo_import tmp_check/af\t", - qr|tmp_check/af\a?ile|, + "\\lo_import af\t", + qr|af\a?ile|, "filename completion with multiple possibilities"); # broken versions of libedit require clear_line not clear_query here @@ -291,15 +291,15 @@ clear_line(); # note: broken versions of libedit want to backslash the closing quote; # not much we can do about that check_completion( - "COPY foo FROM tmp_check/some\t", - qr|'tmp_check/somefile\\?' |, + "COPY foo FROM some\t", + qr|'somefile\\?' |, "quoted filename completion with one possibility"); clear_line(); check_completion( - "COPY foo FROM tmp_check/af\t", - qr|'tmp_check/afile|, + "COPY foo FROM af\t", + qr|'afile|, "quoted filename completion with multiple possibilities"); # some versions of readline/libedit require two tabs here, some only need one @@ -307,7 +307,7 @@ check_completion( # the quotes might appear, too check_completion( "\t\t", - qr|afile123'? +'?(tmp_check/)?afile456|, + qr|afile123'? +'?afile456|, "offer multiple file choices"); clear_line(); diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 1ca2cc59170..24017a82955 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -192,7 +192,7 @@ INIT # Determine output directories, and create them. The base path is the # TESTDIR environment variable, which is normally set by the invoking # Makefile. - $tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check"; + $tmp_check = $ENV{TESTOUTDIR} ? "$ENV{TESTOUTDIR}" : "tmp_check"; $log_path = "$tmp_check/log"; mkdir $tmp_check; diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 7f1b2c52bf8..a69535ead9c 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -452,7 +452,8 @@ echo "+++ tap install-check in $(subdir) +++" && \ rm -rf '$(CURDIR)'/tmp_check && \ $(MKDIR_P) '$(CURDIR)'/tmp_check && \ cd $(srcdir) && \ - TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \ + TESTOUTDIR='$(CURDIR)/tmp_check' TESTDIR='$(CURDIR)' \ + PATH="$(bindir):$(CURDIR):$$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) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) @@ -463,8 +464,9 @@ echo "+++ tap install-check in $(subdir) +++" && \ rm -rf '$(CURDIR)'/tmp_check && \ $(MKDIR_P) '$(CURDIR)'/tmp_check && \ cd $(srcdir) && \ - TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \ - PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \ + TESTOUTDIR='$(CURDIR)/tmp_check' TESTDIR='$(CURDIR)' \ + PATH="$(bindir):$(CURDIR):$$PATH" PGPORT='6$(DEF_PGPORT)' \ + top_builddir='$(top_builddir)' \ PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef @@ -475,6 +477,7 @@ echo "+++ tap check in $(subdir) +++" && \ rm -rf '$(CURDIR)'/tmp_check && \ $(MKDIR_P) '$(CURDIR)'/tmp_check && \ cd $(srcdir) && \ + TESTOUTDIR='$(CURDIR)/tmp_check' \ 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) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index c3729f6be5e..6f07a31464d 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -296,6 +296,8 @@ sub tap_check # add the module build dir as the second element in the PATH $ENV{PATH} =~ s!;!;$topdir/$Config/$module;!; + $ENV{TESTOUTDIR} = "$dir/tmp_check"; + rmtree('tmp_check'); system(@args); my $status = $? >> 8; -- 2.37.0.3.g30cc8d0f14