]>
Commit | Line | Data |
---|---|---|
342b8b6e | 1 | # Checking the output filenames. -*- Autotest -*- |
279cabb6 JD |
2 | # Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007 Free Software Foundation, |
3 | # Inc. | |
342b8b6e AD |
4 | |
5 | # This program is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation; either version 2, or (at your option) | |
8 | # any later version. | |
9 | ||
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | ||
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software | |
0fb669f9 PE |
17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | # 02110-1301, USA. | |
342b8b6e AD |
19 | |
20 | AT_BANNER([[Output file names.]]) | |
21 | ||
22 | ||
7625ec2c AD |
23 | # AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [SHELLIO], |
24 | # [ADDITIONAL-TESTS]) | |
f1bbfcce | 25 | # ----------------------------------------------------------------------------- |
342b8b6e | 26 | m4_define([AT_CHECK_OUTPUT], |
bd9d212b | 27 | [AT_SETUP([[Output files: $2 $3 $5]]) |
7625ec2c AD |
28 | case "$1" in |
29 | */*) mkdir `echo "$1" | sed 's,/.*,,'`;; | |
30 | esac | |
342b8b6e AD |
31 | AT_DATA([$1], |
32 | [[$2 | |
33 | %% | |
bfcf1f3a | 34 | foo: {}; |
342b8b6e AD |
35 | ]]) |
36 | ||
f1bbfcce | 37 | AT_CHECK([bison $3 $1 $5], 0) |
342b8b6e | 38 | AT_CHECK([ls $4], [], [ignore]) |
7625ec2c | 39 | $6 |
d803322e | 40 | AT_CLEANUP |
342b8b6e AD |
41 | ]) |
42 | ||
43 | AT_CHECK_OUTPUT([foo.y], [], [-dv], | |
02650b7f | 44 | [foo.output foo.tab.c foo.tab.h]) |
f1bbfcce | 45 | AT_CHECK_OUTPUT([foo.y], [], [-dv], |
02650b7f PE |
46 | [foo.output foo.tab.c foo.tab.h], |
47 | [>&-]) | |
342b8b6e | 48 | AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c], |
02650b7f | 49 | [foo.c foo.h foo.output]) |
342b8b6e | 50 | AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.tab.c], |
02650b7f | 51 | [foo.output foo.tab.c foo.tab.h]) |
342b8b6e | 52 | AT_CHECK_OUTPUT([foo.y], [], [-dv -y], |
02650b7f | 53 | [y.output y.tab.c y.tab.h]) |
342b8b6e | 54 | AT_CHECK_OUTPUT([foo.y], [], [-dv -b bar], |
02650b7f | 55 | [bar.output bar.tab.c bar.tab.h]) |
342b8b6e | 56 | AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c], |
35fe0834 | 57 | [foo.c foo.dot foo.h foo.output]) |
342b8b6e AD |
58 | |
59 | ||
60 | AT_CHECK_OUTPUT([foo.y], [%defines %verbose], [], | |
02650b7f | 61 | [foo.output foo.tab.c foo.tab.h]) |
342b8b6e | 62 | AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[], |
02650b7f | 63 | [y.output y.tab.c y.tab.h]) |
342b8b6e | 64 | |
5e5d5415 | 65 | AT_CHECK_OUTPUT([foo.yy], [%defines %verbose %yacc],[], |
02650b7f | 66 | [y.output y.tab.c y.tab.h]) |
5e5d5415 | 67 | |
02975b9a JD |
68 | # Exercise %output and %file-prefix including deprecated `=' |
69 | AT_CHECK_OUTPUT([foo.y], [%file-prefix "bar" %defines %verbose], [], | |
02650b7f | 70 | [bar.output bar.tab.c bar.tab.h]) |
951366c1 | 71 | AT_CHECK_OUTPUT([foo.y], [%output="bar.c" %defines %verbose %yacc],[], |
02650b7f | 72 | [bar.output bar.c bar.h]) |
951366c1 | 73 | AT_CHECK_OUTPUT([foo.y], |
02975b9a | 74 | [%file-prefix="baz" %output "bar.c" %defines %verbose %yacc], |
02650b7f PE |
75 | [], |
76 | [bar.output bar.c bar.h]) | |
951366c1 | 77 | |
342b8b6e AD |
78 | |
79 | # Check priorities of extension control. | |
80 | AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [], | |
02650b7f | 81 | [foo.output foo.tab.cc foo.tab.hh]) |
342b8b6e AD |
82 | |
83 | AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c], | |
02650b7f | 84 | [foo.c foo.h foo.output]) |
342b8b6e AD |
85 | |
86 | AT_CHECK_OUTPUT([foo.yy], [], | |
02650b7f PE |
87 | [--defines=foo.hpp -o foo.c++], |
88 | [foo.c++ foo.hpp]) | |
342b8b6e | 89 | |
02975b9a JD |
90 | AT_CHECK_OUTPUT([foo.yy], [%defines "foo.hpp"], |
91 | [-o foo.c++], | |
92 | [foo.c++ foo.hpp]) | |
93 | ||
342b8b6e | 94 | AT_CHECK_OUTPUT([foo.yy], [], |
02650b7f PE |
95 | [-o foo.c++ --graph=foo.gph], |
96 | [foo.c++ foo.gph]) | |
7625ec2c AD |
97 | |
98 | ||
99 | ## ------------ ## | |
100 | ## C++ output. ## | |
101 | ## ------------ ## | |
102 | ||
103 | m4_define([AT_CHECK_NO_SUBDIR_PART], | |
104 | [# Also make sure that the includes do not refer to the subdirectory. | |
105 | AT_CHECK([grep 'include .subdir/' $1.cc], 1, []) | |
106 | AT_CHECK([grep 'include .subdir/' $1.hh], 1, []) | |
107 | ]) | |
108 | ||
109 | AT_CHECK_OUTPUT([foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [], | |
02650b7f | 110 | [foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh]) |
7625ec2c AD |
111 | |
112 | AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], [], | |
02650b7f PE |
113 | [foo.tab.cc foo.tab.hh foo.output location.hh stack.hh position.hh], |
114 | [], [AT_CHECK_NO_SUBDIR_PART([foo.tab])]) | |
7625ec2c AD |
115 | |
116 | AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose], | |
117 | [-o subdir/foo.cc], | |
02650b7f | 118 | [subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh], |
7625ec2c | 119 | [], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])]) |
3f7ca628 JD |
120 | |
121 | ||
122 | # AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR) | |
123 | # ----------------------------------------------------------------------------- | |
124 | m4_define([AT_CHECK_CONFLICTING_OUTPUT], | |
125 | [AT_SETUP([Conflicting output files: $2 $3]) | |
126 | case "$1" in | |
127 | */*) mkdir `echo "$1" | sed 's,/.*,,'`;; | |
128 | esac | |
129 | AT_DATA([$1], | |
130 | [[$2 | |
131 | %% | |
132 | foo: {}; | |
133 | ]]) | |
134 | ||
135 | AT_CHECK([bison $3 $1], 0, [], [$4]) | |
136 | AT_CLEANUP | |
137 | ]) | |
138 | ||
139 | AT_CHECK_CONFLICTING_OUTPUT([foo.y], | |
140 | [], [--graph="foo.tab.c"], | |
141 | [foo.y: warning: conflicting outputs to file `foo.tab.c' | |
142 | ]) | |
143 | ||
144 | AT_CHECK_CONFLICTING_OUTPUT([foo.y], | |
145 | [%defines "foo.output"], [-v], | |
146 | [foo.y: warning: conflicting outputs to file `foo.output' | |
147 | ]) | |
148 | ||
149 | AT_CHECK_CONFLICTING_OUTPUT([foo.y], | |
150 | [%skeleton "lalr1.cc" %defines], [--graph="location.hh"], | |
151 | [foo.y: warning: conflicting outputs to file `location.hh' | |
152 | ]) | |
bd9d212b JD |
153 | |
154 | ||
155 | # AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS]) | |
156 | # ----------------------------------------------------------------------------- | |
157 | m4_define([AT_CHECK_OUTPUT_FILE_NAME], | |
158 | [AT_SETUP([Output file name: $1]) | |
159 | ||
ce3448d5 | 160 | AT_DATA_GRAMMAR([glr.y], |
bd9d212b JD |
161 | [[%glr-parser |
162 | %code { | |
163 | int yylex (void); | |
164 | void yyerror (const char *); | |
165 | } | |
166 | %% | |
167 | start: {}; | |
168 | ]]) | |
169 | AT_CHECK([bison -o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y]) | |
170 | AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore]) | |
171 | AT_COMPILE([glr.o], [-c "AS_ESCAPE([$1.c])"]) | |
172 | $2 | |
173 | ||
ce3448d5 | 174 | AT_DATA_GRAMMAR([cxx.y], |
bd9d212b JD |
175 | [[%skeleton "lalr1.cc" |
176 | %code { int yylex (yy::parser::semantic_type*); } | |
177 | %% | |
178 | start: {}; | |
179 | ]]) | |
180 | AT_CHECK([bison -o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" cxx.y]) | |
181 | AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore]) | |
182 | AT_COMPILE_CXX([cxx.o], [-c "AS_ESCAPE([$1.c])"]) | |
183 | $2 | |
184 | ||
185 | AT_CLEANUP | |
186 | ]) | |
187 | ||
188 | # Notice that the header file name here cannot contain | |
189 | # `"' since FILENAME in `#include "FILENAME"' cannot. | |
190 | AT_CHECK_OUTPUT_FILE_NAME([[`~!@#$%^&*()-=_+{}[]|\:;<>, .']]) | |
191 | AT_CHECK_OUTPUT_FILE_NAME([[(]]) | |
192 | AT_CHECK_OUTPUT_FILE_NAME([[)]]) | |
193 | AT_CHECK_OUTPUT_FILE_NAME([[#]]) | |
194 | AT_CHECK_OUTPUT_FILE_NAME([[@@]]) | |
195 | AT_CHECK_OUTPUT_FILE_NAME([[@{]]) | |
196 | AT_CHECK_OUTPUT_FILE_NAME([[@}]]) | |
bd9d212b JD |
197 | AT_CHECK_OUTPUT_FILE_NAME([[@<:@]]) |
198 | AT_CHECK_OUTPUT_FILE_NAME([[@:>@]]) |