Unsetting it in the shell test driver could work, 

Yep. That's what I had in mind, sorry I wasn't clear.

    to the line that actually executes the Perl script

The t/parallel-tests-log-compiler-example.sh test (copied below) is
testing Automake tests, so the script is not invoked directly, but by
Automake's oh-so-complicated test infrastructure. So I just
unset PERL5OPT in that .sh script. Admittedly that means Perl warnings
won't be fatal elsehere in the test invocation, but IMHO we can live
with that.

I could have unset PERL5OPT a few line farther down, but I thought it
was clearest to put the warning stuff together.

    Does the test rely on perl emitting a warning?

As things stand, yes. It greps the test .log for it.

Thanks for all,
Karl

#! /bin/sh
# [GPL omitted]
# 
# Test the example of usage of generic and extension-specific
# LOG_COMPILER and LOG_FLAGS given in the manual.

required=python
. test-init.sh

cat >> configure.ac <<END
AC_SUBST([PERL], ['$PERL'])
AM_PATH_PYTHON
AC_OUTPUT
END

cat > Makefile.am << 'END'
TESTS = foo.pl bar.py baz
TEST_EXTENSIONS = .pl .py
PL_LOG_COMPILER = $(PERL)
AM_PL_LOG_FLAGS = -w
PY_LOG_COMPILER = $(PYTHON)
AM_PY_LOG_FLAGS = -v
LOG_COMPILER = ./wrapper-script
AM_LOG_FLAGS = -d
END

# intentionally reversed += operator to provoke warning; thus,
# explicitly unset PERL5OPT so that PERL5OPT=-Mwarnings=FATAL,all
# in the environment won't cause a fatal error.  See ../HACKING.
unset PERL5OPT
echo 'my $a =+ 2; exit (0);' > foo.pl
echo 'import sys; sys.exit(0);' > bar.py
: > baz

cat > wrapper-script <<'END'
#!/bin/sh
echo "wrapper args: $*"
END
chmod a+x wrapper-script

$ACLOCAL
$AUTOCONF
$AUTOMAKE -a

./configure

st=0
$MAKE check || st=$?
cat foo.log
cat bar.log
cat baz.log
test $st -eq 0 || exit $st

# Check that the wrappers have been run with the expected flags.
grep '[rR]eversed.*+=.*operator.*foo\.pl' foo.log
grep '^# *[cC]lear.*sys\.argv' bar.log
grep '^wrapper args:.* -d .*baz' baz.log

:

Reply via email to