Re: [PATCH] {maint} Improve and extend tests `man*.test'.

2010-11-11 Thread Stefano Lattarini
On Monday 08 November 2010, Stefano Lattarini wrote:
> Pinging this patch again, following this:
>  
Merged to master, and pushed.

Regards,
  Stefano



Re: [PATCH] Minor improvements and extensions to various tests.

2010-11-11 Thread Stefano Lattarini
On Monday 08 November 2010, Stefano Lattarini wrote:
> Pinging this patch again, following this:
>  
> 
> There should be no need to rebase the patch (which is based off of maint),
> so that I should just be able to merge it into master from the copy in my
> local automake repository.
> 
> Regards,
>Stefano
> 
Merged to master, and pushed.

Regards,
  Stefano



Re: [PATCH] {tests-init} Tests defs: improve messages for skipped tests.

2010-11-11 Thread Stefano Lattarini
On Thursday 11 November 2010, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Thu, Nov 11, 2010 at 09:10:39PM CET:
> > On Thursday 11 November 2010, Ralf Wildenhues wrote:
> > > * Stefano Lattarini wrote on Thu, Nov 11, 2010 at 02:52:06PM CET:
> 
> > > > @@ -228,11 +229,16 @@ do
> > > >(echo foo >> $priv_check_temp) >/dev/null 2>&1
> > > >overwrite_status=$?
> > > >rm -f $priv_check_temp
> > > > -  test $overwrite_status = 0 && exit 77
> > > > +  if test $overwrite_status = 0; then
> > > 
> > > -eq seems more appropriate than = (more instances below).
> > OK.
> 
> Sorry for making you fix bugs that were there before BTW.
No problem at all (even if I wouldn't define those as bugs).
 
> > > > +echo "$me: this test shouldn't be run as root"
> > > 
> > > Please >&2, several instances.
> > I used stdout for "consistency" with messages like:
> >   echo "$me: running $CC --version"
> >   echo "$me: running python -V"
> 
> But those aren't errors.  I know it's a close call for the above
> messages, but for error messages, stderr is definitely right.
> 
> > But I have no strong feelings on this matter, so I went along with
> > the ">&2" redirections throughout.
> 
> Thanks.
> 
> > > >  perl-threads)
> > > > -  # Skip with Devel::Cover: it cannot cope with threads.
> > > > -  test "$WANT_NO_THREADS" = yes && exit 77
> > > > +  if test x"$WANT_NO_THREADS" = x"yes"; then
> > > 
> > > no need to quote `yes', and in practice, no need for x prefixing either,
> > > I would guess.  Do you think we need to take care of malicious users?
> > No, it's just for consistency.  Because sometimes the idiom
> >   test x"$foo" = x"bar"
> > is indeed required, I prefer to use it everywhere, instead of asking myself
> > at every turn "do I need to care for white spaces in $foo here?" or "do I
> > need to care for leading hypens in $foo here?".  That's all.
> 
> Well, the quotes around bar are never required (except in Libtool and
> there only because out testsuite is too dumb to not flag the false
> positives).
True, but they make "stick out" what is supposed to be compared with $foo.
A moot point here anyway, since I've reverted this change and the other
similar ones.

> > Do toy want me to use:
> >   test $WANT_NO_THREADS = yes
> > anyway?
> 
> No.  You need to put double quotes around "$WANT_NO_THREADS", because it
> can be empty.
OK.
 
> The rest is not a big deal either way, but if you want to avoid asking
> yourself at every turn, then I just suggest not changing existing code
> at that turn unless you see a good reason.  ;-)
> 
> > > >  tex)
> > > ># No all versions of Tex support `--version', so we use
> > > ># a configure check.
> > > > -  test -n "$TEX" || exit 77
> > > > +  if test x"$TEX" = x; then
> > > 
> > > test -n is portable here and more concise, $TEX will never start with
> > > a '-' character or be equal to '=' for any sane user.  So let's please
> > > keep that.
> > Well, we should use `test -z' at least, since the semantic of the check
> > has been reversed.  Also, `test -z' can sometimes be problematic too, and
> > I tend to avoid it altogheter for the same "consistency" resons stated
> > above.
> > 
> > Do you want me to use `tezt -z' anyway here?
> 
> Sure.
Done (sweating and cringing throughout ;-)

> > > > @@ -285,6 +298,37 @@ do
> > > >esac
> > > >  done
> > > 
> > > The rest of the patch from here on below seems to only transpose testing
> > > of $required and testing of some other variable.  In essence for the
> > > default case it turns one case statement into three (thus a minor
> > > slowdown), little code into more code, and I fail to see the advantage
> > > of the new ordering.  What is the intention here?
> > Giving precise resons about why the test was skipped.
> 
> Ah; that's a good reason.  Thanks.
Glad you're ok with this change.

> > > > -case $testsrcdir,$testbuilddir in
> > > > -  *\ * | *\*) exit 77;;
> > > > +  *' libtool '*|*' libtoolize '*)
> > > > +if test x"$libtool_found" != x"yes"; then
> > > 
> > > The old code was perfectly well quoted: in
> > >   test $libtool_found = yes 
> > > you would reliably and helpfully get a shell error if $libtool_found was
> > > erroneously unset.  Also, we ensure that it could not start with '-'.
> > True, but see the "consistency" reasons stated above.  Do you want me to
> > revert to the  older (lack of) quoting anyway?
> 
> Yes, please.  Think of it as a check of your other changes in the code.
> ;-)
Done.

> Thanks, and please commit the patch when items are addressed,
Done, and merged to master.

Attached is the final version of the patch, JFTR.

Regards,
  Stefano
From f3a5d05517c8f60cc515c835cc15cd86e2b39abd Mon Sep 17 00:00:00 2001
From: Stefano Lattarini 
Date: Thu, 11 Nov 2010 14:49:39 +0100
Subject: [PATCH] Tests defs: improve messages for skipped tests.

* tests/defs: Give meaningful messages about the reasons of a
test s

Re: [PATCH] {tests-init} Tests defs: improve messages for skipped tests.

2010-11-11 Thread Ralf Wildenhues
* Stefano Lattarini wrote on Thu, Nov 11, 2010 at 09:10:39PM CET:
> On Thursday 11 November 2010, Ralf Wildenhues wrote:
> > * Stefano Lattarini wrote on Thu, Nov 11, 2010 at 02:52:06PM CET:

> > > @@ -228,11 +229,16 @@ do
> > >(echo foo >> $priv_check_temp) >/dev/null 2>&1
> > >overwrite_status=$?
> > >rm -f $priv_check_temp
> > > -  test $overwrite_status = 0 && exit 77
> > > +  if test $overwrite_status = 0; then
> > 
> > -eq seems more appropriate than = (more instances below).
> OK.

Sorry for making you fix bugs that were there before BTW.

> > > +echo "$me: this test shouldn't be run as root"
> > 
> > Please >&2, several instances.
> I used stdout for "consistency" with messages like:
>   echo "$me: running $CC --version"
>   echo "$me: running python -V"

But those aren't errors.  I know it's a close call for the above
messages, but for error messages, stderr is definitely right.

> But I have no strong feelings on this matter, so I went along with
> the ">&2" redirections throughout.

Thanks.

> > >  perl-threads)
> > > -  # Skip with Devel::Cover: it cannot cope with threads.
> > > -  test "$WANT_NO_THREADS" = yes && exit 77
> > > +  if test x"$WANT_NO_THREADS" = x"yes"; then
> > 
> > no need to quote `yes', and in practice, no need for x prefixing either,
> > I would guess.  Do you think we need to take care of malicious users?
> No, it's just for consistency.  Because sometimes the idiom
>   test x"$foo" = x"bar"
> is indeed required, I prefer to use it everywhere, instead of asking myself
> at every turn "do I need to care for white spaces in $foo here?" or "do I
> need to care for leading hypens in $foo here?".  That's all.

Well, the quotes around bar are never required (except in Libtool and
there only because out testsuite is too dumb to not flag the false
positives).

> Do toy want me to use:
>   test $WANT_NO_THREADS = yes
> anyway?

No.  You need to put double quotes around "$WANT_NO_THREADS", because it
can be empty.

The rest is not a big deal either way, but if you want to avoid asking
yourself at every turn, then I just suggest not changing existing code
at that turn unless you see a good reason.  ;-)

