From: Justin Pryzby Date: Sat, 19 Feb 2022 13:06:52 -0600 Subject: [PATCH 03/21] set TESTDIR from src/test/perl rather than Makefile/vcregress https://www.postgresql.org/message-id/flat/20220219234148.GC9008%40telsasoft.com These seem most likely to break: make check -C src/bin/psql make check -C src/bin/pgbench make check -C src/test/modules/test_misc make check -C src/test/modules/libpq_pipeline PROVE_TESTS=t/027_stream_regress.pl make check -C src/test/recovery --- src/Makefile.global.in | 9 ++++++--- src/test/perl/PostgreSQL/Test/Utils.pm | 16 +++++++++------- src/tools/msvc/vcregress.pl | 1 - 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 138d66ac006..cff13bb8087 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -451,8 +451,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" \ + PATH="$(bindir):$(CURDIR):$$PATH" \ PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \ + PG_SUBDIR='$(CURDIR)' \ PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef @@ -462,8 +463,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" \ + PATH="$(bindir):$(CURDIR):$$PATH" \ PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \ + PG_SUBDIR='$(CURDIR)' \ PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef @@ -474,7 +476,8 @@ echo "+++ tap check in $(subdir) +++" && \ rm -rf '$(CURDIR)'/tmp_check && \ $(MKDIR_P) '$(CURDIR)'/tmp_check && \ cd $(srcdir) && \ - TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \ + $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \ + PG_SUBDIR='$(CURDIR)' \ PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 1ca2cc59170..063a19b1df5 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -189,19 +189,21 @@ INIT # test may still fail, but it's more likely to report useful facts. $SIG{PIPE} = 'IGNORE'; - # 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"; + my $test_dir = File::Spec->rel2abs($ENV{PG_SUBDIR} || dirname(dirname($0))); + my $test_name = basename($0); + $test_name =~ s/\.[^.]+$//; + + $ENV{TESTDIR} = $test_dir; + + # Determine output directories, and create them. + $tmp_check = "$test_dir/tmp_check"; $log_path = "$tmp_check/log"; mkdir $tmp_check; mkdir $log_path; # Open the test log file, whose name depends on the test name. - $test_logfile = basename($0); - $test_logfile =~ s/\.[^.]+$//; - $test_logfile = "$log_path/regress_log_$test_logfile"; + $test_logfile = "$log_path/regress_log_$test_name"; open my $testlog, '>', $test_logfile or die "could not open STDOUT to logfile \"$test_logfile\": $!"; diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 2d6ccd45419..ae19ff5736b 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -291,7 +291,6 @@ sub tap_check $ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress"; $ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll"; - $ENV{TESTDIR} = "$dir"; my $module = basename $dir; # add the module build dir as the second element in the PATH $ENV{PATH} =~ s!;!;$topdir/$Config/$module;!; -- 2.17.1 --mln0rGgUGuXEqmuI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0004-s-also-remove-PATH.patch"