Skip to content

Commit a409b46

Browse files
committed
Add configure --enable-tap-tests option
Don't skip the TAP tests anymore when IPC::Run is not found. This will fail normally now.
1 parent 3e81a33 commit a409b46

File tree

6 files changed

+76
-14
lines changed

6 files changed

+76
-14
lines changed

configure

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ CPPFLAGS
729729
LDFLAGS
730730
CFLAGS
731731
CC
732+
enable_tap_tests
732733
enable_dtrace
733734
DTRACEFLAGS
734735
DTRACE
@@ -808,6 +809,7 @@ enable_debug
808809
enable_profiling
809810
enable_coverage
810811
enable_dtrace
812+
enable_tap_tests
811813
with_blocksize
812814
with_segsize
813815
with_wal_blocksize
@@ -1477,6 +1479,7 @@ Optional Features:
14771479
--enable-profiling build with profiling enabled
14781480
--enable-coverage build with coverage testing instrumentation
14791481
--enable-dtrace build with DTrace support
1482+
--enable-tap-tests enable TAP tests (requires Perl and IPC::Run)
14801483
--enable-depend turn on automatic dependency tracking
14811484
--enable-cassert enable assertion checks (for debugging)
14821485
--disable-thread-safety disable thread-safety in client libraries
@@ -3465,6 +3468,34 @@ fi
34653468

34663469

34673470

3471+
#
3472+
# TAP tests
3473+
#
3474+
3475+
3476+
# Check whether --enable-tap-tests was given.
3477+
if test "${enable_tap_tests+set}" = set; then :
3478+
enableval=$enable_tap_tests;
3479+
case $enableval in
3480+
yes)
3481+
:
3482+
;;
3483+
no)
3484+
:
3485+
;;
3486+
*)
3487+
as_fn_error $? "no argument expected for --enable-tap-tests option" "$LINENO" 5
3488+
;;
3489+
esac
3490+
3491+
else
3492+
enable_tap_tests=no
3493+
3494+
fi
3495+
3496+
3497+
3498+
34683499
#
34693500
# Block size
34703501
#
@@ -14785,7 +14816,8 @@ done
1478514816
#
1478614817
# Check for test tools
1478714818
#
14788-
for ac_prog in prove
14819+
if test "$enable_tap_tests" = yes; then
14820+
for ac_prog in prove
1478914821
do
1479014822
# Extract the first word of "$ac_prog", so it can be a program name with args.
1479114823
set dummy $ac_prog; ac_word=$2
@@ -14827,6 +14859,13 @@ fi
1482714859
test -n "$PROVE" && break
1482814860
done
1482914861

14862+
if test -z "$PROVE"; then
14863+
as_fn_error $? "prove not found" "$LINENO" 5
14864+
fi
14865+
if test -z "$PERL"; then
14866+
as_fn_error $? "Perl not found" "$LINENO" 5
14867+
fi
14868+
fi
1483014869

1483114870
# Thread testing
1483214871

configure.in

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ fi
228228
AC_SUBST(DTRACEFLAGS)])
229229
AC_SUBST(enable_dtrace)
230230

231+
#
232+
# TAP tests
233+
#
234+
PGAC_ARG_BOOL(enable, tap-tests, no,
235+
[enable TAP tests (requires Perl and IPC::Run)])
236+
AC_SUBST(enable_tap_tests)
237+
231238
#
232239
# Block size
233240
#
@@ -1876,7 +1883,15 @@ AC_CHECK_PROGS(OSX, [osx sgml2xml sx])
18761883
#
18771884
# Check for test tools
18781885
#
1879-
AC_CHECK_PROGS(PROVE, prove)
1886+
if test "$enable_tap_tests" = yes; then
1887+
AC_CHECK_PROGS(PROVE, prove)
1888+
if test -z "$PROVE"; then
1889+
AC_MSG_ERROR([prove not found])
1890+
fi
1891+
if test -z "$PERL"; then
1892+
AC_MSG_ERROR([Perl not found])
1893+
fi
1894+
fi
18801895

18811896
# Thread testing
18821897

doc/src/sgml/installation.sgml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,16 @@ su - postgres
12711271
</listitem>
12721272
</varlistentry>
12731273

1274+
<varlistentry>
1275+
<term><option>--enable-tap-tests</option></term>
1276+
<listitem>
1277+
<para>
1278+
Enable tests using the Perl TAP tools. This requires a Perl
1279+
installation and the Perl module <literal>IPC::Run</literal>.
1280+
See <xref linkend="regress-tap"> for more information.
1281+
</para>
1282+
</listitem>
1283+
</varlistentry>
12741284
</variablelist>
12751285
</para>
12761286

doc/src/sgml/regress.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ make -C src/bin check PROVE_FLAGS='--reverse'
676676

677677
<para>
678678
The tests written in Perl require the Perl
679-
module <literal>IPC::Run</literal>, otherwise most tests will be skipped.
679+
module <literal>IPC::Run</literal>.
680680
This module is available from CPAN or an operating system package.
681681
</para>
682682
</sect1>

src/Makefile.global.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ enable_nls = @enable_nls@
174174
enable_debug = @enable_debug@
175175
enable_dtrace = @enable_dtrace@
176176
enable_coverage = @enable_coverage@
177+
enable_tap_tests = @enable_tap_tests@
177178
enable_thread_safety = @enable_thread_safety@
178179

179180
python_enable_shared = @python_enable_shared@
@@ -310,6 +311,8 @@ define ld_library_path_var
310311
$(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH))
311312
endef
312313

314+
ifeq ($(enable_tap_tests),yes)
315+
313316
define prove_installcheck
314317
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
315318
endef
@@ -320,6 +323,11 @@ $(MAKE) -C $(top_builddir) DESTDIR='$(CURDIR)'/tmp_check/install install >'$(CUR
320323
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
321324
endef
322325

326+
else
327+
prove_installcheck = @echo "TAP tests not enabled"
328+
prove_check = $(prove_installcheck)
329+
endif
330+
323331
# Installation.
324332

325333
install_bin = @install_bin@

src/test/perl/TestLib.pm

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,9 @@ our @EXPORT = qw(
2525
use Cwd;
2626
use File::Spec;
2727
use File::Temp ();
28+
use IPC::Run qw(run start);
2829
use Test::More;
2930

30-
BEGIN
31-
{
32-
eval {
33-
require IPC::Run;
34-
import IPC::Run qw(run start);
35-
1;
36-
} or do
37-
{
38-
plan skip_all => "IPC::Run not available";
39-
};
40-
}
4131

4232
# Set to untranslated messages, to be able to compare program output
4333
# with expected strings.

0 commit comments

Comments
 (0)