Re: non-recursive make and tests

2004-08-31 Thread Gary V . Vaughan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Bob,
On 31 Aug 2004, at 06:08, Bob Friesenhahn wrote:
On Mon, 30 Aug 2004, Bob Friesenhahn wrote:
The $(srcdir) value passed is often essentially useless since it may 
just be '.'.  It is difficult for the Makefile to produce better 
values except for perhaps offsets from @abs_top_srcdir@ and 
@abs_top_builddir@ substitutions. It may also be possible to play 
games by passing back-ticked shell script fragments rather than 
normal values in the TESTS_ENVIRONMENT specification.

Regardless, the tests themselves should not have to know their 
position in the source or build tree.
If I add this sort of junk to the top of my test scripts then they 
seem to pass the tests:

set -e
SRCDIR=`dirname $0`
SRCDIR=`cd $SRCDIR  pwd`
TOPSRCDIR=`cd $srcdir  pwd`
cd utilities || exit 1
MODEL_MIFF=${TOPSRCDIR}/Magick++/demo/model.miff
.
.
.
Without the pwd's distcheck can't pass since srcdir may be passed as a 
useless '.'.

Unfortunately, with hundreds of such scripts, altering the test 
environment to convert to a non-recursive make is quite a penalty.

Many scripts could be one-liners if Automake can produce a 
per-directory test environment.
I made a stab at converting libtool to non-recursive make last year (I 
think) and had much the same problem.  I think the general solution is 
to move to an Autotest based testsuite, where the input files are 
generated by the test rather than searched for in the source tree.  
Maybe you can emulate that behaviour by making your test input into 
here documents in the test scripts, without a whole scale move to 
Autotest?

Cheers,
Gary.
- --
Gary V. Vaughan  ())_.  [EMAIL PROTECTED],gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker   / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (Darwin)
iD8DBQFBNFsBFRMICSmD1gYRAvmXAJ9b+/z3QyLJlvF/yqV6j67yHoiZEwCgjO3/
/4KCRgLIGY6u8TYeyDL5nY4=
=cRSu
-END PGP SIGNATURE-



Re: non-recursive make and tests

2004-08-31 Thread Bob Friesenhahn
On Tue, 31 Aug 2004, Gary V.Vaughan wrote:
Many scripts could be one-liners if Automake can produce a per-directory 
test environment.
I made a stab at converting libtool to non-recursive make last year (I think) 
and had much the same problem.  I think the general solution is to move to an 
Autotest based testsuite, where the input files are generated by the test 
rather than searched for in the source tree.  Maybe you can emulate that 
behaviour by making your test input into here documents in the test scripts, 
without a whole scale move to Autotest?
That sounds great, but in my case the input files are graphic image 
files so they would be rather unwieldy in here documents.  Typically 
a file is read, processed using an algorithm, and then either its 
checksum is compared with a reference checksum, or the final output is 
compared with reference data.

There are lots of other types of software packages with tests that 
have similar requirements.

The easiest solution is to update the check-TESTS: definition in 
automake's lib/am/check.am file so that it has an option to emulate 
the way a test would traditionally be executed by a recursive build. I 
can hack my copy of Automake, but then the resulting project can't be 
re-created by someone else.

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen



Re: non-recursive make and tests

2004-08-31 Thread Gary V. Vaughan
Hi Bob!

Bob Friesenhahn wrote:
 On Tue, 31 Aug 2004, Gary V.Vaughan wrote:
 That sounds great, but in my case the input files are graphic image
 files so they would be rather unwieldy in here documents.  Typically a
 file is read, processed using an algorithm, and then either its checksum
 is compared with a reference checksum, or the final output is compared
 with reference data.
 
 There are lots of other types of software packages with tests that have
 similar requirements.
 
 The easiest solution is to update the check-TESTS: definition in
 automake's lib/am/check.am file so that it has an option to emulate the
 way a test would traditionally be executed by a recursive build. I can
 hack my copy of Automake, but then the resulting project can't be
 re-created by someone else.

Agreed.  I think your best course of action is to put a patch in the
automake queue for Alexandre's return from vacation :-(

Cheers,
Gary.
-- 
Gary V. Vaughan  ())_.  [EMAIL PROTECTED],gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker   / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook


signature.asc
Description: OpenPGP digital signature


Re: non-recursive make and tests

