"Fossies" - the Fresh Open Source Software Archive

Member "cook-2.34/test/01/t0148a.sh" (25 Sep 2010, 2434 Bytes) of package /linux/misc/old/cook-2.34.tar.gz:


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. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 #
    3 #       cook - file construction tool
    4 #       Copyright (C) 1998, 2007, 2008 Peter Miller
    5 #
    6 #       This program is free software; you can redistribute it and/or modify
    7 #       it under the terms of the GNU General Public License as published by
    8 #       the Free Software Foundation; either version 3 of the License, or
    9 #       (at your option) any later version.
   10 #
   11 #       This program is distributed in the hope that it will be useful,
   12 #       but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 #       GNU General Public License for more details.
   15 #
   16 #       You should have received a copy of the GNU General Public License
   17 #       along with this program. If not, see
   18 #       <http://www.gnu.org/licenses/>.
   19 #
   20 work=${COOK_TMP:-/tmp}/$$
   21 PAGER=cat
   22 export PAGER
   23 umask 022
   24 unset COOK
   25 here=`pwd`
   26 if test $? -ne 0 ; then exit 2; fi
   27 SHELL=/bin/sh
   28 export SHELL
   29 
   30 bin="$here/${1-.}/bin"
   31 
   32 pass()
   33 {
   34         set +x
   35         cd $here
   36         rm -rf $work
   37         exit 0
   38 }
   39 fail()
   40 {
   41         set +x
   42         echo 'FAILED test of the c_incl -norecurs functionality' 1>&2
   43         cd $here
   44         rm -rf $work
   45         exit 1
   46 }
   47 no_result()
   48 {
   49         set +x
   50         echo 'NO RESULT for test of the c_incl -norecurs functionality' 1>&2
   51         cd $here
   52         rm -rf $work
   53         exit 2
   54 }
   55 trap \"no_result\" 1 2 3 15
   56 
   57 mkdir $work $work/lib
   58 if test $? -ne 0 ; then no_result; fi
   59 cd $work
   60 if test $? -ne 0 ; then no_result; fi
   61 
   62 #
   63 # Use the default error messages.  There is no other way to get
   64 # predictable test behaviour on the unknown systems we will be tested on.
   65 #
   66 COOK_MESSAGE_LIBRARY=$work/no-such-dir
   67 export COOK_MESSAGE_LIBRARY
   68 unset LANG
   69 unset LANGUAGE
   70 
   71 #
   72 # test the c_incl -norecurs functionality
   73 #
   74 cat > test.c << 'fubar'
   75 #include "a.h"
   76 fubar
   77 if test $? -ne 0 ; then no_result; fi
   78 
   79 cat > a.h << 'fubar'
   80 #include "b.h"
   81 fubar
   82 if test $? -ne 0 ; then no_result; fi
   83 
   84 cat > b.h << 'fubar'
   85 /* ha ha */
   86 fubar
   87 if test $? -ne 0 ; then no_result; fi
   88 
   89 cat > test.ok << 'fubar'
   90 cascade-for test.c:
   91 a.h
   92 ;
   93 fubar
   94 if test $? -ne 0 ; then no_result; fi
   95 
   96 $bin/c_incl -norec --prefix="cascade-for test.c:" --suffix=";" test.c > test.out
   97 if test $? -ne 0 ; then fail; fi
   98 
   99 diff test.ok test.out
  100 if test $? -ne 0 ; then fail; fi
  101 
  102 #
  103 # Only definite negatives are possible.
  104 # The functionality exercised by this test appears to work,
  105 # no other guarantees are made.
  106 #
  107 pass