Skip to content

Commit bb54bf2

Browse files
committed
Don't hardcode tmp_check/ as test directory for tap tests
This is motivated by the meson patchset, which wants to put the log / data for tests in a different place than the autoconf build. Right now log files for tap tests have to be inside $TESTDIR/tmp_check, whereas log files for pg_regress/isolationtester are outside of tmp_check. This change doesn't fix the latter, but is a prerequisite. The only test that needs adjustment is 010_tab_completion.pl, as it hardcoded the tmp_check/ directory. Instead create a dedicated directory for the test files. It's also a bit cleaner independently, because it doesn't intermingle the test files with more important things like the log/ directory. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/1131990.1660661896@sss.pgh.pa.us Discussion: https://postgr.es/m/d861493c-ed20-c251-7a89-7924f5197341@enterprisedb.com
1 parent 4bac960 commit bb54bf2

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/Makefile.global.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ echo "+++ tap install-check in $(subdir) +++" && \
451451
rm -rf '$(CURDIR)'/tmp_check && \
452452
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
453453
cd $(srcdir) && \
454-
TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
454+
TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
455455
PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \
456456
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
457457
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
@@ -462,7 +462,7 @@ echo "+++ tap install-check in $(subdir) +++" && \
462462
rm -rf '$(CURDIR)'/tmp_check && \
463463
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
464464
cd $(srcdir) && \
465-
TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
465+
TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
466466
PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \
467467
PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \
468468
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
@@ -474,7 +474,7 @@ echo "+++ tap check in $(subdir) +++" && \
474474
rm -rf '$(CURDIR)'/tmp_check && \
475475
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
476476
cd $(srcdir) && \
477-
TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
477+
TESTDIR='$(CURDIR)/tmp_check' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
478478
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
479479
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
480480
endef

src/bin/psql/t/010_tab_completion.pl

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,26 @@
6868

6969
# In a VPATH build, we'll be started in the source directory, but we want
7070
# to run in the build directory so that we can use relative paths to
71-
# access the tmp_check subdirectory; otherwise the output from filename
71+
# access the tab_comp_dir subdirectory; otherwise the output from filename
7272
# completion tests is too variable.
7373
if ($ENV{TESTDIR})
7474
{
7575
chdir $ENV{TESTDIR} or die "could not chdir to \"$ENV{TESTDIR}\": $!";
7676
}
7777

7878
# Create some junk files for filename completion testing.
79+
mkdir "tab_comp_dir";
7980
my $FH;
80-
open $FH, ">", "tmp_check/somefile"
81-
or die("could not create file \"tmp_check/somefile\": $!");
81+
open $FH, ">", "tab_comp_dir/somefile"
82+
or die("could not create file \"tab_comp_dir/somefile\": $!");
8283
print $FH "some stuff\n";
8384
close $FH;
84-
open $FH, ">", "tmp_check/afile123"
85-
or die("could not create file \"tmp_check/afile123\": $!");
85+
open $FH, ">", "tab_comp_dir/afile123"
86+
or die("could not create file \"tab_comp_dir/afile123\": $!");
8687
print $FH "more stuff\n";
8788
close $FH;
88-
open $FH, ">", "tmp_check/afile456"
89-
or die("could not create file \"tmp_check/afile456\": $!");
89+
open $FH, ">", "tab_comp_dir/afile456"
90+
or die("could not create file \"tab_comp_dir/afile456\": $!");
9091
print $FH "other stuff\n";
9192
close $FH;
9293

@@ -272,16 +273,16 @@ sub clear_line
272273

273274
# check filename completion
274275
check_completion(
275-
"\\lo_import tmp_check/some\t",
276-
qr|tmp_check/somefile |,
276+
"\\lo_import tab_comp_dir/some\t",
277+
qr|tab_comp_dir/somefile |,
277278
"filename completion with one possibility");
278279

279280
clear_query();
280281

281282
# note: readline might print a bell before the completion
282283
check_completion(
283-
"\\lo_import tmp_check/af\t",
284-
qr|tmp_check/af\a?ile|,
284+
"\\lo_import tab_comp_dir/af\t",
285+
qr|tab_comp_dir/af\a?ile|,
285286
"filename completion with multiple possibilities");
286287

287288
# broken versions of libedit require clear_line not clear_query here
@@ -291,23 +292,23 @@ sub clear_line
291292
# note: broken versions of libedit want to backslash the closing quote;
292293
# not much we can do about that
293294
check_completion(
294-
"COPY foo FROM tmp_check/some\t",
295-
qr|'tmp_check/somefile\\?' |,
295+
"COPY foo FROM tab_comp_dir/some\t",
296+
qr|'tab_comp_dir/somefile\\?' |,
296297
"quoted filename completion with one possibility");
297298

298299
clear_line();
299300

300301
check_completion(
301-
"COPY foo FROM tmp_check/af\t",
302-
qr|'tmp_check/afile|,
302+
"COPY foo FROM tab_comp_dir/af\t",
303+
qr|'tab_comp_dir/afile|,
303304
"quoted filename completion with multiple possibilities");
304305

305306
# some versions of readline/libedit require two tabs here, some only need one
306307
# also, some will offer the whole path name and some just the file name
307308
# the quotes might appear, too
308309
check_completion(
309310
"\t\t",
310-
qr|afile123'? +'?(tmp_check/)?afile456|,
311+
qr|afile123'? +'?(tab_comp_dir/)?afile456|,
311312
"offer multiple file choices");
312313

313314
clear_line();

src/test/perl/PostgreSQL/Test/Utils.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ INIT
192192
# Determine output directories, and create them. The base path is the
193193
# TESTDIR environment variable, which is normally set by the invoking
194194
# Makefile.
195-
$tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check";
195+
$tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}" : "tmp_check";
196196
$log_path = "$tmp_check/log";
197197

198198
mkdir $tmp_check;

src/tools/msvc/vcregress.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ sub tap_check
291291
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
292292
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
293293

294-
$ENV{TESTDIR} = "$dir";
294+
$ENV{TESTDIR} = "$dir/tmp_check";
295295
my $module = basename $dir;
296296
# add the module build dir as the second element in the PATH
297297
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy