mirror of
https://github.com/postgres/postgres.git
synced 2025-07-24 14:22:24 +03:00
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
This commit is contained in:
@ -451,7 +451,7 @@ echo "+++ tap install-check in $(subdir) +++" && \
|
|||||||
rm -rf '$(CURDIR)'/tmp_check && \
|
rm -rf '$(CURDIR)'/tmp_check && \
|
||||||
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
|
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
|
||||||
cd $(srcdir) && \
|
cd $(srcdir) && \
|
||||||
TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
|
TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
|
||||||
PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \
|
PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \
|
||||||
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
|
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
|
||||||
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
||||||
@ -462,7 +462,7 @@ echo "+++ tap install-check in $(subdir) +++" && \
|
|||||||
rm -rf '$(CURDIR)'/tmp_check && \
|
rm -rf '$(CURDIR)'/tmp_check && \
|
||||||
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
|
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
|
||||||
cd $(srcdir) && \
|
cd $(srcdir) && \
|
||||||
TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
|
TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
|
||||||
PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \
|
PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \
|
||||||
PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \
|
PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \
|
||||||
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
||||||
@ -474,7 +474,7 @@ echo "+++ tap check in $(subdir) +++" && \
|
|||||||
rm -rf '$(CURDIR)'/tmp_check && \
|
rm -rf '$(CURDIR)'/tmp_check && \
|
||||||
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
|
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
|
||||||
cd $(srcdir) && \
|
cd $(srcdir) && \
|
||||||
TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
|
TESTDIR='$(CURDIR)/tmp_check' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
|
||||||
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
|
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
|
||||||
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
||||||
endef
|
endef
|
||||||
|
@ -68,7 +68,7 @@ delete $ENV{LS_COLORS};
|
|||||||
|
|
||||||
# In a VPATH build, we'll be started in the source directory, but we want
|
# 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
|
# to run in the build directory so that we can use relative paths to
|
||||||
# access the tmp_check subdirectory; otherwise the output from filename
|
# access the tab_comp_dir subdirectory; otherwise the output from filename
|
||||||
# completion tests is too variable.
|
# completion tests is too variable.
|
||||||
if ($ENV{TESTDIR})
|
if ($ENV{TESTDIR})
|
||||||
{
|
{
|
||||||
@ -76,17 +76,18 @@ if ($ENV{TESTDIR})
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create some junk files for filename completion testing.
|
# Create some junk files for filename completion testing.
|
||||||
|
mkdir "tab_comp_dir";
|
||||||
my $FH;
|
my $FH;
|
||||||
open $FH, ">", "tmp_check/somefile"
|
open $FH, ">", "tab_comp_dir/somefile"
|
||||||
or die("could not create file \"tmp_check/somefile\": $!");
|
or die("could not create file \"tab_comp_dir/somefile\": $!");
|
||||||
print $FH "some stuff\n";
|
print $FH "some stuff\n";
|
||||||
close $FH;
|
close $FH;
|
||||||
open $FH, ">", "tmp_check/afile123"
|
open $FH, ">", "tab_comp_dir/afile123"
|
||||||
or die("could not create file \"tmp_check/afile123\": $!");
|
or die("could not create file \"tab_comp_dir/afile123\": $!");
|
||||||
print $FH "more stuff\n";
|
print $FH "more stuff\n";
|
||||||
close $FH;
|
close $FH;
|
||||||
open $FH, ">", "tmp_check/afile456"
|
open $FH, ">", "tab_comp_dir/afile456"
|
||||||
or die("could not create file \"tmp_check/afile456\": $!");
|
or die("could not create file \"tab_comp_dir/afile456\": $!");
|
||||||
print $FH "other stuff\n";
|
print $FH "other stuff\n";
|
||||||
close $FH;
|
close $FH;
|
||||||
|
|
||||||
@ -272,16 +273,16 @@ clear_query();
|
|||||||
|
|
||||||
# check filename completion
|
# check filename completion
|
||||||
check_completion(
|
check_completion(
|
||||||
"\\lo_import tmp_check/some\t",
|
"\\lo_import tab_comp_dir/some\t",
|
||||||
qr|tmp_check/somefile |,
|
qr|tab_comp_dir/somefile |,
|
||||||
"filename completion with one possibility");
|
"filename completion with one possibility");
|
||||||
|
|
||||||
clear_query();
|
clear_query();
|
||||||
|
|
||||||
# note: readline might print a bell before the completion
|
# note: readline might print a bell before the completion
|
||||||
check_completion(
|
check_completion(
|
||||||
"\\lo_import tmp_check/af\t",
|
"\\lo_import tab_comp_dir/af\t",
|
||||||
qr|tmp_check/af\a?ile|,
|
qr|tab_comp_dir/af\a?ile|,
|
||||||
"filename completion with multiple possibilities");
|
"filename completion with multiple possibilities");
|
||||||
|
|
||||||
# broken versions of libedit require clear_line not clear_query here
|
# broken versions of libedit require clear_line not clear_query here
|
||||||
@ -291,15 +292,15 @@ clear_line();
|
|||||||
# note: broken versions of libedit want to backslash the closing quote;
|
# note: broken versions of libedit want to backslash the closing quote;
|
||||||
# not much we can do about that
|
# not much we can do about that
|
||||||
check_completion(
|
check_completion(
|
||||||
"COPY foo FROM tmp_check/some\t",
|
"COPY foo FROM tab_comp_dir/some\t",
|
||||||
qr|'tmp_check/somefile\\?' |,
|
qr|'tab_comp_dir/somefile\\?' |,
|
||||||
"quoted filename completion with one possibility");
|
"quoted filename completion with one possibility");
|
||||||
|
|
||||||
clear_line();
|
clear_line();
|
||||||
|
|
||||||
check_completion(
|
check_completion(
|
||||||
"COPY foo FROM tmp_check/af\t",
|
"COPY foo FROM tab_comp_dir/af\t",
|
||||||
qr|'tmp_check/afile|,
|
qr|'tab_comp_dir/afile|,
|
||||||
"quoted filename completion with multiple possibilities");
|
"quoted filename completion with multiple possibilities");
|
||||||
|
|
||||||
# some versions of readline/libedit require two tabs here, some only need one
|
# some versions of readline/libedit require two tabs here, some only need one
|
||||||
@ -307,7 +308,7 @@ check_completion(
|
|||||||
# the quotes might appear, too
|
# the quotes might appear, too
|
||||||
check_completion(
|
check_completion(
|
||||||
"\t\t",
|
"\t\t",
|
||||||
qr|afile123'? +'?(tmp_check/)?afile456|,
|
qr|afile123'? +'?(tab_comp_dir/)?afile456|,
|
||||||
"offer multiple file choices");
|
"offer multiple file choices");
|
||||||
|
|
||||||
clear_line();
|
clear_line();
|
||||||
|
@ -192,7 +192,7 @@ INIT
|
|||||||
# Determine output directories, and create them. The base path is the
|
# Determine output directories, and create them. The base path is the
|
||||||
# TESTDIR environment variable, which is normally set by the invoking
|
# TESTDIR environment variable, which is normally set by the invoking
|
||||||
# Makefile.
|
# Makefile.
|
||||||
$tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check";
|
$tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}" : "tmp_check";
|
||||||
$log_path = "$tmp_check/log";
|
$log_path = "$tmp_check/log";
|
||||||
|
|
||||||
mkdir $tmp_check;
|
mkdir $tmp_check;
|
||||||
|
@ -291,7 +291,7 @@ sub tap_check
|
|||||||
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
|
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
|
||||||
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
|
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
|
||||||
|
|
||||||
$ENV{TESTDIR} = "$dir";
|
$ENV{TESTDIR} = "$dir/tmp_check";
|
||||||
my $module = basename $dir;
|
my $module = basename $dir;
|
||||||
# add the module build dir as the second element in the PATH
|
# add the module build dir as the second element in the PATH
|
||||||
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;
|
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;
|
||||||
|
Reference in New Issue
Block a user