> > >  tex)
> > ># No all versions of Tex support `--version', so we use
> > ># a configure check.
> > > -  test -n "$TEX" || exit 77
> > > +  if test x"$TEX" = x; then
> > 
> > test -n is portable here and more concise, $TEX will never start with
> > a '-' character or be equal to '=' for any sane user.  So let's please
> > keep that.
> Well, we should use `test -z' at least, since the semantic of the check
> has been reversed.  Also, `test -z' can sometimes be problematic too, and
> I tend to avoid it altogheter for the same "consistency" resons stated
> above.
> 
> Do you want me to use `tezt -z' anyway here?

Sure.

> > > @@ -285,6 +298,37 @@ do
> > >esac
> > >  done
> > 
> > The rest of the patch from here on below seems to only transpose testing
> > of $required and testing of some other variable.  In essence for the
> > default case it turns one case statement into three (thus a minor
> > slowdown), little code into more code, and I fail to see the advantage
> > of the new ordering.  What is the intention here?
> Giving precise resons about why the test was skipped.

Ah; that's a good reason.  Thanks.

> > > -case $testsrcdir,$testbuilddir in
> > > -  *\ * | *\  *) exit 77;;
> > > +  *' libtool '*|*' libtoolize '*)
> > > +if test x"$libtool_found" != x"yes"; then
> > 
> > The old code was perfectly well quoted: in
> >   test $libtool_found = yes 
> > you would reliably and helpfully get a shell error if $libtool_found was
> > erroneously unset.  Also, we ensure that it could not start with '-'.
> True, but see the "consistency" reasons stated above.  Do you want me to
> revert to the  older (lack of) quoting anyway?

Yes, please.  Think of it as a check of your other changes in the code.
;-)

Thanks, and please commit the patch when items are addressed,
Ralf



Re: [PATCH] {tests-init} Tests defs: improve messages for skipped tests.

2010-11-11 Thread Stefano Lattarini
On Thursday 11 November 2010, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Thu, Nov 11, 2010 at 02:52:06PM CET:
> > Tests defs: improve messages for skipped tests.
> > 
> > * tests/defs: Give meaningful messages about the reasons of a
> > test skip; this is especially useful as this file is run without
> > verbose xtraces on.  Related reorderings in the code and new
> > comments.
> 
> I have some nits below, and a couple of questions.
> 
> Thanks,
> Ralf
> 
> > --- a/tests/defs
> > +++ b/tests/defs
> > @@ -192,6 +192,7 @@ do
> >export GCJ
> >echo "$me: running $GCJ --version"
> >( $GCJ --version ) || exit 77
> > +  echo "$me: running $GCJ -v"
> >( $GCJ -v ) || exit 77
> >;;
> >  g++)
> > @@ -228,11 +229,16 @@ do
> >(echo foo >> $priv_check_temp) >/dev/null 2>&1
> >overwrite_status=$?
> >rm -f $priv_check_temp
> > -  test $overwrite_status = 0 && exit 77
> > +  if test $overwrite_status = 0; then
> 
> -eq seems more appropriate than = (more instances below).
OK.

> 
> > +echo "$me: this test shouldn't be run as root"
> 
> Please >&2, several instances.
I used stdout for "consistency" with messages like:
  echo "$me: running $CC --version"
  echo "$me: running python -V"
But I have no strong feelings on this matter, so I went along with
the ">&2" redirections throughout.

> 
> Also, the message could be more precise, as it will also trigger on
> systems without unix style permissions.  How about the following:
>   $me: cannot drop file write permissions
> 
> and similar for ro-dir below?
Agreed.

> 
> > +exit 77
> > +  fi
> >;;
> >  perl-threads)
> > -  # Skip with Devel::Cover: it cannot cope with threads.
> > -  test "$WANT_NO_THREADS" = yes && exit 77
> > +  if test x"$WANT_NO_THREADS" = x"yes"; then
> 
> no need to quote `yes', and in practice, no need for x prefixing either,
> I would guess.  Do you think we need to take care of malicious users?
No, it's just for consistency.  Because sometimes the idiom
  test x"$foo" = x"bar"
is indeed required, I prefer to use it everywhere, instead of asking myself
at every turn "do I need to care for white spaces in $foo here?" or "do I
need to care for leading hypens in $foo here?".  That's all.

Do toy want me to use:
  test $WANT_NO_THREADS = yes
anyway?

> 
> > +echo "$me: skip with Devel::Cover: it cannot cope with threads."
> 
> no final period (several more instances below).
All fixed.

> I'd drop the 'it'.
> 
> > +exit 77
> > +  fi
> >;;
> >  python)
> ># Python doesn't support --version, it has -V
> > @@ -248,7 +254,10 @@ do
> >(: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
> >create_status=$?
> >rm -rf $ro_dir_temp
> > -  test $create_status = 0 && exit 77
> > +  if test $create_status = 0; then
> > +echo "$me: support of read-only directories is required"
> > +exit 77
> > +  fi
> >;;
> >  rst2html)
> ># Try the variants that are tried in check.am.
> > @@ -257,6 +266,7 @@ do
> >echo "$me: running $r2h --version"
> >$r2h --version && break 2
> >  done
> > +echo "$me: no proper rst2html program found"
> >  exit 77
> >done
> >;;
> > @@ -264,13 +274,16 @@ do
> ># DejaGnu's runtest program. We rely on being able to specify
> ># the program on the runtest command-line. This requires
> ># DejaGnu 1.4.3 or later.
> > -  echo "$me: running runtest --version"
> > +  echo "$me: running runtest SOMEPROGRAM=someprogram --version"
> >(runtest SOMEPROGRAM=someprogram --version) || exit 77
> >;;
> >  tex)
> ># No all versions of Tex support `--version', so we use
> ># a configure check.
> > -  test -n "$TEX" || exit 77
> > +  if test x"$TEX" = x; then
> 
> test -n is portable here and more concise, $TEX will never start with
> a '-' character or be equal to '=' for any sane user.  So let's please
> keep that.
Well, we should use `test -z' at least, since the semantic of the check
has been reversed.  Also, `test -z' can sometimes be problematic too, and
I tend to avoid it altogheter for the same "consistency" resons stated
above.

