autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test autotest portably (Solaris)


From: Ralf Wildenhues
Subject: Re: test autotest portably (Solaris)
Date: Tue, 14 Mar 2006 08:20:38 +0100
User-agent: Mutt/1.5.11

Hi Noah,

* Noah Misch wrote on Sun, Mar 05, 2006 at 07:46:49AM CET:
> On Wed, Mar 01, 2006 at 08:34:56PM +0100, Ralf Wildenhues wrote:
> >     * tests/autotest.at (AT_NO_CMDSUBST): New macro to determine
> >     XFAIL condition for `$(cmd)' style command substitutions.
> >     (Parenthetical command substition, Multiline parenthetical
> >     command substition): Use it.
> >     * AT_CHECK_AT: Execute `./micro-suite' with $CONFIG_SHELL, so
> >     we test the same shell we determined above XFAIL condition with.
> 
> Please apply.  Thanks for tracking this down.

Thanks for the review!  I haven't applied this yet, since I've found
out that the patch is not quite sufficient.

There's the Solaris and OSF /bin/sh behavior:
$ cat b.sh
#!/bin/sh
echo foo
echo "$(echo bar)"
echo $(echo baz)
$ sh b.sh
foo
$(echo bar)
b.sh: syntax error at line 4: `(' unexpected

And there's the IRIX /bin/sh one:
$ sh b.sh
foo
$(echo bar)
$(echo baz)

We see that the Solaris and OSF shells will fail as soon as they parse
the construct, if that was not double-quoted (see above).

Note that on Solaris, the _AS_DETECT_BETTER_SHELL algorithm will select
ksh or bash.  Then there is the issue that the user can mess up
CONFIG_SHELL setting manually in the environment (or use
  bash ./testsuite
without adjusting CONFIG_SHELL, for example).  I had tried to put the
AT_NO_CMDSUBST test into micro_suite instead of the toplevel test suite;
but that would disallow non-double-quoted $(cmd), since the Solaris and
OSF shells will already fail while parsing `micro_suite', see above.

Since this testsuite issue isn't all that important anyway, I settled
for the solution below, that only caters for the IRIX difference.  It
works with both
  make check TESTSUITEFLAGS=-k\ autotest
  cd tests && ./testsuite -k autotest

on all mentioned systems; and
  CONFIG_SHELL=/bin/sh /bin/sh ./testsuite -k autotest

works on Solaris and IRIX; on OSF, however, the latter gets UNEXPECTED
PASSes (even if I also append an argument of `CONFIG_SHELL=/bin/sh', for
good measure).  So something isn't transporting the CONFIG_SHELL
setting.  I have not tracked this down further.

I have applied the patch as shown below.

Cheers,
Ralf

        * tests/autotest.at (AT_NO_CMDSUBST): New macro to determine
        failure condition for `$(cmd)' style command substitutions.
        (Parenthetical command substition, Multiline parenthetical
        command substition): Use it.

Index: tests/autotest.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/autotest.at,v
retrieving revision 1.9
diff -u -r1.9 autotest.at
--- tests/autotest.at   12 Mar 2006 19:58:31 -0000      1.9
+++ tests/autotest.at   13 Mar 2006 22:31:43 -0000
@@ -47,8 +47,8 @@
 # log file it generates will overwrite the log that the Autoconf test
 # suite produces for this test case.
 AT_CHECK_AUTOM4TE([--language=autotest -o micro-suite mysuite.at])
-AT_CHECK([./micro-suite],       m4_default([$4], 0), [ignore], [$6])
-AT_CHECK([./micro-suite -v -x], m4_default([$4], 0), [ignore], [$6])
+AT_CHECK([$CONFIG_SHELL ./micro-suite],       m4_default([$4], 0), [ignore], 
[$6])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -v -x], m4_default([$4], 0), [ignore], 
[$6])
 AT_CLEANUP
 ])
 
@@ -68,6 +68,11 @@
 # Here documents for these tests contain forbidden macros.
 m4_pattern_allow([^AT_])
 
+# AT_NO_CMDSUBST
+# --------------
+m4_define([AT_NO_CMDSUBST],
+[if (eval 'foo=$(echo bar) && test "$foo" = bar') >/dev/null 2>&1; then false; 
else :; fi])
+
 
 ## ------------------ ##
 ## Empty test suite.  ##
@@ -105,7 +110,9 @@
 
 AT_CHECK_AT_TEST([Backquote command substition],
   [AT_CHECK([echo `echo hi`], 0, [hi
-], [])])
+], [])],
+  [AT_NO_CMDSUBST])
+
 
 AT_CHECK_AT_TEST([Multiline backquote command substition],
   [AT_DATA([myfile],[foo
@@ -113,7 +120,8 @@
 ])
    AT_CHECK([echo "`cat myfile`"], 0, [foo
 bar
-], [])])
+], [])],
+  [AT_NO_CMDSUBST])
 
 AT_CHECK_AT_TEST([Parenthetical command substition],
   [AT_CHECK([echo $(echo hi)], 0, [hi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]