automake-patches
[Top][All Lists]
Advanced

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

Re: patch 4: test for --help and --version (take 3)


From: Alexandre Duret-Lutz
Subject: Re: patch 4: test for --help and --version (take 3)
Date: Mon, 17 Jun 2002 14:20:06 +0200
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu)

>>> "Paolo" == Paolo Bonzini <address@hidden> writes:

 Paolo> ansi3.test:main (int argc, char *argv[])
 Paolo> ansi5.test:main (int argc, char *argv[])
 Paolo> ansi5.test:main (int argc, char *argv[])
 Paolo> ansi6.test:main (int argc, char **argv)
 Paolo> ansi7.test:main (int argc, char **argv)
 Paolo> depend2.test:main (int argc, char *argv[])
 Paolo> gnits2.test:echo 'main(int argc, char **argv) { exit(0); }' > fubar.c
 Paolo> gnits2.test:echo 'main(int argc, char **argv) { exit(0); }' > fubar2.c
 Paolo> gnits2.test:main(int argc, char **argv) {
 Paolo> pr204.test:void yyerror (char *s) {}
 Paolo> specflags7.test:main (int argc, char *argv[])
 Paolo> specflags8.test:main (int argc, char *argv[])
 Paolo> subobj3.test:main (int argc, char *argv[])
 Paolo> subobj9.test:int doit (void)
 Paolo> yacc4.test:void yyerror (char *s) {}
 Paolo> yacc4.test:void yyerror (char *s) {}
 Paolo> yacc8.test:void yyerror (char *s) {}
 Paolo> yaccvpath.test:void yyerror (char *s) {}
 Paolo> yaccvpath.test:void yyerror (char *s) {}
 Paolo> yaccvpath.test:void yyerror (char *s) {}

 Paolo> I guess the ones in ansi* are intended, but not the others.

So do I.  Ideally we should have a check for this in
maintainer-check (see Makefile.am in the top directory).

Another similar issue is that when a test does `required=gcc',
it should run `./configure CC=gcc'.  Because CC might be set to
something else in the environment.

[...]

 Paolo> You can apply my patch as is, as soon as you tell me
 Paolo> it's committed I can provide another patch that fixes
 Paolo> them all.

I'm checking in this.

Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1875
diff -u -r1.1875 ChangeLog
--- ChangeLog   17 Jun 2002 07:42:04 -0000      1.1875
+++ ChangeLog   17 Jun 2002 12:09:09 -0000
@@ -1,3 +1,14 @@
+2002-06-17  Paolo Bonzini  <address@hidden>
+
+       * automake.in (process_option_list): Recognize std-options.
+       (handle_options): Enable std-options in gnits strictness.
+       (am_install_var): If std-options, enable CK-OPTS section.
+       * lib/am/scripts.am (installcheck-am): New target.
+       * lib/am/progs.am (installcheck-am): New target.
+       * tests/gnits2.test: New file.
+       * tests/Makefile.am (TESTS): Add gnits2.test.
+       * automake.texi (Gnits, Options): Document std-options.
+
 2002-06-17  Kevin Ryde  <address@hidden>
 
        * automake.in (scan_texinfo_file): Add tmp to @clean_suffixes,
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.180
diff -u -r1.180 NEWS
--- NEWS        13 Jun 2002 08:09:27 -0000      1.180
+++ NEWS        17 Jun 2002 12:09:09 -0000
@@ -1,4 +1,6 @@
 New in 1.6a:
+* A new option, std-options, tests that programs support --help and --version
+  when `make installcheck' is run.  This is enabled by --gnits.
 * PDF files are generated by Automake
 * `make distcheck' will enforce DESTDIR support by attempting
   a DESTDIR install.
Index: TODO
===================================================================
RCS file: /cvs/automake/automake/TODO,v
retrieving revision 1.418
diff -u -r1.418 TODO
--- TODO        7 May 2002 07:06:36 -0000       1.418
+++ TODO        17 Jun 2002 12:09:09 -0000
@@ -205,8 +205,6 @@
 * should not put texiname_TEXINFOS into distribution
   should rename this macro anyway, to foo_texi_DEPENDENCIES
 
-* *all* installed scripts should support --version, --help
-
 * For now I guess I'll just have automake give an error if it encounters
 non-C source in a libtool library specification.
 
@@ -269,7 +267,6 @@
   fragments to be merged.  e.g., `install-local'.
 
 consider putting all check-* targets onto @check?
-To support --help/--version checking?
 
 take diff-n-query code from libit
 
@@ -320,7 +317,6 @@
 *    Don't include any symbolic links in the distribution itself.
      (ditto hard links)
 *    Make sure that all the files in the distribution are world-readable.
-** also, check --help output and --version output.  Idea from François
 * standards no longer prohibit ANSI C.  What does this imply
   for the de-ansi-fication feature? [ must keep it -- some users rely on it ]
 
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1305
diff -u -r1.1305 automake.in
--- automake.in 17 Jun 2002 07:42:07 -0000      1.1305
+++ automake.in 17 Jun 2002 12:09:10 -0000
@@ -1462,7 +1462,8 @@
               || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
               || $_ eq 'readme-alpha' || $_ eq 'check-news'
               || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
-              || $_ eq 'no-exeext' || $_ eq 'no-define')
+              || $_ eq 'no-exeext' || $_ eq 'no-define'
+              || $_ eq 'std-options')
        {
            # Explicitly recognize these.
        }
@@ -1529,6 +1530,7 @@
     if ($strictness == GNITS)
     {
        $options{'readme-alpha'} = 1;
+       $options{'std-options'} = 1;
        $options{'check-news'} = 1;
     }
 
@@ -7782,6 +7784,9 @@
        # If so, with install-exec? (or install-data?).
        my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o);
 
+       my $check_options_p = $install_p
+                             && defined $options{'std-options'};
+
        # Singular form of $PRIMARY.
        (my $one_primary = $primary) =~ s/S$//;
        $output_rules .= &file_contents ($file,
@@ -7795,7 +7800,8 @@
 
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
-                                         'DIST'    => $dist_p));
+                                         'DIST'    => $dist_p,
+                                         'CK-OPTS' => $check_options_p));
 
        $first = 0;
     }
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.279
diff -u -r1.279 automake.texi
--- automake.texi       13 Jun 2002 08:48:10 -0000      1.279
+++ automake.texi       17 Jun 2002 12:09:10 -0000
@@ -4204,6 +4204,11 @@
 @address@hidden@address@hidden, where @var{ALPHA} is a
 letter; it should be omitted for non-alpha releases.
 
address@hidden @code{std-options}
address@hidden Options, std-options
+Make the @code{installcheck} target check that installed scripts and
+programs support the @code{--help} and @code{--version} options.
+
 @item @code{subdir-objects}
 If this option is specified, then objects are placed into the
 subdirectory of the build directory corresponding to the subdirectory of
@@ -4509,6 +4514,12 @@
 checks the following as well:
 
 @itemize @bullet
address@hidden
address@hidden installcheck} will check to make sure that the @code{--help}
+and @code{--version} really print a usage message and a version string,
+respectively.  This also provides a basic check that the program's
+run-time dependencies are satisfied after installation.
+
 @item
 @samp{make dist} will check to make sure the @file{NEWS} file has been
 updated to the current version.
Index: stamp-vti
===================================================================
RCS file: /cvs/automake/automake/stamp-vti,v
retrieving revision 1.179
diff -u -r1.179 stamp-vti
--- stamp-vti   13 Jun 2002 08:48:11 -0000      1.179
+++ stamp-vti   17 Jun 2002 12:09:10 -0000
@@ -1,4 +1,4 @@
address@hidden UPDATED 13 June 2002
address@hidden UPDATED 17 June 2002
 @set UPDATED-MONTH June 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
Index: version.texi
===================================================================
RCS file: /cvs/automake/automake/version.texi,v
retrieving revision 1.252
diff -u -r1.252 version.texi
--- version.texi        13 Jun 2002 08:48:11 -0000      1.252
+++ version.texi        17 Jun 2002 12:09:10 -0000
@@ -1,4 +1,4 @@
address@hidden UPDATED 13 June 2002
address@hidden UPDATED 17 June 2002
 @set UPDATED-MONTH June 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
Index: lib/am/progs.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/progs.am,v
retrieving revision 1.34
diff -u -r1.34 progs.am
--- lib/am/progs.am     8 May 2002 08:56:42 -0000       1.34
+++ lib/am/progs.am     17 Jun 2002 12:09:11 -0000
@@ -94,3 +94,21 @@
 ?LIBTOOL?        echo " rm -f $$p $$f"; \
 ?LIBTOOL?        rm -f $$p $$f ; \
 ?LIBTOOL?      done
+
+
+## ---------- ##
+## Checking.  ##
+## ---------- ##
+
+if %?CK-OPTS%
+.PHONY installcheck-am: installcheck-%DIR%PROGRAMS
+installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
+       bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
+         for opt in --help --version; do \
+           if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> 
c$${pid}_.err \
+                && test -n "`cat c$${pid}_.out`" \
+                && test -z "`cat c$${pid}_.err`"; then :; \
+           else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \
+         done; \
+       done; rm -f c$${pid}_.???; exit $$bad
+endif %?CK-OPTS%
Index: lib/am/scripts.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/scripts.am,v
retrieving revision 1.43
diff -u -r1.43 scripts.am
--- lib/am/scripts.am   9 Jun 2002 11:12:34 -0000       1.43
+++ lib/am/scripts.am   17 Jun 2002 12:09:11 -0000
@@ -81,17 +81,16 @@
 ## Checking.  ##
 ## ---------- ##
 
-## Uncomment line in handle_scripts when this is uncommented.
-## check-%DIR%SCRIPTS:
-##     pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
-##       for opt in --help --version; do \
-##         if test -f $$p; then :; \
-##         elif test -f $(srcdir)/$$p; then \
-##           p=$(srcdir)/$$p; \
-##         else exit 1; fi; \
-##         if $$p $$opt > .chkout$$pid 2> .chkerr$$pid \
-##              && test -n "`cat .chkout$$pid`" \
-##              && test -z "`cat .chkerr$$pid`"; then :; \
-##         else echo "$$p failed $$opt test" 1>&2; exit 1; fi; \
-##       done; \
-##     done; rm -f .chk???$$pid
+if %?CK-OPTS%
+.PHONY installcheck-am: installcheck-%DIR%SCRIPTS
+installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
+       bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
+         for opt in --help --version; do \
+           if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> 
c$${pid}_.err \
+                && test -n "`cat c$${pid}_.out`" \
+                && test -z "`cat c$${pid}_.err`"; then :; \
+           else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \
+         done; \
+       done; rm -f c$${pid}_.???; exit $$bad
+endif %?CK-OPTS%
+
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.408
diff -u -r1.408 Makefile.am
--- tests/Makefile.am   14 Jun 2002 06:48:30 -0000      1.408
+++ tests/Makefile.am   17 Jun 2002 12:09:11 -0000
@@ -170,6 +170,7 @@
 gcj3.test \
 gcj4.test \
 gnits.test \
+gnits2.test \
 header.test \
 implicit.test \
 include.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.526
diff -u -r1.526 Makefile.in
--- tests/Makefile.in   14 Jun 2002 06:48:31 -0000      1.526
+++ tests/Makefile.in   17 Jun 2002 12:09:11 -0000
@@ -256,6 +256,7 @@
 gcj3.test \
 gcj4.test \
 gnits.test \
+gnits2.test \
 header.test \
 implicit.test \
 include.test \
Index: tests/gnits2.test
===================================================================
RCS file: tests/gnits2.test
diff -N tests/gnits2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/gnits2.test   17 Jun 2002 12:09:11 -0000
@@ -0,0 +1,78 @@
+#! /bin/sh
+
+# Test to ensure std-options checking is correct.
+
+required=gcc
+. $srcdir/defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = gnits
+noinst_PROGRAMS = fubar2
+bin_PROGRAMS = fubar fine
+fubar_SOURCES = fubar.c
+fubar2_SOURCES = fubar2.c
+fine_SOURCES = fine.c
+END
+
+echo 'main(int argc, char **argv) { exit(0); }' > fubar.c
+echo 'main(int argc, char **argv) { exit(0); }' > fubar2.c
+
+cat > fine.c << 'END'
+#include <stdio.h>
+main(int argc, char **argv) {
+  puts ("Which version? Which usage?");
+  exit(0);
+}
+END
+
+cat > check.sed << 'END'
+/fubar does not/ {
+  s/.*/0/
+  H
+}
+/fubar2 does not/ {
+  s/.*/1/
+  H
+}
+/fine does not/ {
+  s/.*/1/
+  H
+}
+$!d
+
+g
+/^\n0\n0$/! {
+  s/.*/1/
+  q
+}
+s/.*/0/
+END
+
+# Files required by Gnits.
+: > INSTALL
+: > NEWS
+: > README
+: > COPYING
+: > AUTHORS
+: > ChangeLog
+: > THANKS
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+cd sub
+
+../configure --prefix=`pwd`/../inst-dir
+$MAKE all
+$MAKE install
+exit `$MAKE installcheck 2>&1 | sed -f ../check.sed`
+

-- 
Alexandre Duret-Lutz




reply via email to

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