Do you want me to use `tezt -z' anyway here?

> > +echo "$me: TeX is required, but it wasn't found by configure"
> > +exit 77
> > +  fi
> >;;
> >  texi2dvi-o)
> ># Texi2dvi supports `-o' since Texinfo 4.1.
> > @@ -285,6 +298,37 @@ do
> >esac
> >  done
> 
> The rest of the patch from here on below seems to only transpose testing
> of $required and testing of some other variable.  In essence for the
> default case it turns one case statement into three (thus a minor
> slowdown), little code into more code, and I fail to see the advantage
> of the new ordering.  What is the intention here?
Giving precise resons about why the t

Re: [PATCH] {tests-init} Tests defs: improve messages for skipped tests. (was: Re: [PATCH 5/5] Tests defs: improve messages for skipped tests.)

2010-11-11 Thread Ralf Wildenhues
* Stefano Lattarini wrote on Thu, Nov 11, 2010 at 02:52:06PM CET:
> Tests defs: improve messages for skipped tests.
> 
> * tests/defs: Give meaningful messages about the reasons of a
> test skip; this is especially useful as this file is run without
> verbose xtraces on.  Related reorderings in the code and new
> comments.

I have some nits below, and a couple of questions.

Thanks,
Ralf

> --- a/tests/defs
> +++ b/tests/defs
> @@ -192,6 +192,7 @@ do
>export GCJ
>echo "$me: running $GCJ --version"
>( $GCJ --version ) || exit 77
> +  echo "$me: running $GCJ -v"
>( $GCJ -v ) || exit 77
>;;
>  g++)
> @@ -228,11 +229,16 @@ do
>(echo foo >> $priv_check_temp) >/dev/null 2>&1
>overwrite_status=$?
>rm -f $priv_check_temp
> -  test $overwrite_status = 0 && exit 77
> +  if test $overwrite_status = 0; then

-eq seems more appropriate than = (more instances below).

> +echo "$me: this test shouldn't be run as root"

Please >&2, several instances.

Also, the message could be more precise, as it will also trigger on
systems without unix style permissions.  How about the following:
  $me: cannot drop file write permissions

and similar for ro-dir below?

> +exit 77
> +  fi
>;;
>  perl-threads)
> -  # Skip with Devel::Cover: it cannot cope with threads.
> -  test "$WANT_NO_THREADS" = yes && exit 77
> +  if test x"$WANT_NO_THREADS" = x"yes"; then

no need to quote `yes', and in practice, no need for x prefixing either,
I would guess.  Do you think we need to take care of malicious users?

> +echo "$me: skip with Devel::Cover: it cannot cope with threads."

no final period (several more instances below).
I'd drop the 'it'.

> +exit 77
> +  fi
>;;
>  python)
># Python doesn't support --version, it has -V
> @@ -248,7 +254,10 @@ do
>(: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
>create_status=$?
>rm -rf $ro_dir_temp
> -  test $create_status = 0 && exit 77
> +  if test $create_status = 0; then
> +echo "$me: support of read-only directories is required"
> +exit 77
> +  fi
>;;
>  rst2html)
># Try the variants that are tried in check.am.
> @@ -257,6 +266,7 @@ do
>echo "$me: running $r2h --version"
>$r2h --version && break 2
>  done
> +echo "$me: no proper rst2html program found"
>  exit 77
>done
>;;
> @@ -264,13 +274,16 @@ do
># DejaGnu's runtest program. We rely on being able to specify
># the program on the runtest command-line. This requires
># DejaGnu 1.4.3 or later.
> -  echo "$me: running runtest --version"
> +  echo "$me: running runtest SOMEPROGRAM=someprogram --version"
>(runtest SOMEPROGRAM=someprogram --version) || exit 77
>;;
>  tex)
># No all versions of Tex support `--version', so we use
># a configure check.
> -  test -n "$TEX" || exit 77
> +  if test x"$TEX" = x; then

test -n is portable here and more concise, $TEX will never start with
a '-' character or be equal to '=' for any sane user.  So let's please
keep that.

> +echo "$me: TeX is required, but it wasn't found by configure"
> +exit 77
> +  fi
>;;
>  texi2dvi-o)
># Texi2dvi supports `-o' since Texinfo 4.1.
> @@ -285,6 +298,37 @@ do
>esac
>  done

