"Fossies" - the Fresh Open Source Software Archive

Member "automake-1.16.3/t/am-missing-prog.sh" (19 Nov 2020, 2794 Bytes) of package /linux/misc/automake-1.16.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "am-missing-prog.sh": 1.16.2_vs_1.16.3.

    1 #! /bin/sh
    2 # Copyright (C) 2003-2020 Free Software Foundation, Inc.
    3 #
    4 # This program is free software; you can redistribute it and/or modify
    5 # it under the terms of the GNU General Public License as published by
    6 # the Free Software Foundation; either version 2, or (at your option)
    7 # any later version.
    8 #
    9 # This program is distributed in the hope that it will be useful,
   10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12 # GNU General Public License for more details.
   13 #
   14 # You should have received a copy of the GNU General Public License
   15 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
   16 
   17 # Test AM_MISSING_PROG.
   18 
   19 . test-init.sh
   20 
   21 cat >> configure.ac <<'END'
   22 AM_MISSING_PROG([NO_SUCH_COMMAND],    [am-none-none])
   23 AM_MISSING_PROG([MISMATCHED_COMMAND], [am-exit-63])
   24 AM_MISSING_PROG([OVERRIDDEN_COMMAND], [am-none-none])
   25 AM_MISSING_PROG([COMMAND_FOUND],      [my-command])
   26 AC_OUTPUT
   27 END
   28 
   29 mkdir bin
   30 cat > bin/am-exit-63 <<'END'
   31 #!/bin/sh
   32 echo "Oops, I'm too old"
   33 exit 63
   34 END
   35 cat > bin/am-overridden <<'END'
   36 #!/bin/sh
   37 echo "Hey, I'm OK!"
   38 exit 0
   39 END
   40 cat > bin/my-command <<'END'
   41 #!/bin/sh
   42 echo SNAFU
   43 exit 0
   44 END
   45 chmod a+x bin/*
   46 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
   47 
   48 cat > Makefile.am <<'END'
   49 # Different for different targets, for the sake of parallel make.
   50 o = $@-stdout
   51 e = $@-stderr
   52 
   53 debug_info = grep . $@-stdout $@-stderr
   54 status_is = $(debug_info); echo $@: st=$$st; test $$st -eq
   55 
   56 w_mis = 'am-none-none' is needed, and is missing on your system
   57 w_old = 'am-exit-63' is needed, and is probably too old
   58 
   59 test1:
   60     st=0; $(NO_SUCH_COMMAND) >$o 2>$e || st=$$?; $(status_is) 127
   61         grep "^WARNING: $(w_mis)" $e
   62     test ! -s $o
   63 test2:
   64     st=0; $(MISMATCHED_COMMAND) >$o 2>$e || st=$$?; $(status_is) 63
   65         grep "^WARNING: $(w_old)" $e
   66     test "`cat $o`" = "Oops, I'm too old"
   67 test3:
   68     st=0; $(OVERRIDDEN_COMMAND) >$o 2>$e || st=$$?; $(status_is) 0
   69     st=0; $(OVERRIDDEN_COMMAND) >$o 2>$e || st=$$?; \
   70     test ! -s $e
   71     test "`cat $o`" = "Hey, I'm OK!"
   72 test4:
   73     st=0; $(COMMAND_FOUND) >$o 2>$e || st=$$?; $(status_is) 0
   74     test ! -s $e
   75     test "`cat $o`" = SNAFU
   76 check-local: test1 test2 test2 test4
   77 .PHONY: test1 test2 test2 test4
   78 CLEANFILES = test[1234]-stdout test[1234]-stderr
   79 END
   80 
   81 $ACLOCAL
   82 $AUTOCONF
   83 $AUTOMAKE
   84 
   85 ./configure OVERRIDDEN_COMMAND=am-overridden
   86 
   87 $FGREP COMMAND Makefile.in Makefile # For debugging.
   88 
   89 grep "^NO_SUCH_COMMAND = \${SHELL} .*/missing.* .*am-none-none" Makefile
   90 grep "^MISMATCHED_COMMAND = \${SHELL} .*/missing.* .*am-exit-63" Makefile
   91 grep "^COMMAND_FOUND = \${SHELL} .*/missing.* .*my-command" Makefile
   92 grep '^OVERRIDDEN_COMMAND = am-overridden *$' Makefile
   93 
   94 $MAKE test1 test2 test3 test4
   95 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='OVERRIDDEN_COMMAND=am-overridden'
   96 
   97 :