automake-patches
[Top][All Lists]
Advanced

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

Test for --help and --version in gnits mode


From: Bonzini Paolo
Subject: Test for --help and --version in gnits mode
Date: Mon, 4 Feb 2002 14:10:54 +0100 (MET)

This does the above.  A skeleton was already present in scripts.am,
it was adapted and used by a new std-options flag.  Documentation
fixes also in the patch.

2002-02-04  Paolo Bonzini <address@hidden>

        * automake.in (am_install_vars): pass CK-OPTS appropriately.
        (handle_options): recognize std-options and enable it in
        GNITS mode.
        (do_check_merge_target): sort and uniq'ify check_tests before
        pretty printing it.
        (handle_minor_options): if std-options enabled, make check
        depend on check-options.

        * tests/gnits2.test: test that --help/--version are recognized
        in GNITS mode
        * tests/Makefile.am (TESTS): added gnits2.test

        * automake.texi (Options): document std-options

diff -rNC3 automake-1.5-orig/automake.in automake-1.5/automake.in
*** automake-1.5-orig/automake.in       Thu Aug 23 07:26:53 2001
--- automake-1.5/automake.in    Mon Feb  4 14:41:00 2002
***************
*** 1428,1434 ****
                   || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
                   || $_ eq 'readme-alpha' || $_ eq 'check-news'
                   || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
!                  || $_ eq 'no-exeext')
            {
                # Explicitly recognize these.
            }
--- 1428,1434 ----
                   || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
                   || $_ eq 'readme-alpha' || $_ eq 'check-news'
                   || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
!                  || $_ eq 'no-exeext' || $_ eq 'std-options')
            {
                # Explicitly recognize these.
            }
***************
*** 1456,1461 ****
--- 1456,1462 ----
      {
        $options{'readme-alpha'} = 1;
        $options{'check-news'} = 1;
+       $options{'std-options'} = 1;
      }
  
      return 0;
***************
*** 4000,4006 ****
            if @check;
      }
      &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t  ",
!                       @check_tests)
        if @check_tests;
  
      &depend ('.PHONY', 'check', 'check-am');
--- 4001,4007 ----
            if @check;
      }
      &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t  ",
!                       uniq (sort @check_tests))
        if @check_tests;
  
      &depend ('.PHONY', 'check', 'check-am');
***************
*** 4245,4250 ****
--- 4246,4256 ----
  # 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 '.')
***************
*** 7339,7344 ****
--- 7345,7353 ----
                      ? $exec_dir_p {$X}
                      : ($X =~ /exec/));
  
+       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,
***************
*** 7352,7358 ****
  
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
!                                         'DIST'    => $dist_p));
  
        $first = 0;
      }
--- 7361,7368 ----
  
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
!                                         'DIST'    => $dist_p,
!                                         'CK-OPTS' => $check_options_p));
  
        $first = 0;
      }
diff -rNC3 automake-1.5-orig/lib/am/progs.am automake-1.5/lib/am/progs.am
*** automake-1.5-orig/lib/am/progs.am   Sun Jul 22 23:50:18 2001
--- automake-1.5/lib/am/progs.am        Mon Feb  4 14:52:46 2002
***************
*** 74,76 ****
--- 74,96 ----
  .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:
+       bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
+         for opt in --help --version; do \
+           if test -f $$p; then \
+             p=./$$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 does not support $$opt" 1>&2; bad=1; fi; \
+         done; \
+       done; rm -f .chk???$$pid; exit $$bad
+ endif %?CK-OPTS%
diff -rNC3 automake-1.5-orig/lib/am/scripts.am automake-1.5/lib/am/scripts.am
*** automake-1.5-orig/lib/am/scripts.am Mon Apr  9 16:23:09 2001
--- automake-1.5/lib/am/scripts.am      Mon Feb  4 14:52:50 2002
***************
*** 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,92 ----
  ## Checking.  ##
  ## ---------- ##
  
! if %?CK-OPTS%
! .PHONY check-options: check-%DIR%PROGRAMS
! check-%DIR%SCRIPTS:
!       bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
!         for opt in --help --version; do \
!           if test -f $$p; then \
!             p=./$$p; \
!           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 does not support $$opt" 1>&2; bad=1; fi; \
!         done; \
!       done; rm -f .chk???$$pid; exit $$bad
! endif %?CK-OPTS%
diff -rNC3 automake-1.5-orig/tests/Makefile.am automake-1.5/tests/Makefile.am
*** automake-1.5-orig/tests/Makefile.am Thu Aug 23 07:34:02 2001
--- automake-1.5/tests/Makefile.am      Mon Feb  4 14:10:00 2002
***************
*** 145,150 ****
--- 145,151 ----
  gcj2.test \
  gcj3.test \
  gnits.test \
+ gnits2.test \
  header.test \
  implicit.test \
  include.test \
diff -rNC3 automake-1.5-orig/tests/gnits2.test automake-1.5/tests/gnits2.test
*** automake-1.5-orig/tests/gnits2.test Thu Jan  1 01:00:00 1970
--- automake-1.5/tests/gnits2.test      Mon Feb  4 14:44:36 2002
***************
*** 0 ****
--- 1,86 ----
+ #! /bin/sh
+ 
+ # Test to ensure --gnits option checking is correct.
+ 
+ . $srcdir/defs || exit 1
+ 
+ # Fail gracefully if no autoconf.
+ $needs_autoconf
+ # Likewise for some other tools.
+ (gcc -v) > /dev/null 2>&1 || exit 77
+ 
+ cat > configure.in << 'END'
+ AC_INIT
+ AC_CONFIG_AUX_DIR([.])
+ AM_INIT_AUTOMAKE(foo, 0.1)
+ PACKAGE=foo
+ VERSION=0.1
+ AC_PROG_MAKE_SET
+ AC_PROG_INSTALL
+ AC_PROG_CC
+ AC_OUTPUT(Makefile)
+ END
+ 
+ cat > Makefile.am << 'END'
+ 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 --gnits
+ 
+ mkdir sub
+ cd sub
+ 
+ ../configure
+ $MAKE all
+ exit `$MAKE check 2>&1 | sed -f ../check.sed`





reply via email to

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