The rest of the patch from here on below seems to only transpose testing
of $required and testing of some other variable.  In essence for the
default case it turns one case statement into three (thus a minor
slowdown), little code into more code, and I fail to see the advantage
of the new ordering.  What is the intention here?

Sorry for sounding grumpy, I may just be overlooking something here.

> +# Using just `$testbuilddir' for the check here is ok, since the
> +# further temporary subdirectory where the test will be run is
> +# ensured not to contain any whitespace character.
> +case $testbuilddir in
> +  *\ *|*\*)
> +case " $required " in
> +  *' libtool '* | *' libtoolize '* )
> +echo "$me: libtool/libtoolized cannot cope correctly"
> +echo "$me: with spaces in the build tree."
> +exit 77
> +;;
> +esac
> +;;
> +esac
> +
> +# This test is necessary, although Automake's configure script bails out
> +# when $srcdir contains spaces.  This is because $testsrcdir is in not
> +# configure-time $srcdir, but is instead configure-time $abs_srcdir, and
> +# that is allowed to contain spaces.
> +case $testsrcdir in
> +  *\ * |*\   *)
> +case " $required " in
> +  *' libtool '* | *' libtoolize '* | *' gettext '* )
> +echo "$me: our testsuite setup cannot cope correctly with spaces"
> +echo "$me: in the source tree for libtool/gettext tests."
> +exit 77
> +;;
> +   esac
> +   ;;
> +esac
> +
>  # We might need extra ma

Re: [PATCH 0/7] Refactoring of testcases initialization code

2010-11-11 Thread Ralf Wildenhues
* Stefano Lattarini wrote on Thu, Nov 11, 2010 at 02:41:40PM CET:
> On Sunday 07 November 2010, Stefano Lattarini wrote:
> > Stefano Lattarini (7):
> >   Tests defs: various reorderings, some improvements.
> >   Tests defs: prefer "$curdir" over "`pwd`".
> >   Tests defs: rename $curdir -> $testbuilddir
> >   Tests defs: do not print message "Running test $0" anymore.
> >   Tests defs: $testsbuilddir is now AC_SUBST'ed.
> >   Tests defs: new AC_SUBST'ed variable $top_testsbuilddir.
> >   Tests defs: move static definitions in a new file `minidefs'.

> I've pushed the patch to "tests-init", with some amendings and
> respinnings suggested in various replies in the related thread.
> 
> I still haven't merged "tests-init" into "master", but I'd like
> to do that soon; is that OK for you?

Yep, thanks!

I'm looking at the remaining rebase next, in case you want to wait.

Cheers,
Ralf



Re: [PATCH 1/7] Tests defs: various reorderings, some improvements.

2010-11-11 Thread Ralf Wildenhues
* Stefano Lattarini wrote on Thu, Nov 11, 2010 at 01:00:47PM CET:
> On Thursday 11 November 2010, Ralf Wildenhues wrote:
> >
> > Thank for respinning.  The patches are ok then, but I think you should
> > take care that the newly-introduced `pwd` is replaced by the variable
> > you later introduce for this (in the later patch, of course).

> Which newly-introduced pwd?  There should be no such thing in these
> patches, if I'm not mistaken.

Mistake of mine, I overlooked that this one:

> @@ -390,7 +395,9 @@ case " $required " in
>  esac
>  # Libtool cannot cope with spaces in the build tree.  Our testsuite setup
>  # cannot cope with spaces in the source tree name for Libtool and gettext
> -# tests.
> +# tests.  Using just "`pwd`" for the check here is ok, since the further
> +# temporary subdirectory where the test will be run is ensured not to
> +# contain any space.
>  case $testsrcdir,`pwd` in
>*\ * | *\*) Exit 77;;
>  esac

is treated in 2/7.  Sorry about that.

Thanks,
Ralf



Re: [PATCH] Enable `set -e' in more tests (plus some tweakings).

2010-11-11 Thread Stefano Lattarini
Pinging this patch again, following this:
 

I'll wait the customary 72 hours (until sunday evening) before pushing.

Regards,
  Stefano



Re: [PATCH] Enable `set -e' in more tests (plus some tweakings).

2010-11-11 Thread Stefano Lattarini
Pinging this patch again, following this:
 

I'll wait the customary 72 hours (until sunday evening) before pushing.

Regards,
  Stefano



Re: [PATCH] {maint} More tests on macro `AM_WITH_REGEX'.

2010-11-11 Thread Stefano Lattarini
Pinging this patch again, following this:
 

Since I was at it, I rebased the patch against latest maint, and threw
in a couple of minor improvements.  The updated patch is attached.

Regards,
  Stefano
