Commit a409b464 authored by Peter Eisentraut's avatar Peter Eisentraut

Add configure --enable-tap-tests option

Don't skip the TAP tests anymore when IPC::Run is not found.  This will
fail normally now.
parent 3e81a33d
...@@ -729,6 +729,7 @@ CPPFLAGS ...@@ -729,6 +729,7 @@ CPPFLAGS
LDFLAGS LDFLAGS
CFLAGS CFLAGS
CC CC
enable_tap_tests
enable_dtrace enable_dtrace
DTRACEFLAGS DTRACEFLAGS
DTRACE DTRACE
...@@ -808,6 +809,7 @@ enable_debug ...@@ -808,6 +809,7 @@ enable_debug
enable_profiling enable_profiling
enable_coverage enable_coverage
enable_dtrace enable_dtrace
enable_tap_tests
with_blocksize with_blocksize
with_segsize with_segsize
with_wal_blocksize with_wal_blocksize
...@@ -1477,6 +1479,7 @@ Optional Features: ...@@ -1477,6 +1479,7 @@ Optional Features:
--enable-profiling build with profiling enabled --enable-profiling build with profiling enabled
--enable-coverage build with coverage testing instrumentation --enable-coverage build with coverage testing instrumentation
--enable-dtrace build with DTrace support --enable-dtrace build with DTrace support
--enable-tap-tests enable TAP tests (requires Perl and IPC::Run)
--enable-depend turn on automatic dependency tracking --enable-depend turn on automatic dependency tracking
--enable-cassert enable assertion checks (for debugging) --enable-cassert enable assertion checks (for debugging)
--disable-thread-safety disable thread-safety in client libraries --disable-thread-safety disable thread-safety in client libraries
...@@ -3465,6 +3468,34 @@ fi ...@@ -3465,6 +3468,34 @@ fi
#
# TAP tests
#
# Check whether --enable-tap-tests was given.
if test "${enable_tap_tests+set}" = set; then :
enableval=$enable_tap_tests;
case $enableval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-tap-tests option" "$LINENO" 5
;;
esac
else
enable_tap_tests=no
fi
# #
# Block size # Block size
# #
...@@ -14785,7 +14816,8 @@ done ...@@ -14785,7 +14816,8 @@ done
# #
# Check for test tools # Check for test tools
# #
for ac_prog in prove if test "$enable_tap_tests" = yes; then
for ac_prog in prove
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
...@@ -14827,6 +14859,13 @@ fi ...@@ -14827,6 +14859,13 @@ fi
test -n "$PROVE" && break test -n "$PROVE" && break
done done
if test -z "$PROVE"; then
as_fn_error $? "prove not found" "$LINENO" 5
fi
if test -z "$PERL"; then
as_fn_error $? "Perl not found" "$LINENO" 5
fi
fi
# Thread testing # Thread testing
......
...@@ -228,6 +228,13 @@ fi ...@@ -228,6 +228,13 @@ fi
AC_SUBST(DTRACEFLAGS)]) AC_SUBST(DTRACEFLAGS)])
AC_SUBST(enable_dtrace) AC_SUBST(enable_dtrace)
#
# TAP tests
#
PGAC_ARG_BOOL(enable, tap-tests, no,
[enable TAP tests (requires Perl and IPC::Run)])
AC_SUBST(enable_tap_tests)
# #
# Block size # Block size
# #
...@@ -1876,7 +1883,15 @@ AC_CHECK_PROGS(OSX, [osx sgml2xml sx]) ...@@ -1876,7 +1883,15 @@ AC_CHECK_PROGS(OSX, [osx sgml2xml sx])
# #
# Check for test tools # Check for test tools
# #
AC_CHECK_PROGS(PROVE, prove) if test "$enable_tap_tests" = yes; then
AC_CHECK_PROGS(PROVE, prove)
if test -z "$PROVE"; then
AC_MSG_ERROR([prove not found])
fi
if test -z "$PERL"; then
AC_MSG_ERROR([Perl not found])
fi
fi
# Thread testing # Thread testing
......
...@@ -1271,6 +1271,16 @@ su - postgres ...@@ -1271,6 +1271,16 @@ su - postgres
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>--enable-tap-tests</option></term>
<listitem>
<para>
Enable tests using the Perl TAP tools. This requires a Perl
installation and the Perl module <literal>IPC::Run</literal>.
See <xref linkend="regress-tap"> for more information.
</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</para> </para>
......
...@@ -676,7 +676,7 @@ make -C src/bin check PROVE_FLAGS='--reverse' ...@@ -676,7 +676,7 @@ make -C src/bin check PROVE_FLAGS='--reverse'
<para> <para>
The tests written in Perl require the Perl The tests written in Perl require the Perl
module <literal>IPC::Run</literal>, otherwise most tests will be skipped. module <literal>IPC::Run</literal>.
This module is available from CPAN or an operating system package. This module is available from CPAN or an operating system package.
</para> </para>
</sect1> </sect1>
......
...@@ -174,6 +174,7 @@ enable_nls = @enable_nls@ ...@@ -174,6 +174,7 @@ enable_nls = @enable_nls@
enable_debug = @enable_debug@ enable_debug = @enable_debug@
enable_dtrace = @enable_dtrace@ enable_dtrace = @enable_dtrace@
enable_coverage = @enable_coverage@ enable_coverage = @enable_coverage@
enable_tap_tests = @enable_tap_tests@
enable_thread_safety = @enable_thread_safety@ enable_thread_safety = @enable_thread_safety@
python_enable_shared = @python_enable_shared@ python_enable_shared = @python_enable_shared@
...@@ -310,6 +311,8 @@ define ld_library_path_var ...@@ -310,6 +311,8 @@ define ld_library_path_var
$(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH)) $(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH))
endef endef
ifeq ($(enable_tap_tests),yes)
define prove_installcheck define prove_installcheck
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
endef endef
...@@ -320,6 +323,11 @@ $(MAKE) -C $(top_builddir) DESTDIR='$(CURDIR)'/tmp_check/install install >'$(CUR ...@@ -320,6 +323,11 @@ $(MAKE) -C $(top_builddir) DESTDIR='$(CURDIR)'/tmp_check/install install >'$(CUR
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(CURDIR)/tmp_check/install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(CURDIR)/tmp_check/install$(libdir)) PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(CURDIR)/tmp_check/install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(CURDIR)/tmp_check/install$(libdir)) PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
endef endef
else
prove_installcheck = @echo "TAP tests not enabled"
prove_check = $(prove_installcheck)
endif
# Installation. # Installation.
install_bin = @install_bin@ install_bin = @install_bin@
......
...@@ -25,19 +25,9 @@ our @EXPORT = qw( ...@@ -25,19 +25,9 @@ our @EXPORT = qw(
use Cwd; use Cwd;
use File::Spec; use File::Spec;
use File::Temp (); use File::Temp ();
use IPC::Run qw(run start);
use Test::More; use Test::More;
BEGIN
{
eval {
require IPC::Run;
import IPC::Run qw(run start);
1;
} or do
{
plan skip_all => "IPC::Run not available";
};
}
# Set to untranslated messages, to be able to compare program output # Set to untranslated messages, to be able to compare program output
# with expected strings. # with expected strings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment