blob: aab683311206aa6e6d8fe304c04c3cde1b5eb1fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#! /bin/sh
# -*- Mode: Shell-script -*-
# directives.test --- test definition directives
#
# Time-stamp: "2011-02-02 12:09:10 bkorb"
# Author: Bruce Korb <bkorb@gnu.org>
##
## This file is part of AutoGen.
## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
##
## AutoGen is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## AutoGen is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with this program. If not, see <http://www.gnu.org/licenses/>.
##
#
# ----------------------------------------------------------------------
. ./defs
# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
mkdir ${testname}.dir
mkdir ${testname}.dir/subdir
LDIR=`pwd`/${testname}.dir
export LDIR
echo creating ${testname}.dir/subdir/${testname}.tpl
cat > ${testname}.dir/subdir/${testname}.tpl <<'_EOF_'
[= AutoGen5 Template test =]
Irrelevant [=foo=].
_EOF_
# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
echo creating ${testname}.inc
${SED} 's/^ *[0-9]*: //' > ${testname}.inc <<_EOF_
1: autogen definitions ${testname};
2:
3: #option templ-dir \$LDIR/subdir
4:
5: /*
6: #define COMMENT
7: #ifdef COMMENT
8: # error error in comment
9: */
10:
11: #ifdef MUMBLE
12: # define MORE
13: #else
14: # define FUMBLE
15: #endif
_EOF_
echo creating ${testname}.def
${SED} 's/^ *[0-9]*: //' > ${testname}.def <<_EOF_
1: autogen definitions ${testname};
2:
3: #include ${testname}.inc
4:
5: #ifdef FUMBLE
6: # error we fumbled mumble
7: #endif
8:
9: #ifndef MORE
10: # error we fumbled more
11: #endif
12:
13: #if (FOO == 1)
14: # error we got iffed
15: #elif (FOO == 0)
16: # error we got FOO zeroed
17: #else
18: # error we got lost
19: #endif
20:
21: #shell
22:
23: echo "#line 1 shelltext"
24: echo "foo = bar;"
25:
26: #endshell
27:
28: #define FUMBLE
29: #undef MORE
30:
31: #ifndef FUMBLE
32: # error we goofed fumble
33: #endif
34:
35: #ifdef MORE
36: # error we mumbled more
37: #endif
_EOF_
# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
echo creating ${testname}.base
# this is the output we should expect to see
cat > ${testname}.base <<_EOF_
Irrelevant bar.
_EOF_
agopts="-DMUMBLE -DFOO=1"
MORE=DOITWRONG
run_ag x1 ${agopts} ${testname}.def
test $? -eq 0 || failure ${agopts}-1 failed
cmp -s ${testname}.base ${testname}.test || \
failure "`diff ${testname}.base ${testname}.test`"
echo '#assert `echo true`' >> ${testname}.inc
run_ag x2 ${agopts} ${testname}.def
test $? -eq 0 || failure ${agopts}-2 failed
echo '#assert `echo false`' >> ${testname}.inc
run_ag x3 ${agopts} ${testname}.def
test $? -ne 0 || failure ${agopts}-3 failed
${FGREP} -v '#assert' ${testname}.inc > ${testname}2.inc
mv -f ${testname}2.inc ${testname}.inc
echo '#assert (version-compare > autogen-version "5.8.4")' >> ${testname}.inc
run_ag x4 ${agopts} ${testname}.def
test $? -eq 0 || failure ${agopts}-4 failed
echo '#assert (version-compare < autogen-version "5.8.4.63")' >> ${testname}.inc
run_ag x5 ${agopts} ${testname}.def
test $? -ne 0 || failure ${agopts}-5 failed
cleanup
## Local Variables:
## mode: shell-script
## indent-tabs-mode: nil
## sh-indentation: 2
## sh-basic-offset: 2
## End:
# end of directives.test
|