From 461c125cc982612c1d6ab11280e405dd80ad6e49 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini 
Date: Mon, 20 Sep 2010 22:57:15 +0200
Subject: [PATCH] More tests on macro `AM_WITH_REGEX'.

* tests/regex.test: Extend with more configure runs.  Add
trailing `:' command.
* tests/regex2.test: New test.
* tests/regex3.test: Likewise.
* tests/Makefile.am (TESTS): Updated
---
 ChangeLog |9 +
 tests/Makefile.am |2 +
 tests/Makefile.in |2 +
 tests/regex.test  |8 -
 tests/regex2.test |   84 +++
 tests/regex3.test |   94 +
 6 files changed, 198 insertions(+), 1 deletions(-)
 create mode 100755 tests/regex2.test
 create mode 100755 tests/regex3.test

diff --git a/ChangeLog b/ChangeLog
index a356958..ff55767 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-11  Stefano Lattarini  
+
+	More tests on macro `AM_WITH_REGEX'.
+	* tests/regex.test: Extend with more configure runs.  Add
+	trailing `:' command.
+	* tests/regex2.test: New test.
+	* tests/regex3.test: Likewise.
+	* tests/Makefile.am (TESTS): Updated
+
 2010-11-07  Stefano Lattarini  
 
 	Fix a bug in variable concatanation with `+='.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index da81c49..64240c8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -621,6 +621,8 @@ remake5.test \
 remake6.test \
 remake7.test \
 regex.test \
+regex2.test \
+regex3.test \
 req.test \
 reqd.test \
 reqd2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index eb461a9..c43ece0 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -888,6 +888,8 @@ remake5.test \
 remake6.test \
 remake7.test \
 regex.test \
+regex2.test \
+regex3.test \
 req.test \
 reqd.test \
 reqd2.test \
diff --git a/tests/regex.test b/tests/regex.test
index babd92a..611ce24 100755
--- a/tests/regex.test
+++ b/tests/regex.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2010 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,6 +15,7 @@
 # along with this program.  If not, see .
 
 # Make sure AM_WITH_REGEX compiles and runs.
+# See also related tests `regex2.test' and `regex3.test'
 
 . ./defs || Exit 1
 
@@ -28,3 +29,8 @@ $ACLOCAL
 $AUTOCONF
 ./configure
 ./configure --without-regex
+./configure --with-regex
+./configure --with-regex=no
+./configure --with-regex=yes
+
+:
diff --git a/tests/regex2.test b/tests/regex2.test
new file mode 100755
index 000..a5fe6c7
--- /dev/null
+++ b/tests/regex2.test
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see .
+
+# Make sure AM_WITH_REGEX compiles and runs as advertised in
+# documentation.
+# See also sister test `regex3.test'
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_HEADERS([config.h])
+AM_WITH_REGEX
+AC_OUTPUT
+END
+
+cat > config.h.in <<'END'
+#undef WITH_REGEX
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+check-local:
+	@echo "with_regex='$$with_regex'"
+	grep '#.* WITH_REGEX' config.h # sanity check
+	./foo$(EXEEXT)
+	if test x"$$with_regex" = x"yes"; then \
+	  test x"`./foo$(EXEEXT)`" = x'WITH_REGEX=1'; \
+	else \
+	  test x"`./foo$(EXEEXT)`" = x'undef WITH_REGEX'; \
+	fi
+END
+
+cat > foo.c <<'END'
+#include 
+#include 
+int main(void)
+{
+#ifndef WITH_REGEX
+  printf("undef WITH_REGEX\n");
+#else
+  printf("WITH_REGEX=%d\n", (WITH_REGEX));
+#endif
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+for result_option in \
+  'yes' \
+  'no --without-regex' \
+  'yes --with-regex' \
+  'no --with-regex=no' \
+  'yes --with-regex=yes' \
+; do
+  set x $result_option
+  result=$2
+  option=$3
+  # For systems lacking both `regex' and `rx' libraries.
+  config_args="$option am_cv_gnu_regex=yes ac_cv_func_re_rx_search=yes"
+  ./configure $config_args
+  with_regex="$result" $MAKE check
+  with_regex="$resul

[PATCH] {tests-init} Tests defs: improve messages for skipped tests. (was: Re: [PATCH 5/5] Tests defs: improve messages for skipped tests.)

2010-11-11 Thread Stefano Lattarini
On Thursday 11 November 2010, Stefano Lattarini wrote:
> On Wednesday 10 November 2010, Ralf Wildenhues wrote:
> > * Stefano Lattarini wrote on Wed, Sep 08, 2010 at 08:57:19PM CEST:
> > > * tests/defs.in: Give meaningful messages about the reasons of a
> > > test skip; this is especially useful as this file is run without
> > > verbose xtraces on.  Related reorderings in the code and new
> > > comments.
> > 
> > What happened to this patch in the new, rebased patch series?
> Nothing; I just left it out, because my main concern in the new patch
> series was to arrive quickly at the separation of defs/defs-static
> which I need to write the patch optimizing the `instspc*.test' tests.
> 
> > Was it already subsumed in some other series?
> No; I'm going to rebase it, and repropose it as a stand-alone patch
> soonish (after the present patch series is done with).
And here it is.

Regards,
  Stefano

-*-*-*-

Tests defs: improve messages for skipped tests.

* tests/defs: Give meaningful messages about the reasons of a
test skip; this is especially useful as this file is run without
verbose xtraces on.  Related reorderings in the code and new
comments.
---
 ChangeLog  |8 ++
 tests/defs |   80 
 2 files changed, 72 insertions(+), 16 deletions(-)
From 25a64f7f2065a45ceccaf4b51cadea08c0534fdd Mon Sep 17 00:00:00 2001
From: Stefano Lattarini 
Date: Thu, 11 Nov 2010 14:49:39 +0100
Subject: [PATCH] Tests defs: improve messages for skipped tests.

* tests/defs: Give meaningful messages about the reasons of a
test skip; this is especially useful as this file is run without
verbose xtraces on.  Related reorderings in the code and new
comments.
---
 ChangeLog  |8 ++
 tests/defs |   80 
 2 files changed, 72 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7d439bb..634a3ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-11  Stefano Lattarini  
+
+	Tests defs: improve messages for skipped tests.
+	* tests/defs: Give meaningful messages about the reasons of a
+	test skip; this is especially useful as this file is run without
+	verbose xtraces on.  Related reorderings in the code and new
+	comments.
+
 2010-11-10  Stefano Lattarini  
 
 	Tests defs: move static definitions in a new file `defs-static'.
diff --git a/tests/defs b/tests/defs
index 50d074e..5ad18aa 100644
--- a/tests/defs
+++ b/tests/defs
@@ -192,6 +192,7 @@ do
   export GCJ
   echo "$me: running $GCJ --version"
   ( $GCJ --version ) || exit 77
+  echo "$me: running $GCJ -v"
   ( $GCJ -v ) || exit 77
   ;;
 g++)
