v3-0001-Add-TESTOUTDIR-as-directory-for-the-output-of-the.patch
text/x-diff
Filename: v3-0001-Add-TESTOUTDIR-as-directory-for-the-output-of-the.patch
Type: text/x-diff
Part: 0
Patch
Format: format-patch
Series: patch v3-0001
Subject: Add TESTOUTDIR as directory for the output of the TAP tests
| File | + | − |
|---|---|---|
| src/bin/psql/t/010_tab_completion.pl | 20 | 20 |
| src/Makefile.global.in | 7 | 4 |
| src/test/perl/PostgreSQL/Test/Utils.pm | 2 | 2 |
| src/tools/msvc/vcregress.pl | 2 | 0 |
From 3e6b833deafdfafed949abae49f171c8def689dc Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 31 May 2022 15:44:49 +0900
Subject: [PATCH v3 1/2] Add TESTOUTDIR as directory for the output of the TAP
tests
TESTDIR is the directory of the build, while TESTOUTDIR would be
generally $TESTDIR/tmp_check/.
---
src/bin/psql/t/010_tab_completion.pl | 40 +++++++++++++-------------
src/test/perl/PostgreSQL/Test/Utils.pm | 4 +--
src/Makefile.global.in | 11 ++++---
src/tools/msvc/vcregress.pl | 2 ++
4 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 2eea515e87..1f41ce47e6 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -67,26 +67,26 @@ delete $ENV{TERM};
delete $ENV{LS_COLORS};
# In a VPATH build, we'll be started in the source directory, but we want
-# 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})
+# to run in the test output directory so that we can use relative paths from
+# the tmp_check subdirectory; otherwise the output from filename completion
+# tests is too variable.
+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 1ca2cc5917..6cd3ff2caf 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -190,9 +190,9 @@ INIT
$SIG{PIPE} = 'IGNORE';
# Determine output directories, and create them. The base path is the
- # TESTDIR environment variable, which is normally set by the invoking
+ # TESTOUTDUR 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 051718e4fe..4a4e1bd4c9 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,7 +477,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)' \
+ 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)
endef
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index c3729f6be5..6f07a31464 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.36.1