testsuite: Handle `balanced ASCII quotes' correctly in m4 errors.

AT_CHECK_M4 was _documented_ to convert

   m4: cannot open `foo': No such file or directory

to

   m4: cannot open 'foo': No such file or directory

but the regexp that was supposed to do this didn’t work.

Fix the regexp, and remove a workaround for the bug in one test
(yes, we had code in our own testsuite to work around bugs in our
own testsuite!)

* tests/local.at (AT_CHECK_M4): Fix regex for “cannot open” messages.
* tests/tools.at (autom4te cache): Remove workaround for buggy regex
  in AT_CHECK_M4.
This commit is contained in:
Zack Weinberg 2022-07-06 16:05:42 -04:00
parent 76beb33bfe
commit 5d8a59e337
No known key found for this signature in database
GPG Key ID: 384F8E68AC65B0D5
2 changed files with 7 additions and 17 deletions

View File

@ -158,14 +158,14 @@ m4_define([AT_CHECK_M4],
m4_case([$4], [], [], [ignore], [],
[AT_CHECK([[mv stderr stderr-raw &&
sed 's/^[^:]*m4[-.ex0-9]*: *\([^:]*:\) *\([0-9][0-9]*: \)/m4:\1\2/
s/^\([^:]*:\) *\([0-9][0-9]*:\)[^:]*m4[-.ex0-9]*: /m4:\1\2 /
s/: C\(annot open \)\([^`'\'':]*\):/: c\1'\''\2'\'':/
s/: include:\( cannot open\)/:\1/
s/^autom4te: [^ ]*m4[.ex]* /autom4te: m4 /
s/^autom4te: error: [^ ]*m4[.ex]* /autom4te: error: m4 /
s/^\([^:]*:\) *\([0-9][0-9]*:\)[^:]*m4[-.ex0-9]*: /m4:\1\2 /
s/: include: [cC]\(annot open\)/: c\1/
s/: [cC]\(annot open \)[`'\'']*\([^'\'':]*\)'\''*:/: c\1'\''\2'\'':/
s/^autom4te: [^ ]*m4[.ex]* /autom4te: m4 /
s/^autom4te: error: [^ ]*m4[.ex]* /autom4te: error: m4 /
s!^.*/\([^/][^/]*\)\.m4: *[0-9][0-9]*: *!\1.m4: !
s!^.*/\([^/][^/]*\)\.m4: *[0-9][0-9]*: *[0-9][0-9]*: *!\1.m4: !
s/ (E[A-Z]*)$//
s/ (E[A-Z]*)$//
' stderr-raw >&2]], [0], [], [$4])])
])

View File

@ -98,20 +98,10 @@ AT_CHECK_M4SUGAR
# We moved a file: it should fail
mkdir sub
mv foo sub
case `$M4 no/such/file 2>&1` in
*\`no/such/file*)
AT_CHECK_M4SUGAR([], [1], [],
[m4:script.4s:1: cannot open `foo': No such file or directory
autom4te: error: m4 failed with exit status: 1
])
;;
*)
AT_CHECK_M4SUGAR([], [1], [],
AT_CHECK_M4SUGAR([], [1], [],
[m4:script.4s:1: cannot open 'foo': No such file or directory
autom4te: error: m4 failed with exit status: 1
])
;;
esac
# But if we change the main file, then we should no longer complain of
# missing files.