@@ -228,11 +229,16 @@ do
   (echo foo >> $priv_check_temp) >/dev/null 2>&1
   overwrite_status=$?
   rm -f $priv_check_temp
-  test $overwrite_status = 0 && exit 77
+  if test $overwrite_status = 0; then
+echo "$me: this test shouldn't be run as root"
+exit 77
+  fi
   ;;
 perl-threads)
-  # Skip with Devel::Cover: it cannot cope with threads.
-  test "$WANT_NO_THREADS" = yes && exit 77
+  if test x"$WANT_NO_THREADS" = x"yes"; then
+echo "$me: skip with Devel::Cover: it cannot cope with threads."
+exit 77
+  fi
   ;;
 python)
   # Python doesn't support --version, it has -V
@@ -248,7 +254,10 @@ do
   (: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
   create_status=$?
   rm -rf $ro_dir_temp
-  test $create_status = 0 && exit 77
+  if test $create_status = 0; then
+echo "$me: support of read-only directories is required"
+exit 77
+  fi
   ;;
 rst2html)
   # Try the variants that are tried in check.am.
@@ -257,6 +266,7 @@ do
   echo "$me: running $r2h --version"
   $r2h --version && break 2
 done
+echo "$me: no proper rst2html program found"
 exit 77
   done
   ;;
@@ -264,13 +274,16 @@ do
   # DejaGnu's runtest program. We rely on being able to specify
   # the program on the runtest command-line. This requires
   # DejaGnu 1.4.3 or later.
-  echo "$me: running runtest --version"
+  echo "$me: running runtest SOMEPROGRAM=someprogram --version"
   (runtest SOMEPROGRAM=someprogram --version) || exit 77
   ;;
 tex)
   # No all versions of Tex support `--version', so we use
   # a configure check.
-  test -n "$TEX" || exit 77
+  if test x"$TEX" = x; then
+echo "$me: TeX is required, but it wasn't found by configure"
+exit 77
+  fi
   ;;
 texi2dvi-o)
   # Texi2dvi supports `-o' since Texinfo 4.1.
@@ -285,6 +298,37 @@ do
   esac
 done
 
+# Using just `$testbuilddir' for the check here is ok, since the
+# further temporary subdirectory where the test will be run is
+# ensured not to contain any whitespace character.
+case $testbuilddir in
+  *\ *|*\	*)
+case " $required " in
+  *' libtool '* 

Re: [PATCH 0/7] Refactoring of testcases initialization code

2010-11-11 Thread Stefano Lattarini
Hello automakers.

On Sunday 07 November 2010, Stefano Lattarini wrote:
> 
> Stefano Lattarini (7):
>   Tests defs: various reorderings, some improvements.
>   Tests defs: prefer "$curdir" over "`pwd`".
>   Tests defs: rename $curdir -> $testbuilddir
>   Tests defs: do not print message "Running test $0" anymore.
>   Tests defs: $testsbuilddir is now AC_SUBST'ed.
>   Tests defs: new AC_SUBST'ed variable $top_testsbuilddir.
>   Tests defs: move static definitions in a new file `minidefs'.
> 
>  ChangeLog   |   50 ++
>  configure   |   45 +-
>  configure.ac|3 +-
>  tests/.gitignore|2 +-
>  tests/Makefile.am   |6 +-
>  tests/Makefile.in   |   18 +-
>  tests/{defs.in => defs} |  387 
> ++-
>  tests/minidefs.in   |   99 
>  8 files changed, 384 insertions(+), 226 deletions(-)
>  rename tests/{defs.in => defs} (74%)
>  create mode 100644 tests/minidefs.in
> 
 
I've pushed the patch to "tests-init", with some amendings and
respinnings suggested in various replies in the related thread.

I still haven't merged "tests-init" into "master", but I'd like
to do that soon; is that OK for you?

Regards,
   Stefano



Re: [PATCH 6/7] Tests defs: new AC_SUBST'ed variable $top_testsbuilddir.

2010-11-11 Thread Stefano Lattarini
On Thursday 11 November 2010, Stefano Lattarini wrote:
> On Wednesday 10 November 2010, Ralf Wildenhues wrote:
> > * Stefano Lattarini wrote on Sun, Nov 07, 2010 at 04:21:09PM CET:
> > > * tests/defs.in ($top_testsbuilddir): New variable, initialized
> > > with the value AC_SUBST'ed from @abs_top_build...@.  Mostly for
> > > completeness and consistency with $testsrcdir and $top_testsrcdir.
> > 
> > Let's add this only when we need it.  Do we?
> Not at the moment, but I thought it would be nice to have it anyway,
> if only for consistency/simmetry reasons.  But I'm OK with removing
> it, too, if you insist.  Do you?
I removed this patch from the series, as requested by Ralf.

Regards,
  Stefano



Re: [PATCH 7/7] Tests defs: move static definitions in a new file `minidefs'.

2010-11-11 Thread Stefano Lattarini
On Thursday 11 November 2010, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Thu, Nov 11, 2010 at 12:16:27AM CET:
> > On Wednesday 10 November 2010, Ralf Wildenhues wrote:
> > > * Stefano Lattarini wrote on Sun, Nov 07, 2010 at 04:29:27PM CET:
> > > > Tests defs: move static definitions in a new file `minidefs'.
> [...]
> > > > * tests/defs: ... this new file ...
> > > > * tests/minidefs.in: ... and this new file.
> > > 
> > > You need to mention the remaining changes here; e.g., that defs sources
> > > the other file now.
> > Is this OK?
> > 
> >  * tests/defs.in: Removed, its contents split among ...
> >  * tests/defs-static.in: ... this new file ...
> >  * tests/defs: ... and this new file, including the former.
> 
> Sure, if that really is all that was changed.
Basically yes; there were a few other *minor* changes related to the split,
but I assume we don't want to be overly verbose by listing them in details
(and in fact, they are implicitly described by the sentence "The new file
is designed to be idempotent w.r.t. mutiple inclusions" in the ChangeLog
entry).

Regards,
  Stefano



Re: [PATCH 1/7] Tests defs: various reorderings, some improvements.

2010-11-11 Thread Stefano Lattarini
On Thursday 11 November 2010, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Thu, Nov 11, 2010 at 12:37:23AM CET:
> > Well, the patch is "almost" just code reordering, with the very minor
> > exceptions that:
> > 
> >   1. in the older version, some error messages could be printed before
> >  `$me' was defined, so they couldn't use it; now `$me' is defined
> >  early, so those error messages has been amended to include it;
> > 
> >   2. in the older version, a test might be skipped from within code
> >  in `tests/defs' *after* the exit trap was installed, so a call
> >  to "Exit 77" was in order; now the skips only happens before the
> >  installation of the exit trap, so "exit 77" is enough;
> > 
> >   3. some comments has been slighty adjusted and extended, because the
> >  act of reordering the code suggested them to me.
> > 
> > Anyway, none of these additional "minor" changes is really required to
> > make the new `tests/defs.in' work correctly, so I agree that they should
> > have been done in follow-up patches.  I've respin and split my patch to
> > do so (see the attached four patches).
> 
> Thank for respinning.  The patches are ok then, but I think you should
> take care that the newly-introduced `pwd` is replaced by the variable
> you later introduce for this (in the later patch, of course).
Which newly-introduced pwd?  There should be no such thing in these
patches, if I'm not mistaken.

Regards,
  Stefano