-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Ralf Wildenhues on 8/18/2008 5:09 PM: >> I know that when testing my m4_transform_pair patch, I was able to trip an >> arbitrary limit in bash - it refuses to parse more than 2500 nested elif >> keywords inside an if/else/fi. I wonder if we are tripping some other shell >> limits with my test enhancements last week, even though I scaled back the >> limit >> to 1000 instead of 2500. Maybe it was a mistake to add torture tests to the >> already existing AS_IF test, instead of creating a new test? > > Ahh, thanks for this hint. It is indeed weird that I can trip the > failure of test 50 with './testsuite 59-60' or './testsuite 60' but not > with './testsuite 59-61'. So I guess this messes up some internal shell > data. > > Maybe we should relax that test?
Sure. This scales AS_IF back by a factor of 10, then stresses m4_transform separately. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkiqSpAACgkQ84KuGfSFAYDCqQCgpa7Lv/3riaadwA8mOauaUnZi CvQAn1SkE7Wo53fz8DSFy7VVbR23Llul =ZZDI -----END PGP SIGNATURE-----
>From f49bad90e7cf2d48e6bd9c9b003fe8d417f0ab39 Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Mon, 18 Aug 2008 22:20:37 -0600 Subject: [PATCH] Test m4_transform without tickling shell bugs. * tests/m4sh.at (AS@&[EMAIL PROTECTED] and AS@&[EMAIL PROTECTED]): Relax test to something more manageable. * tests/m4sugar.at (recursion): Move stress test of m4_transform_pair here. Reported by Ralf Wildenhues. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 7 +++++++ tests/m4sh.at | 23 +++++++++++++---------- tests/m4sugar.at | 9 ++++++++- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 442baad..562e9e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-08-18 Eric Blake <[EMAIL PROTECTED]> + Test m4_transform without tickling shell bugs. + * tests/m4sh.at (AS@&[EMAIL PROTECTED] and AS@&[EMAIL PROTECTED]): Relax test to + something more manageable. + * tests/m4sugar.at (recursion): Move stress test of + m4_transform_pair here. + Reported by Ralf Wildenhues. + Let 'git diff' give better context for doc updates. * .gitattributes (*.texi*): Add new entry. * README-hacking: Mention how to use it. diff --git a/tests/m4sh.at b/tests/m4sh.at index ac5f8ba..f64d832 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -634,7 +634,7 @@ AT_CLEANUP AT_SETUP([AS@&[EMAIL PROTECTED] and AS@&[EMAIL PROTECTED]) -AT_KEYWORDS([m4@&[EMAIL PROTECTED]) +AT_KEYWORDS([m4@&[EMAIL PROTECTED]) AT_DATA_M4SH([script.as], [[dnl AS_INIT @@ -728,13 +728,15 @@ foo9=9 bar9=9 ]]) dnl stress test for large number of conditionals +dnl too large, and we start tickling shell bugs +m4_pushdef([limit], [100])dnl AT_DATA_M4SH([script.as], [[dnl AS_INIT -AS_IF(m4_shift(m4_for([i], [1], [1000], [], [, test $[1] = i, echo i]))) -AS_IF(m4_shift(m4_for([i], [1], [1000], [], [, test $[1] = i, echo i])), +AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i]))) +AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])), [echo default]) -AS_CASE([$[1]]m4_for([i], [1], [1000], [], [, i, echo i])) -AS_CASE([$[1]]m4_for([i], [1], [1000], [], [, i, echo i]), [echo default]) +AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i])) +AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]), [echo default]) ]]) AT_CHECK_M4SH @@ -743,14 +745,15 @@ AT_CHECK([./script 1], [0], [[1 1 1 ]]) -AT_CHECK([./script 1000], [0], [[1000 -1000 -1000 -1000 -]]) +AT_CHECK([./script limit], [0], [limit +limit +limit +limit +]) AT_CHECK([./script default], [0], [[default default ]]) +m4_popdef([limit]) AT_CLEANUP diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 75207e4..a8cecf9 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -926,7 +926,7 @@ AT_SETUP([recursion]) AT_KEYWORDS([m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] -m4@&[EMAIL PROTECTED]) +m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED] m4@&[EMAIL PROTECTED]) dnl This test completes in a reasonable time if m4_foreach is linear, dnl but thrashes if it is quadratic. If we are testing with m4 1.4.x, @@ -954,6 +954,8 @@ m4_bpatsubsts([a1]m4_for([i], [1], [10000], [], [,i]), [a2], [A]) m4_bmatch([9997]m4_for([i], [1], [10000], [], [,^i$])) m4_define([up], [m4_define([$1], m4_incr($1))$1])m4_define([j], 0)dnl m4_cond(m4_for([i], [1], [10000], [], [[up([j])], [9990], i,]) [oops]) j +m4_count(m4_transform_pair([,m4_quote], []m4_transform([,m4_echo]m4_for([i], + [1], [10000], [], [,i])))) m4_divert_pop(0) ]]) @@ -969,6 +971,7 @@ end A ^9998$ 9990 9990 +5001 ]]) AT_DATA_M4SUGAR([script.4s], @@ -986,6 +989,7 @@ end A ^9998$ 9990 9990 +5001 m4_exit([0])]) m4_init m4_divert_push(0)[]dnl @@ -1007,6 +1011,8 @@ m4_bpatsubsts([a1]m4_for([i], [1], [10000], [], [,i]), [a2], [A]) m4_bmatch([9997]m4_for([i], [1], [10000], [], [,^i$])) m4_define([up], [m4_define([$1], m4_incr($1))$1])m4_define([j], 0)dnl m4_cond(m4_for([i], [1], [10000], [], [[up([j])], [9990], i,]) [oops]) +m4_count(m4_transform_pair([,m4_quote], []m4_transform([,m4_echo]m4_for([i], + [1], [10000], [], [,i])))) m4_divert_pop(0) ]]) @@ -1022,6 +1028,7 @@ end A ^9998$ 9990 9990 +5001 ]]) AT_CLEANUP -- 1.5.6.4