2004-08-30 Thread Bob Friesenhahn
On Mon, 30 Aug 2004, Bob Friesenhahn wrote:
It would be quite helpful if Automake offered a mode in which it 
automatically changed the working directory to the directory where the test 
program/script resides and set $srcdir to the relative position in the source 
tree to support VPATH builds.  This would emulate the operation of recursive 
builds.  Either a global Automake option could be used to enable this 
(subdir-tests), or a RTESTS (relative tests) mode would be provided.
It seems that this topic has not caught anyone's interest since there 
have been no follow-up posts today.  Surely someone else has converted 
their recursive project to a non-recursive project and noticed that it 
is very difficult to get test suites working again?

The current check-TESTS definition works great for recursive builds, 
but is miserable for non-recursive builds.

The $(srcdir) value passed is often essentially useless since it may 
just be '.'.  It is difficult for the Makefile to produce better 
values except for perhaps offsets from @abs_top_srcdir@ and 
@abs_top_builddir@ substitutions.  It may also be possible to play 
games by passing back-ticked shell script fragments rather than normal 
values in the TESTS_ENVIRONMENT specification.

Regardless, the tests themselves should not have to know their 
position in the source or build tree.

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen



Re: non-recursive make and tests

2004-08-30 Thread Robert Collins
On Mon, 2004-08-30 at 20:30 -0500, Bob Friesenhahn wrote:
 On Mon, 30 Aug 2004, Bob Friesenhahn wrote:
 
  It would be quite helpful if Automake offered a mode in which it 
  automatically changed the working directory to the directory where the test 
  program/script resides and set $srcdir to the relative position in the source 
  tree to support VPATH builds.  This would emulate the operation of recursive 
  builds.  Either a global Automake option could be used to enable this 
  (subdir-tests), or a RTESTS (relative tests) mode would be provided.
 
 It seems that this topic has not caught anyone's interest since there 
 have been no follow-up posts today.  Surely someone else has converted 
 their recursive project to a non-recursive project and noticed that it 
 is very difficult to get test suites working again?

I found it trivial. Mind you, all my tests are - by design - self
contained.

Rob


signature.asc
Description: This is a digitally signed message part


Re: non-recursive make and tests

2004-08-30 Thread Bob Friesenhahn
On Tue, 31 Aug 2004, Robert Collins wrote:
On Mon, 2004-08-30 at 20:30 -0500, Bob Friesenhahn wrote:
On Mon, 30 Aug 2004, Bob Friesenhahn wrote:
It would be quite helpful if Automake offered a mode in which it
automatically changed the working directory to the directory where the test
program/script resides and set $srcdir to the relative position in the source
tree to support VPATH builds.  This would emulate the operation of recursive
builds.  Either a global Automake option could be used to enable this
(subdir-tests), or a RTESTS (relative tests) mode would be provided.
It seems that this topic has not caught anyone's interest since there
have been no follow-up posts today.  Surely someone else has converted
their recursive project to a non-recursive project and noticed that it
is very difficult to get test suites working again?
I found it trivial. Mind you, all my tests are - by design - self
contained.
Most of the tests for the package I maintain require that the test 
read an existing input file, and write an output file.  Sometimes the 
written result needs to be compared with another existing file.

For scripts I can find the source directory (where input files are 
stored) by doing something like

SRCDIR=`dirname $0`/
in the script.  Unfortunately, this cludge is apparently not working 
if the build directory is under the source tree, so distcheck is 
failing.  Probably another layer of cludges is required. :-)

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen



Re: non-recursive make and tests

2004-08-30 Thread Bob Friesenhahn
On Mon, 30 Aug 2004, Bob Friesenhahn wrote:
The $(srcdir) value passed is often essentially useless since it may just be 
'.'.  It is difficult for the Makefile to produce better values except for 
perhaps offsets from @abs_top_srcdir@ and @abs_top_builddir@ substitutions. 
It may also be possible to play games by passing back-ticked shell script 
fragments rather than normal values in the TESTS_ENVIRONMENT specification.

Regardless, the tests themselves should not have to know their position in 
the source or build tree.
If I add this sort of junk to the top of my test scripts then they 
seem to pass the tests:

set -e
SRCDIR=`dirname $0`
SRCDIR=`cd $SRCDIR  pwd`
TOPSRCDIR=`cd $srcdir  pwd`
cd utilities || exit 1
MODEL_MIFF=${TOPSRCDIR}/Magick++/demo/model.miff
.
.
.
Without the pwd's distcheck can't pass since srcdir may be passed as a 
useless '.'.

Unfortunately, with hundreds of such scripts, altering the test 
environment to convert to a non-recursive make is quite a penalty.

Many scripts could be one-liners if Automake can produce a 
per-directory test environment.

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen