automake-patches
[Top][All Lists]
Advanced

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

patch 4: test for --help and --version


From: Bonzini
Subject: patch 4: test for --help and --version
Date: Wed, 12 Jun 2002 09:00:17 -0400
User-agent: Mutt/1.3.25i

This patch adds a test for --help and --version in gnits mode.
installcheck is not very well supported by Automake, so I decided not to
add it automatically to GNITS programs.  std-options must then be enable
manually.

2002-05-03      Paolo Bonzini  (address@hidden)

         * automake.in (process_option_list): recognize std-options
         (handle_minor_options): handle std-options
         (am_install_var): handle std-options
         * lib/am/scripts.am: Added the check-options target.
         * lib/am/progs.am: Added the check-options target.
         * tests/gnits2.test: new test case for this feature
         * tests/Makefile.am: added gnits2.test
         

diff -rpC3 automake.old/NEWS automake.check/NEWS
*** automake.old/NEWS   Fri May  3 08:17:22 2002
--- automake.check/NEWS Wed Jun 12 08:57:37 2002
***************
*** 1,4 ****
--- 1,7 ----
  New in 1.6a:
+ * A new option std-options tests that programs support --help and --version.
+   This is still experimental and only works if the program can be run before
+   installation, so it is not yet enabled by --gnu or --gnits.
  * It is no longuer a requirement to use AM_CONFIG_HEADER instead of
    AC_CONFIG_HEADERS.  AM_CONFIG_HEADER is obsolete.
  * Use Autoconf's --trace interface to inspect configure.ac and get
diff -rpC3 automake.old/automake.in automake.check/automake.in
*** automake.old/automake.in    Fri May  3 08:17:22 2002
--- automake.check/automake.in  Wed Jun 12 08:55:26 2002
*************** sub process_option_list
*** 1449,1455 ****
               || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
               || $_ eq 'readme-alpha' || $_ eq 'check-news'
               || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
!              || $_ eq 'no-exeext' || $_ eq 'no-define')
        {
            # Explicitly recognize these.
        }
--- 1449,1456 ----
               || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
               || $_ eq 'readme-alpha' || $_ eq 'check-news'
               || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
!              || $_ eq 'no-exeext' || $_ eq 'no-define'
!              || $_ eq 'std-options')
        {
            # Explicitly recognize these.
        }
*************** sub do_check_merge_target
*** 4236,4242 ****
            if @check;
      }
      &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t  ",
!                       @check_tests)
        if @check_tests;
  
      &depend ('.PHONY', 'check', 'check-am');
--- 4237,4243 ----
            if @check;
      }
      &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t  ",
!                       sort @check_tests)
        if @check_tests;
  
      &depend ('.PHONY', 'check', 'check-am');
*************** sub handle_java
*** 4479,4484 ****
--- 4480,4490 ----
  # Handle some of the minor options.
  sub handle_minor_options
  {
+     if (defined $options{'std-options'})
+     {
+       push (@check_tests, 'check-options');
+     }
+ 
      if (defined $options{'readme-alpha'})
      {
        if ($relative_dir eq '.')
*************** sub am_install_var
*** 7526,7531 ****
--- 7532,7540 ----
        # 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,
*************** sub am_install_var
*** 7539,7545 ****
  
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
!                                         'DIST'    => $dist_p));
  
        $first = 0;
      }
--- 7548,7555 ----
  
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
!                                         'DIST'    => $dist_p,
!                                         'CK-OPTS' => $check_options_p));
  
        $first = 0;
      }
diff -rpC3 automake.old/automake.texi automake.check/automake.texi
*** automake.old/automake.texi  Fri May  3 08:17:22 2002
--- automake.check/automake.texi        Wed Jun 12 08:30:18 2002
*************** non-alpha releases.  The second form is
*** 4200,4205 ****
--- 4200,4211 ----
  @address@hidden@address@hidden, where @var{ALPHA} is a
  letter; it should be omitted for non-alpha releases.
  
+ @item @code{std-options}
+ @cindex Options, std-options
+ Make the @code{check} target check that installed scripts and programs
+ support the @code{--help} and @code{--version} options.  This works only
+ if these options work before the program is installed.
+ 
  @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
diff -rpC3 automake.old/lib/am/progs.am automake.check/lib/am/progs.am
*** automake.old/lib/am/progs.am        Fri May  3 08:17:22 2002
--- automake.check/lib/am/progs.am      Wed Jun 12 08:30:18 2002
*************** endif %?INSTALL%
*** 81,83 ****
--- 81,101 ----
  .PHONY clean-am: clean-%DIR%PROGRAMS
  clean-%DIR%PROGRAMS:
        -test -z "$(%DIR%_PROGRAMS)" || rm -f $(%DIR%_PROGRAMS)
+ 
+ ## ---------- ##
+ ## Checking.  ##
+ ## ---------- ##
+ 
+ if %?CK-OPTS%
+ .PHONY check-options: check-%DIR%PROGRAMS
+ check-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
+       bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
+         for opt in --help --version; do \
+           if ./$$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%
+ 
diff -rpC3 automake.old/lib/am/scripts.am automake.check/lib/am/scripts.am
*** automake.old/lib/am/scripts.am      Fri May  3 08:17:22 2002
--- automake.check/lib/am/scripts.am    Wed Jun 12 08:30:18 2002
*************** endif %?DIST%
*** 73,89 ****
  ## 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
--- 73,93 ----
  ## Checking.  ##
  ## ---------- ##
  
! if %?CK-OPTS%
! .PHONY check-options: check-%DIR%SCRIPTS
! check-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
!       bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
!         if test -f $$p; then \
!           p=./$$p; \
!         elif test -f $(srcdir)/$$p; then \
!           p=$(srcdir)/$$p; \
!         else exit 1; fi; \
!         for opt in --help --version; do \
!           if $$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%
! 
diff -rpC3 automake.old/tests/Makefile.am automake.check/tests/Makefile.am
*** automake.old/tests/Makefile.am      Fri May  3 08:17:22 2002
--- automake.check/tests/Makefile.am    Wed Jun 12 08:30:18 2002
*************** gcj.test \
*** 162,167 ****
--- 162,168 ----
  gcj2.test \
  gcj3.test \
  gnits.test \
+ gnits2.test \
  header.test \
  implicit.test \
  include.test \







reply via email to

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