Re: head - more frozen file tests

From:

Gary V. Vaughan

Subject:

Re: head - more frozen file tests

Date:

Fri, 07 Jul 2006 15:03:27 +0100

User-agent:

Thunderbird 1.5.0.4 (Macintosh/20060530)

Hi Eric,
Eric Blake wrote:
> I propose adding this to the testsuite; it currently fails, but must pass
> before we can release m4 2.0. Otherwise, if you install autoconf with
> frozen files generated by 1.4.x, then upgrade m4, autoconf will break
> because m4 2.0 can't reload the frozen files. Any comments before I commit?
Nice idea. You forgot to 'cvs add tests/freeze.at' before generating
your patch tho' :-/
> I am also thinking that this file will make a great place to add tests
> like freezing m4wrap and sysval state. I haven't yet written those tests,
> but am thinking of first writing a helper macro to ease the job:
> # AT_CHECK_M4_FROZEN(DATA1, DATA2, [ARGS = `'])
> # ---------------------------------------------
> # Create file1 with contents DATA1, file2 with contents DATA2, then
> # validate that `m4 ARGS file1 file2' gives the same stdout, stderr,
> # and result, as `m4 ARGS -F file1f file1; m4 ARGS -R file1f file2'.
Cool. That will make life much easier.
> However, I've also been wondering whether we should reject some
> combinations of -R and other options. For example, does it make sense to
> support -R -Dfoo?
Yes, in fact we even jump through some hoops to make that possible
(see deferred options loop in main.c).
> Or should we claim that all options that affect state
> are invalid in combination with -R, since the state should instead be set
> by virtue of the reloaded state? It could certainly make implementation
> easier (even your new -r option to set resyntax would qualify as something
> incompatible with -R).
It would save a couple of dozen lines of code that we already have,
but I like the flexibility of being able to, say:
# Freeze a macro base using RE_SYNTAX_EMACS
m4 -F base.m4f base.m4
# Use it with another macro set developed using RE_SYNTAX_EXTENDED
m4 -r extended -R base.m4f macros.m4
And no need to go in and edit either file :-)
Hmmm... on second thoughts, we need another hoop to accomplish that:
each frozen macro would need to record what regexp syntax it assumes.
I'll add it to my todo list. Regardless, I see no reason to remove
the deferred option code we have at the moment.
> 2006-07-07 Eric Blake <address@hidden>
>
> * tests/freeze.at: New file.
> * tests/testsuite.at: Include it.
> * tests/macros.at (Arity, defn, and freeze): Add frozen keyword.
> * tests/modules.at (Freezing modules): Likewise.
Cheers,
Gary.
--
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://blog.azazil.net
GNU Hacker / )= http://trac.azazil.net/projects/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook