[PATCH 0/3] Autotest: improve testability of Windows programs under Wine

2012-12-16 Thread Paolo Bonzini
Together with Linux's binfmt-misc feature, Wine can be used to test
cross-compiled programs as if they were native.  However, the shell
will not perform the magic addition of the .exe extension after a
program name when searching for an executable.  These simple patches
let the user work around this by specifying $EXEEXT in the AT_CHECK
and AT_TESTED argument.  (More care is needed because of carriage
returns, but this is beyond the scope of this series).

Patch 1 is a simple improvement to the testsuite.  Patch 2 shows how
to write a test suite that runs a C program and works even in the above
scenario; it improve AC_CONFIG_TESTDIR by automatically passing EXEEXT
down to the testsuite.  Patch 3 finally adds support for AT_TESTED with
$EXEEXT in the argument.

Paolo Bonzini (3):
  autotest: annotate tests that use AC_CONFIG_TESTDIR
  autotest: add a simple test suite that runs a C program
  autotest: enable usage of EXEEXT in AT_TESTED

 NEWS |   5 ++
 doc/autoconf.texi|   6 +++
 lib/autoconf/autotest.m4 |   6 ++-
 lib/autoconf/lang.m4 |   2 +-
 lib/autotest/general.m4  |   4 +-
 tests/autotest.at| 118 +++
 6 files changed, 137 insertions(+), 4 deletions(-)

-- 
1.8.0.1




[PATCH 1/3] autotest: annotate tests that use AC_CONFIG_TESTDIR

2012-12-16 Thread Paolo Bonzini
* tests/autotest.at (srcdir propagation, Erlang Eunit unit tests):
Add a keyword for AC_CONFIG_TESTDIR).

Signed-off-by: Paolo Bonzini bonz...@gnu.org
---
 tests/autotest.at | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/autotest.at b/tests/autotest.at
index fe2e3bc..82084b5 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -1758,6 +1758,7 @@ printf %s\\n $std
 ## --- ##
 
 AT_SETUP([srcdir propagation])
+AT_KEYWORDS([AC_@t@CONFIG_TESTDIR])
 
 mkdir pkg vpath-outside vpath-abs
 mkdir pkg/t pkg/vpath-inside
@@ -1891,6 +1892,7 @@ AT_CLEANUP
 
 AT_SETUP([Erlang Eunit unit tests])
 AT_KEYWORDS([Erlang])
+AT_KEYWORDS([AC_@t@CONFIG_TESTDIR])
 
 mkdir s t
 AT_DATA([configure.ac], [[AC_INIT
-- 
1.8.0.1





[PATCH 2/3] autotest: add a simple test suite that runs a C program

2012-12-16 Thread Paolo Bonzini
* tests/autotest.at (C unit tests): New testcase.
* NEWS: Document change.

Signed-off-by: Paolo Bonzini bonz...@gnu.org
---
 NEWS |   3 ++
 lib/autoconf/autotest.m4 |   6 ++-
 lib/autoconf/lang.m4 |   2 +-
 tests/autotest.at| 112 +++
 4 files changed, 121 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index d0a38a3..6fa116a 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,9 @@ GNU Autoconf NEWS - User visible changes.
   but processing variable substitutions, command substitutions and
   backslashes in the contents argument.
 
+- AC_CONFIG_TESTDIR will automatically pass EXEEXT to a testsuite (via
+  the atconfig file).
+
 
 * Noteworthy changes in release 2.69 (2012-04-24) [stable]
 
diff --git a/lib/autoconf/autotest.m4 b/lib/autoconf/autotest.m4
index 64e3d56..fd8c36a 100644
--- a/lib/autoconf/autotest.m4
+++ b/lib/autoconf/autotest.m4
@@ -59,6 +59,9 @@ abs_top_builddir='$ac_abs_top_builddir'
 # Backward compatibility with Autotest = 2.59b:
 at_top_builddir=\$at_top_build_prefix
 
+m4_provide_if([_AC_COMPILER_EXEEXT], [
+EXEEXT='$ac_cv_exeext'
+])dnl
 AUTOTEST_PATH='m4_default([$2], [$1])'
 
 SHELL=\${CONFIG_SHELL-'$SHELL'}
@@ -71,7 +74,8 @@ ERLCFLAGS='$ERLCFLAGS'
 ])dnl
 ATEOF
 ],
-[m4_provide_if([AC_ERLANG_PATH_ERL], [ERL=$ERL
+[m4_provide_if([_AC_COMPILER_EXEEXT], [ac_cv_exeext=$ac_cv_exeext
+])m4_provide_if([AC_ERLANG_PATH_ERL], [ERL=$ERL
 ])m4_provide_if([AC_ERLANG_PATH_ERLC], [ERLC=$ERLC
 ERLCFLAGS=$ERLCFLAGS
 ])])])# AC_CONFIG_TESTDIR
diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4
index 19852b8..fdaf4a1 100644
--- a/lib/autoconf/lang.m4
+++ b/lib/autoconf/lang.m4
@@ -656,7 +656,7 @@ AC_MSG_RESULT([$ac_cv_exeext])
 # by checking whether `_AC_COMPILER_EXEEXT' has been expanded.
 #
 # See _AC_COMPILER_EXEEXT_CROSS for why we need _AC_LANG_IO_PROGRAM.
-m4_define([_AC_COMPILER_EXEEXT],
+AC_DEFUN([_AC_COMPILER_EXEEXT],
 [AC_LANG_CONFTEST([_AC_LANG_NULL_PROGRAM])
 ac_clean_files_save=$ac_clean_files
 ac_clean_files=$ac_clean_files a.out a.out.dSYM a.exe b.out
diff --git a/tests/autotest.at b/tests/autotest.at
index 82084b5..78e8c6b 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -1886,6 +1886,118 @@ AT_CHECK([grep 'two spaces' suite.log], [1])
 AT_CLEANUP
 
 
+## --- ##
+## C executables.  ##
+## --- ##
+
+AT_SETUP([C unit tests])
+AT_KEYWORDS([AC_@t@CONFIG_TESTDIR])
+
+mkdir t
+AT_DATA([configure.ac], [[AC_INIT
+AC_PROG_CC
+AC_CONFIG_TESTDIR([t], [.])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+# Test file
+AT_DATA([testprog.c],
+[[int main(int argc) { return argc == 2 ? 0 : 1; }
+]])
+
+# Testsuite
+AT_DATA([Makefile.in],
+[[CC=@CC@
+CFLAGS=@CFLAGS@
+
+testprog@EXEEXT@: testprog.o
+testprog.o: testprog.c
+.SUFFIXES: .c .o @EXEEXT@
+
+.c.o:
+   $(CC) -c $
+.o@EXEEXT@:
+   $(CC) -o $@ $^
+]])
+
+AT_CHECK_AT_PREP([suite],
+[[AT_INIT([suite to check C programs])
+AT_SETUP([my only test])
+AT_CHECK([testprog$EXEEXT foo], [0])
+AT_CHECK([testprog$EXEEXT], [1])
+AT_CLEANUP
+]], [], [], [], [t])
+
+rm t/atconfig
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+AT_CHECK([grep '^EXEEXT='\''.*'\' t/atconfig], [], [ignore])
+AT_CHECK([make], [], [ignore])
+AT_CHECK([cd t  $CONFIG_SHELL ./suite], [], [ignore])
+AT_CHECK([grep 1.*successful t/suite.log], [], [ignore])
+AT_CLEANUP
+
+
+## -- ##
+## C executables (force .exe extension).  ##
+## -- ##
+
+AT_SETUP([C unit tests (EXEEXT)])
+AT_KEYWORDS([AC_@t@CONFIG_TESTDIR])
+
+mkdir t
+AT_DATA([configure.ac], [[AC_INIT
+AC_PROG_CC
+case $ac_cv_exeext in
+  '' | .exe) ;;
+  *) exit 77 ;;
+esac
+ac_cv_exeext=.exe
+AC_SUBST([EXEEXT], [$ac_cv_exeext])
+AC_CONFIG_TESTDIR([t], [.])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+# Test file
+AT_DATA([testprog.c],
+[[int main(int argc) { return argc == 2 ? 0 : 1; }
+]])
+
+# Testsuite
+AT_DATA([Makefile.in],
+[[CC=@CC@
+CFLAGS=@CFLAGS@
+
+testprog@EXEEXT@: testprog.o
+testprog.o: testprog.c
+.SUFFIXES: .c .o @EXEEXT@
+
+.c.o:
+   $(CC) -c $
+.o@EXEEXT@:
+   $(CC) -o $@ $^
+]])
+
+AT_CHECK_AT_PREP([suite],
+[[AT_INIT([suite to check C programs])
+AT_SETUP([my only test])
+AT_CHECK([testprog$EXEEXT foo], [0])
+AT_CHECK([testprog$EXEEXT], [1])
+AT_CLEANUP
+]], [], [], [], [t])
+
+rm t/atconfig
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+AT_CHECK([grep '^EXEEXT='\''.*'\' t/atconfig], [], [ignore])
+AT_CHECK([make], [], [ignore])
+AT_CHECK([cd t  $CONFIG_SHELL ./suite], [], [ignore])
+AT_CHECK([grep 1.*successful t/suite.log], [], [ignore])
+AT_CLEANUP
+
+
 ## - ##
 ## Erlang EUnit unit tests.  ##
 ## - ##
-- 
1.8.0.1





[PATCH 3/3] autotest: enable usage of EXEEXT in AT_TESTED

2012-12-16 Thread Paolo Bonzini
* tests/autotest.at (AT_INIT): Expand contents of $at_tested.
(AT_TESTED): Quote each program that is passed to the function.
* lib/autotest/general.m4 (C unit tests): Add AT_TESTED invocation
and keyword.
* doc/autoconf.texi (Writing testsuites): Document usage of variables
in AT_TESTED.
* NEWS: Document change.

Signed-off-by: Paolo Bonzini bonz...@gnu.org
---
 NEWS| 2 ++
 doc/autoconf.texi   | 6 ++
 lib/autotest/general.m4 | 4 ++--
 tests/autotest.at   | 4 
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 6fa116a..185ca26 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,8 @@ GNU Autoconf NEWS - User visible changes.
 - AC_CONFIG_TESTDIR will automatically pass EXEEXT to a testsuite (via
   the atconfig file).
 
+- AT_TESTED arguments can use variable or command substitutions, including
+  in particular $EXEEXT
 
 * Noteworthy changes in release 2.69 (2012-04-24) [stable]
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index b0526da..c45a8c2 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -25029,6 +25029,12 @@ Writing Testsuites
 the test suite itself, or its occasional misuses.  It is a good idea to
 also subscribe foreign programs you depend upon, to avoid incompatible
 diagnostics.
+
+@var{executables} is implicitly wrapped in shell double quotes, but it
+will still use shell variable expansion (@samp{$}), command substitution
+(@samp{`}), and backslash escaping (@samp{\}).  In particular, the
+@env{EXEEXT} variable is available if it is passed to the testsuite
+via @file{atlocal} or @file{atconfig}.
 @end defmac
 
 @sp 1
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 7be2e3b..88b6c1d 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1001,7 +1001,7 @@ m4_divert_push([PREPARE_TESTS])dnl
 } AS_MESSAGE_LOG_FD
 
 # Report what programs are being tested.
-for at_program in : $at_tested
+for at_program in : `eval echo $at_tested`
 do
   test $at_program = :  continue
   case $at_program in
@@ -1794,7 +1794,7 @@ 
m4_defun([AT_ARG_OPTION_ARG],[_AT_ARG_OPTION([$1],[$2],1,[$3],[$4])])
 # must correspond to the version of the package.  PATH should be
 # already preset so the proper executable will be selected.
 m4_define([AT_TESTED],
-[m4_append_uniq_w([AT_tested], [$1])])
+[m4_append_uniq_w([AT_tested], [$1])])
 
 
 # AT_COPYRIGHT(TEXT, [FILTER = m4_newline])
diff --git a/tests/autotest.at b/tests/autotest.at
index 78e8c6b..401cfc3 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -1892,6 +1892,7 @@ AT_CLEANUP
 
 AT_SETUP([C unit tests])
 AT_KEYWORDS([AC_@t@CONFIG_TESTDIR])
+AT_KEYWORDS([AT_@t@TESTED])
 
 mkdir t
 AT_DATA([configure.ac], [[AC_INIT
@@ -1923,6 +1924,7 @@ testprog.o: testprog.c
 
 AT_CHECK_AT_PREP([suite],
 [[AT_INIT([suite to check C programs])
+AT_TESTED([testprog$EXEEXT])
 AT_SETUP([my only test])
 AT_CHECK([testprog$EXEEXT foo], [0])
 AT_CHECK([testprog$EXEEXT], [1])
@@ -1945,6 +1947,7 @@ AT_CLEANUP
 
 AT_SETUP([C unit tests (EXEEXT)])
 AT_KEYWORDS([AC_@t@CONFIG_TESTDIR])
+AT_KEYWORDS([AT_@t@TESTED])
 
 mkdir t
 AT_DATA([configure.ac], [[AC_INIT
@@ -1982,6 +1985,7 @@ testprog.o: testprog.c
 
 AT_CHECK_AT_PREP([suite],
 [[AT_INIT([suite to check C programs])
+AT_TESTED([testprog$EXEEXT])
 AT_SETUP([my only test])
 AT_CHECK([testprog$EXEEXT foo], [0])
 AT_CHECK([testprog$EXEEXT], [1])
-- 
1.8.0.1




Re: RE : RE : rm -f core cause some troubles

2012-12-16 Thread Bob Friesenhahn

On Sat, 15 Dec 2012, NightStrike wrote:


On Sat, Dec 15, 2012 at 2:18 PM, Paul Eggert egg...@cs.ucla.edu wrote:

On 12/15/2012 03:08 PM, Jeffrey Walton wrote:


Is the program designed to remove old core
files as part of the autoconf process?



No, new cores.  'configure' regularly generates
programs that dump core, as part of its ordinary
working procedure.


Why not just use ulimit to not dump core?  Or is that a bashism and not a shism?


The ulimit approach seems useful.

Blindly trying to remove a file named 'core' seems somewhat silly 
since many OSs do not write a file named 'core'.  Instead they write a 
core file with some other file name or even write all core files to 
some other directory on the system.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/

___
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf


Re: RE : RE : rm -f core cause some troubles

2012-12-16 Thread Paul Eggert

On 12/16/2012 07:06 AM, Bob Friesenhahn wrote:

Why not just use ulimit to not dump core?  Or is that a bashism and not a shism?


The ulimit approach seems useful.


Yes, that would be nice to add, if someone writes
a patch.  I doubt whether it'd work everywhere, though.
 

Instead they write a core file with some other file name


Autoconf-generated 'configure' scripts remove the commonly-used
file names for core files.


or even write all core files to some other directory on the system.


It doesn't catch those.

___
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf


Re: Future autoconf package compression

2012-12-16 Thread Jeffrey Walton
On Sat, Dec 15, 2012 at 9:35 PM, Jim Meyering j...@meyering.net wrote:
 Paul Eggert wrote:
 On 12/15/2012 05:54 PM, Jim Meyering wrote:
 FYI, a couple of weeks ago, Aki Helin exposed still more problems in
 gzip's unpacking code.

 Well, to be fair, I also have a similar problem with 'tar'
 in my inbox, from Aki, but I'm not inclined to suggest that
 we stop using 'tar'

 Of course.  Nor am I.
 GNU tar's overall code quality is far higher than that of gzip.
-Wall -Wextra -Wconversion -Wstrict-overflow go a long way in
uncovering basic developer problems, like truncations, conversions,
and 2's compliment behavior. Everyone - from GNU to private
development teams - could benefit from the illumination of issues by
the toolchain's warning system.

I understand the warning system produces false positives at times, but
I don't throw the baby out with the bath water. I work around the
warning system's short comings in an effort to keep code quality up.
Its what we have to do to separate the wheat from the chaff.

 Its too bad they are not used more often.

Jeff

___
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf


Re: Future autoconf package compression

2012-12-16 Thread Jim Meyering
Jeffrey Walton wrote:

 On Sat, Dec 15, 2012 at 9:35 PM, Jim Meyering j...@meyering.net wrote:
 Paul Eggert wrote:
 On 12/15/2012 05:54 PM, Jim Meyering wrote:
 FYI, a couple of weeks ago, Aki Helin exposed still more problems in
 gzip's unpacking code.

 Well, to be fair, I also have a similar problem with 'tar'
 in my inbox, from Aki, but I'm not inclined to suggest that
 we stop using 'tar'

 Of course.  Nor am I.
 GNU tar's overall code quality is far higher than that of gzip.
 -Wall -Wextra -Wconversion -Wstrict-overflow go a long way in
 uncovering basic developer problems, like truncations, conversions,
 and 2's compliment behavior. Everyone - from GNU to private
 development teams - could benefit from the illumination of issues by
 the toolchain's warning system.

 I understand the warning system produces false positives at times, but
 I don't throw the baby out with the bath water. I work around the
 warning system's short comings in an effort to keep code quality up.
 Its what we have to do to separate the wheat from the chaff.

  Its too bad they are not used more often.

If you have noticed real problems in tar or gzip (or any other
GNU project) about which gcc can warn, please let us know.

It sounds like you are trying to teach grandma how to suck eggs :-)

Did you realize that several GNU projects now enable virtually
every gcc warning that is available (even including those that
are new in the upcoming gcc-4.8, for folks that use bleeding edge gcc)
via gnulib's manywarnings.m4 configure-time tests?

Of course, there is a list of warnings that we do disable,
due to their typical lack of utility and the invasiveness
of changes required do suppress them.

___
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf