[m-rev.] for review: improve test framework
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Aug 17 23:00:09 AEST 2002
On 16-Aug-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> On 15-Aug-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > On 15-Aug-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > > +# If the tests in the subdirectories, still run the local tests,
> > > +# but return a status of 1.
> > > +#
> > > +runtests:
> > > + @$(STARTUP_LOG)
> > > + @rm -f subdirs_failed local_failed
> > > + +@{ mmake runtests_subdirs || touch subdirs_failed; } $(REDIRECT_TO_LOG)
> > > + +@{ mmake runtests_local || touch local_failed; } $(REDIRECT_TO_LOG)
> > > + @if [ -f subdirs_failed -o -f local_failed ] ; then \
> > > + $(REPORT_FAILURE); \
> > > + $(CLEANUP_LOG); \
> > > + rm -f subdirs_failed local_failed; \
> > > + exit 1; \
> > > + else \
> > > + $(REPORT_SUCCESS); \
> > > + $(CLEANUP_LOG); \
> > > + rm -f subdirs_failed local_failed; \
> > > + fi
> >
> > Why is this code serialized by writing it as the body of a single
> > target, rather than using multiple targets (with appropriate
> > dependencies between then, of course) so that the different
> > parts which don't depend on each other can run in parallel?
> > E.g.
> >
> > ...
>
> A simpler solution is to run `mmake -k runtests_subdirs runtests_local'.
Well, that involves a recursive invocation of mmake for the same
subdirectory, which is a little less efficient (especially on Windows
where the overhead of process creation is very high).
I suppose it doesn't matter too much.
> > > +runtests_subdirs:
> > > + succeeded=true; \
> > > + for dir in $(SUBDIRS); do \
> > > + (cd $$dir && RUNTESTS_IN_SUBDIR=true mmake runtests) || \
> > > + succeeded=false; \
> > > + done; \
> > > + case $$succeeded in false) exit 1 ;; esac
> > > +
> > > +realclean_subdirs:
> > > + +succeeded=true; \
> > > + for dir in $(SUBDIRS); do \
> > > + (cd $$dir && mmake realclean) || succeeded=false; \
> > > + done
> > > + case $$succeeded in false) exit 1 ;; esac
> > > +
> > > +clean_subdirs:
> > > + +succeeded=true; \
> > > + for dir in $(SUBDIRS); do \
> > > + (cd $$dir && mmake clean) || succeeded=false; \
> > > + done; \
> > > + case $$succeeded in false) exit 1 ;; esac
> >
> > Likewise here.
>
> I haven't changed this. The rule you gave above for runtests_subdirs
> only works with `mmake -k'.
What do you mean by "works"?
Do you mean that it stops at the first error?
IMHO that is the right thing to do if invoked without `-k'.
But I suppose it doesn't matter too much.
> +#
> +# Run a single test, cleaning up if it succeeds, or producing
> +# a log file and gzipping the executable the test fails.
> +# Note that the %.log target does not fail if the test fails --
> +# we really want `--keep-going' to be the default for this Mmakefile.
> +#
With GNU Make, there is a way to make `--keep-going' be the default for
a particular Makefile (or Mmakefile): set MAKEFLAGS.
Anyway, I'm happy for you to check this in now.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list