~ubuntu-branches/ubuntu/saucy/autoconf/saucy

« back to all changes in this revision

Viewing changes to tests/autotest.at

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2009-02-10 11:19:19 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090210111919-em4fvdv91rsn40sb
Tags: 2.63-2ubuntu1
* Merge from Debian experimental, remaining changes:
  * bin/autoreconf.in: Check whether libtoolize supports --install, if it
    does, libtoolize is safe to run at all times since it will not install
    new files unless --install is passed to it as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
AT_BANNER([Autotest.])
4
4
 
5
 
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 
5
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
 
6
# Inc.
6
7
#
7
 
# This program is free software; you can redistribute it and/or modify
 
8
# This program is free software: you can redistribute it and/or modify
8
9
# it under the terms of the GNU General Public License as published by
9
10
# the Free Software Foundation; either version 2, or (at your option)
10
11
# any later version.
19
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
21
# 02110-1301, USA.
21
22
 
 
23
# AT_CHECK_AT_PREP(NAME, SUITE-CODE, [STATUS = 0], [STDOUT], [STDERR],
 
24
#                  [DIR = .])
 
25
# --------------------------------------------------------------------
 
26
# Create a new testsuite named NAME that runs a minimal Autotest test suite,
 
27
# SUITE-CODE.  Do not use `testsuite' for NAME, or the log file it generates
 
28
# will overwrite the log that the Autoconf test produces when managing
 
29
# this test case.  STATUS, STDOUT, and STDERR pass directly to the AT_CHECK
 
30
# that compiles the testsuite.  DIR can specify a particular subdirectory
 
31
# where the testsuite should live.
 
32
m4_define([AT_CHECK_AT_PREP],
 
33
[AT_KEYWORDS([autotest])dnl
 
34
dnl overquote AT_dir, to make it easier to use
 
35
m4_pushdef([AT_dir], m4_ifval([$6], [[[$6]]], [.]))dnl
 
36
dnl
 
37
AT_CAPTURE_FILE([$1.log])dnl
 
38
dnl
 
39
AT_DATA(AT_dir[/package.m4],
 
40
[[m4_define([AT@&t@_PACKAGE_NAME],      [GNU Nonsense])
 
41
m4_define([AT@&t@_PACKAGE_TARNAME],   [nonsense])
 
42
m4_define([AT@&t@_PACKAGE_VERSION],   [1.0])
 
43
m4_define([AT@&t@_PACKAGE_STRING],    [GNU Nonsense 1.0])
 
44
m4_define([AT@&t@_PACKAGE_BUGREPORT], [bug-autoconf@gnu.org])
 
45
]])
 
46
dnl
 
47
AT_DATA(AT_dir[/$1.at], m4_bpatsubst([[$2]], [AT_], [AT@&t@_]))
 
48
m4_ifval([$6], [(cd AT_dir])
 
49
AT_CHECK_AUTOM4TE([--language=autotest -o $1 $1.at], [$3], [$4], [$5])
 
50
m4_ifval([$6], [)])
 
51
m4_popdef([AT_dir])dnl
 
52
]) # AT_CHECK_AT_PREP
 
53
 
22
54
# AT_CHECK_AT(TITLE, SUITE-CODE, [XFAIL-CONDITION], [STATUS = 0],
23
 
#             [STDOUT := ignore], STDERR, [POST-TEST-CODE])
24
 
# ---------------------------------------------------------------
 
55
#             [STDOUT = ignore], STDERR, [POST-TEST-CODE], [SUITE-ARGS])
 
56
# ----------------------------------------------------------------------
25
57
# Create a new test named TITLE that runs a minimal Autotest test suite,
26
 
# SUITE-CODE.  Call AT_XFAIL_IF with XFAIL-CONDITION.  STATUS and STDERR pass
27
 
# directly to the AT_CHECK that call the minimal test suite.  STDOUT is not
28
 
# used, but it is reserved for future use.  Run POST-TEST-CODE
29
 
# at the top level after the micro-suite has been run.
 
58
# SUITE-CODE with additional SUITE-ARGS, once without and once with
 
59
# '-v -x' added.  Call AT_XFAIL_IF with XFAIL-CONDITION.  Pass STDERR
 
60
# directly to the AT_CHECK that calls the minimal test suite, STDOUT to
 
61
# the AT_CHECK without '-v -x'; ignore stdout for the latter.
 
62
# Run POST-TEST-CODE at the top level after the micro-suite has been run.
30
63
m4_define([AT_CHECK_AT],
31
 
[
32
 
AT_SETUP([$1])
33
 
AT_KEYWORDS([autotest])
34
 
AT_CAPTURE_FILE([micro-suite.log])
 
64
[AT_SETUP([$1])
35
65
AT_XFAIL_IF([$3])
36
 
 
37
 
AT_DATA([package.m4],[[
38
 
m4_define([AT_PACKAGE_NAME],      [GNU Nonsense])
39
 
m4_define([AT_PACKAGE_TARNAME],   [nonsense])
40
 
m4_define([AT_PACKAGE_VERSION],   [1.0])
41
 
m4_define([AT_PACKAGE_STRING],    [GNU Nonsense 1.0])
42
 
m4_define([AT_PACKAGE_BUGREPORT], [bug-autoconf@gnu.org])
43
 
]])
44
 
 
45
 
AT_DATA([mysuite.at], [$2])
46
 
 
47
 
# Do not use `testsuite' as the name of the small test suite, or the
48
 
# log file it generates will overwrite the log that the Autoconf test
49
 
# suite produces for this test case.
50
 
AT_CHECK_AUTOM4TE([--language=autotest -o micro-suite mysuite.at])
51
 
AT_CHECK([$CONFIG_SHELL ./micro-suite],       m4_default([$4], 0), [ignore], [$6])
52
 
AT_CHECK([$CONFIG_SHELL ./micro-suite -v -x], m4_default([$4], 0), [ignore], [$6])
 
66
AT_CHECK_AT_PREP([micro-suite], [$2])
 
67
 
 
68
AT_CHECK([$CONFIG_SHELL ./micro-suite $8],       m4_default([$4], 0),
 
69
         m4_default([$5], [ignore]), [$6])
 
70
AT_CHECK([$CONFIG_SHELL ./micro-suite -v -x $8], m4_default([$4], 0),
 
71
         [ignore], [$6])
53
72
$7
54
73
AT_CLEANUP
55
74
])# AT_CHECK_AT
65
84
AT_SETUP([my only test])
66
85
$2
67
86
AT_CLEANUP
68
 
]], m4_shiftn(2, $@))])
69
 
 
70
 
# Here documents for these tests contain forbidden macros.
71
 
m4_pattern_allow([^AT_])
 
87
]], m4_shift2($@))]) # AT_CHECK_AT_TEST
 
88
 
 
89
# AT_CHECK_AT_SYNTAX(TITLE, SUITE, MESSAGE)
 
90
# -----------------------------------------
 
91
# Create a test named TITLE that tries compiling SUITE with syntax
 
92
# errors with autotest.  Expect a failed compilation, and grep for
 
93
# MESSAGE occuring within the error output.
 
94
m4_define([AT_CHECK_AT_SYNTAX],
 
95
[AT_SETUP([$1])
 
96
AT_CHECK_AT_PREP([micro-suite], [$2], [1], [], [stderr])
 
97
AT_CHECK([grep '$3' stderr], [0], [ignore])
 
98
AT_CLEANUP
 
99
])# AT_CHECK_AT_SYNTAX
 
100
 
72
101
 
73
102
# AT_NO_CMDSUBST
74
103
# --------------
75
104
m4_define([AT_NO_CMDSUBST],
76
 
[if (eval 'foo=$(echo bar) && test "$foo" = bar') >/dev/null 2>&1; then false; else :; fi])
 
105
[if (eval 'foo=$(echo bar) && test "$foo" = bar') >/dev/null 2>&1; then ]dnl
 
106
[false; else :; fi])
 
107
 
 
108
# AT_CHECK_EGREP(PATTERN, STATUS, COUNT)
 
109
# --------------------------------------
 
110
# Run grep -E, counting how many times PATTERN occurs in the file 'stdout',
 
111
# and expecting exit STATUS and output COUNT.
 
112
m4_define([AT_CHECK_EGREP],
 
113
[AT_CHECK([$EGREP -c '$1' stdout], [$2], [$3
 
114
], [ignore])
 
115
])
77
116
 
78
117
 
79
118
## ------------------ ##
86
125
[[AT_INIT([empty test suite])
87
126
]])
88
127
 
 
128
AT_CHECK_AT([Banner-only test suite],
 
129
[[AT_INIT([empty test suite])
 
130
AT_BANNER([banner])
 
131
]])
 
132
 
89
133
# Next level of emptiness.
90
134
AT_CHECK_AT_TEST([Empty test], [])
91
135
 
92
136
# And finally, an empty check should not cause a syntax error.
93
137
AT_CHECK_AT_TEST([Empty check], [AT_CHECK])
94
138
 
 
139
# Check for sensible error messages for common bugs.
 
140
AT_CHECK_AT_SYNTAX([AT@&t@_SETUP without AT@&t@_INIT],
 
141
[[AT_SETUP([only test])
 
142
AT_CHECK([:])
 
143
AT_CLEANUP
 
144
]], [AT@&t@_SETUP: missing AT@&t@_INIT detected])
 
145
 
 
146
AT_CHECK_AT_SYNTAX([AT@&t@_BANNER without AT@&t@_INIT],
 
147
[[AT_BANNER([just a banner])
 
148
]], [AT@&t@_BANNER: missing AT@&t@_INIT detected])
 
149
 
 
150
AT_CHECK_AT_SYNTAX([AT@&t@_CLEANUP without AT@&t@_INIT],
 
151
[[AT_CLEANUP
 
152
]], [AT@&t@_CLEANUP: missing AT@&t@_INIT detected])
 
153
 
 
154
AT_CHECK_AT_SYNTAX([Missing AT@&t@_CLEANUP],
 
155
[[AT_INIT([incomplete test suite])
 
156
AT_SETUP([only test])
 
157
AT_CHECK([:])
 
158
]], [missing AT@&t@_CLEANUP detected])
 
159
 
 
160
AT_CHECK_AT_SYNTAX([AT@&t@_CHECK without AT@&t@_SETUP],
 
161
[[AT_INIT([incomplete test suite])
 
162
AT_CHECK([:])
 
163
]], [AT@&t@_CHECK: missing AT@&t@_SETUP detected])
 
164
 
 
165
AT_CHECK_AT_SYNTAX([AT@&t@_DATA without AT@&t@_SETUP],
 
166
[[AT_INIT([incomplete test suite])
 
167
AT_DATA([file])
 
168
]], [AT@&t@_DATA: missing AT@&t@_SETUP detected])
 
169
 
 
170
AT_CHECK_AT_SYNTAX([AT@&t@_XFAIL_IF without AT@&t@_SETUP],
 
171
[[AT_INIT([incomplete test suite])
 
172
AT_XFAIL_IF([:])
 
173
]], [AT@&t@_XFAIL_IF: missing AT@&t@_SETUP detected])
 
174
 
 
175
AT_CHECK_AT_SYNTAX([AT@&t@_KEYWORDS without AT@&t@_SETUP],
 
176
[[AT_INIT([incomplete test suite])
 
177
AT_KEYWORDS([keyword])
 
178
]], [AT@&t@_KEYWORDS: missing AT@&t@_SETUP detected])
 
179
 
 
180
AT_CHECK_AT_SYNTAX([AT@&t@_CLEANUP without AT@&t@_SETUP],
 
181
[[AT_INIT([incomplete test suite])
 
182
AT_CLEANUP
 
183
]], [AT@&t@_CLEANUP: missing AT@&t@_SETUP detected])
 
184
 
 
185
AT_CHECK_AT_SYNTAX([AT@&t@_BANNER inside AT@&t@_SETUP],
 
186
[[AT_INIT([incomplete test suite])
 
187
AT_SETUP([only test])
 
188
AT_BANNER([banner])
 
189
AT_CHECK([:])
 
190
AT_CLEANUP
 
191
]], [AT@&t@_BANNER: nested AT@&t@_SETUP detected])
 
192
 
 
193
AT_CHECK_AT_SYNTAX([AT@&t@_SETUP inside AT@&t@_SETUP],
 
194
[[AT_INIT([incomplete test suite])
 
195
AT_SETUP([only test])
 
196
 AT_SETUP([nested test])
 
197
 AT_CHECK([:])
 
198
 AT_CLEANUP
 
199
AT_CHECK([:])
 
200
AT_CLEANUP
 
201
]], [AT@&t@_SETUP: nested AT@&t@_SETUP detected])
 
202
 
 
203
AT_CHECK_AT_SYNTAX([Multiple AT@&t@_INIT],
 
204
[[AT_INIT([[suite, take one]])
 
205
AT_INIT([repeat])
 
206
]], [AT@&t@_INIT: invoked multiple times])
 
207
 
 
208
# Check for tested programs.  autoconf should only appear once.
 
209
AT_CHECK_AT([Tested programs],
 
210
[[AT_INIT([programs test suite])
 
211
AT_TESTED([autoconf autom4te])
 
212
AT_TESTED([autoconf])
 
213
]], [], [], [], [],
 
214
[AT_CHECK([[sed -n 's|.*/\([^ /]* --version\)|\1|p' micro-suite.log]], [],
 
215
[[autoconf --version
 
216
autom4te --version
 
217
]])])
 
218
 
95
219
## ----------------------------------------------------- ##
96
220
## Newlines and command substitutions in test commands.  ##
97
221
## ----------------------------------------------------- ##
100
224
  [AT_CHECK([:], 0, [], [])])
101
225
 
102
226
AT_CHECK_AT_TEST([Fallacy],
103
 
  [AT_CHECK([false], ignore, [], [])])
 
227
  [AT_CHECK([false], [], [], [])],
 
228
  [], [1], [], [ignore],
 
229
  [AT_CHECK([grep failed micro-suite.log], [], [ignore])])
 
230
 
 
231
AT_CHECK_AT_TEST([Skip],
 
232
  [AT_CHECK([exit 77], 0, [], [])],
 
233
  [], [], [], [],
 
234
  [AT_CHECK([grep skipped micro-suite.log], [], [ignore])])
 
235
 
 
236
AT_CHECK_AT_TEST([errexit],
 
237
  [AT_CHECK([false])
 
238
   AT_CLEANUP
 
239
   AT_SETUP([test that should not be run])
 
240
   AT_CHECK([:])],
 
241
  [], [1], [stdout], [stderr],
 
242
  [AT_CHECK([test -f micro-suite.log], [1])
 
243
   touch micro-suite.log # shut up AT_CAPTURE_FILE.
 
244
   AT_CHECK([grep "should not be run" stdout], [1])
 
245
   AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore])],
 
246
  [--errexit])
104
247
 
105
248
AT_CHECK_AT_TEST([Literal multiline command],
106
249
  [AT_CHECK([echo Auto'
115
258
two
116
259
], [])])
117
260
 
118
 
AT_CHECK_AT_TEST([Backquote command substition],
 
261
AT_CHECK_AT_TEST([Backquote command substitution],
119
262
  [AT_CHECK([echo `echo hi`], 0, [hi
120
263
], [])])
121
264
 
122
265
 
123
 
AT_CHECK_AT_TEST([Multiline backquote command substition],
 
266
AT_CHECK_AT_TEST([Multiline backquote command substitution],
124
267
  [AT_DATA([myfile],[foo
125
268
bar
126
269
])
128
271
bar
129
272
], [])])
130
273
 
131
 
AT_CHECK_AT_TEST([Parenthetical command substition],
 
274
AT_CHECK_AT_TEST([Parenthetical command substitution],
132
275
  [AT_CHECK([echo $(echo hi)], 0, [hi
133
276
], [])],
134
277
  [AT_NO_CMDSUBST])
135
278
 
136
 
AT_CHECK_AT_TEST([Multiline parenthetical command substition],
 
279
AT_CHECK_AT_TEST([Multiline parenthetical command substitution],
137
280
  [AT_DATA([myfile],[foo
138
281
bar
139
282
])
191
334
], [])])
192
335
 
193
336
AT_CHECK_AT_TEST([BSx641-newline in command],
194
 
  [AT_CHECK([echo Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 
337
  [AT_CHECK([printf '%s\n' Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
195
338
"conf], 0, [Auto\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\conf
196
339
], [])])
197
340
 
198
341
AT_CHECK_AT_TEST([BS-BS-newline in command],
199
 
  [AT_CHECK([echo Auto"\\
 
342
  [AT_CHECK([printf '%s\n' Auto"\\
200
343
"conf], 0, [Auto\
201
344
conf
202
345
], [])])
204
347
# A `^BS-BS-newline in command' test will run a command named `\'.  No, thanks.
205
348
 
206
349
AT_CHECK_AT_TEST([BSx640-newline in command],
207
 
  [AT_CHECK([echo Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 
350
  [AT_CHECK([printf '%s\n' Auto"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
208
351
"conf], 0, [Auto\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
209
352
conf
210
353
], [])])
211
354
 
212
355
# This command has both escaped and unescaped newlines.
213
356
AT_CHECK_AT_TEST([Newline-CODE-BS-newline in command],
214
 
  [AT_CHECK([echo Auto'
 
357
  [AT_CHECK([printf '%s\n' Auto'
215
358
'co\
216
359
nf], 0, [Auto
217
360
conf
218
361
], [])])
219
362
 
220
363
AT_CHECK_AT_TEST([Single-quote-BS-newline in command],
221
 
  [AT_CHECK([echo Auto'\
 
364
  [AT_CHECK([printf '%s\n' Auto'\
222
365
'conf], 0, [Auto\
223
366
conf
224
367
], [])])
225
368
 
226
369
AT_CHECK_AT_TEST([Single-quote-newline-BS-newline in command],
227
 
  [AT_CHECK([echo Auto'
 
370
  [AT_CHECK([printf '%s\n' Auto'
228
371
\
229
372
'conf], 0, [Auto
230
373
\
232
375
], [])])
233
376
 
234
377
 
 
378
## ----------------- ##
 
379
## Input from stdin. ##
 
380
## ----------------- ##
 
381
 
 
382
AT_SETUP([Input from stdin])
 
383
 
 
384
AT_CHECK_AT_PREP([micro-suite],
 
385
[[AT_INIT
 
386
AT_SETUP([please enter hello<RETURN><EOF>])
 
387
AT_CHECK([cat], [], [hello
 
388
])
 
389
AT_CLEANUP
 
390
]])
 
391
 
 
392
AT_CHECK([echo hello | $CONFIG_SHELL ./micro-suite], [], [ignore])
 
393
AT_CHECK([$CONFIG_SHELL ./micro-suite </dev/null], [1], [ignore], [ignore])
 
394
 
 
395
AT_CLEANUP
 
396
 
 
397
 
235
398
## ------------------------------- ##
236
399
## Funny characters in test names. ##
237
400
## ------------------------------- ##
238
401
 
239
402
# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, EXPANDED-TITLE-TO-TEST
240
 
#                   [XFAIL-CONDITION])
 
403
#                   [XFAIL-CONDITION], [COLUMN = 53])
241
404
# ---------------------------------------------------------------
242
405
# Create a new test named TITLE that runs an Autotest test suite
243
406
# comprised of a trivial test named TITLE-TO-TEST, which expands
244
407
# to EXPANDED-TITLE-TO-TEST.  XFAIL-CONDITION passes verbatim to
245
 
# AT_CHECK_AT.
 
408
# AT_CHECK_AT.  Verify that `ok' prints at COLUMN.
246
409
m4_define([AT_CHECK_AT_TITLE],
247
410
[AT_CHECK_AT([$1],
248
411
[[
249
412
m4@&t@_define([macro_name],         [[macro_expanded]])
250
 
m4@&t@_define([macro_expanded], [[macro_overexpanded]])
 
413
m4@&t@_define([macro_expanded],     [[macro_overexpanded]])
251
414
m4@&t@_define([macro_backquote],    [`])
252
415
m4@&t@_define([macro_single_quote], ['])
253
416
m4@&t@_define([macro_double_quote], ["])
254
 
m4@&t@_define([macro_backslash],   [\\])
 
417
]]dnl restore font-lock: "
 
418
[[m4@&t@_define([macro_backslash],  [\])
 
419
m4@&t@_define([macro_echo],         [$][1])
255
420
AT_INIT([artificial test suite])
256
421
AT_SETUP([$2])
257
422
AT_CHECK([:])
258
423
AT_CLEANUP
259
424
]], [$4], [], [], [],
260
 
[AT_CHECK([[$CONFIG_SHELL ./micro-suite |
261
 
            sed -n 's/[^:]*: \(.*[^      ]\)[    ]*ok.*/\1/p']],,
 
425
dnl This sed script checks for two things - that the output is properly
 
426
dnl expanded, and that the 'ok' starts on the right column.
 
427
[AT_KEYWORDS([m4@&t@_expand])
 
428
AT_CHECK([[$CONFIG_SHELL ./micro-suite |
 
429
            sed -n '/^  1:/{
 
430
h
 
431
s/[^:]*: \(.*[^  ]\)[    ]*ok.*/\1/p
 
432
x
 
433
s/^.\{]]]m4_default($5, 53)[[[\}ok.*/ok/p
 
434
}']],,
262
435
[[$3
 
436
ok
263
437
]])
264
438
AT_CHECK([[$CONFIG_SHELL ./micro-suite -l |
265
439
           sed -n 's/.*[0-9]: [^         ][^     ]*[     ][      ]*\(.*[^        ]\)[    ]*/\1/p']],,
272
446
 
273
447
m4_define([AT_CHECK_AT_TITLE_CHAR],
274
448
[AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name],
275
 
                   [A ]m4_ifval([$3], [[$3]], [[$2]])[ in my name], $4)])
276
 
 
277
 
AT_CHECK_AT_TITLE_CHAR([Backquote],    [`])
278
 
AT_CHECK_AT_TITLE_CHAR([Single-quote], ['])
279
 
AT_CHECK_AT_TITLE_CHAR([Double-quote], ["])
280
 
AT_CHECK_AT_TITLE_CHAR([Backslash],   [\\])
281
 
AT_CHECK_AT_TITLE_CHAR([Brackets],  [[[]]], [[]])
282
 
AT_CHECK_AT_TITLE_CHAR([Pound],      [[#]], [#])
283
 
AT_CHECK_AT_TITLE_CHAR([Comma],        [,])
284
 
 
285
 
AT_CHECK_AT_TITLE_CHAR([Quoted Macro],                  [[macro_name]],
286
 
                                                          [macro_name])
287
 
AT_CHECK_AT_TITLE_CHAR([Macro],                           [macro_name],
288
 
                                                      [macro_expanded])
289
 
AT_CHECK_AT_TITLE_CHAR([Macro with backquote],       [macro_backquote],
290
 
                                                                   [`], [:])
 
449
                   [A ]m4_ifval([$3], [[$3]], [[$2]])[ in my name], $4, $5)])
 
450
 
 
451
AT_CHECK_AT_TITLE_CHAR([Backquote],     [`])
 
452
AT_CHECK_AT_TITLE_CHAR([Single-quote],  ['])
 
453
AT_CHECK_AT_TITLE_CHAR([Double-quote],  ["])
 
454
dnl restore font-lock: "
 
455
AT_CHECK_AT_TITLE_CHAR([Backslash],     [\])
 
456
AT_CHECK_AT_TITLE_CHAR([Brackets],   [[[]]], [[]])
 
457
AT_CHECK_AT_TITLE_CHAR([Left bracket],  [@<@&t@:@], [@<:@])
 
458
AT_CHECK_AT_TITLE_CHAR([Right bracket], [@:@&t@>@], [@:>@])
 
459
AT_CHECK_AT_TITLE_CHAR([Pound],       [[#]], [#])
 
460
AT_CHECK_AT_TITLE_CHAR([Quoted comma],[[,]], [,])
 
461
AT_CHECK_AT_TITLE_CHAR([Comma],         [,], [,])
 
462
dnl this test also hits quadrigraphs for ()
 
463
AT_CHECK_AT_TITLE_CHAR([Parentheses],   [(@{:@)@:}@], [(())])
 
464
AT_CHECK_AT_TITLE_CHAR([Left paren],    [[(]], [(])
 
465
AT_CHECK_AT_TITLE_CHAR([Right paren],   [[)]], [)])
 
466
 
 
467
AT_CHECK_AT_TITLE_CHAR([Quoted Macro], [[macro_name]], [macro_name])
 
468
AT_CHECK_AT_TITLE_CHAR([Macro],        [macro_name],   [macro_expanded])
 
469
AT_CHECK_AT_TITLE_CHAR([Macro with backquote],       [macro_backquote], [`])
291
470
AT_CHECK_AT_TITLE_CHAR([Macro with single-quote], [macro_single_quote], ['])
292
 
AT_CHECK_AT_TITLE_CHAR([Macro with double-quote], [macro_double_quote],
293
 
                                                                   ["], [:])
294
 
# This test neither fails nor passes reliably.
295
 
# AT_CHECK_AT_TITLE_CHAR([Macro with backslash],       [macro_backslash],
296
 
#                                                                  [\\], [:])
 
471
AT_CHECK_AT_TITLE_CHAR([Macro with double-quote], [macro_double_quote], ["])
 
472
dnl restore font-lock: "
 
473
AT_CHECK_AT_TITLE_CHAR([Macro with backslash],       [macro_backslash], [\])
 
474
AT_CHECK_AT_TITLE_CHAR([Macro echoing macro], [macro_echo([macro_name])],
 
475
                       [macro_expanded])
 
476
AT_CHECK_AT_TITLE_CHAR([Macro echoing single-quote], [macro_echo(['])], ['])
 
477
AT_CHECK_AT_TITLE_CHAR([Long test title], [0123456789012345678901234567890123])
 
478
AT_CHECK_AT_TITLE_CHAR([Longer test title],
 
479
                       [01234567890123456789012345678901234], [], [], [54])
 
480
 
 
481
 
 
482
## ----------------------- ##
 
483
## Long test source lines. ##
 
484
## ----------------------- ##
 
485
 
 
486
# Create a test file that has more than 99 words in a line, for Solaris awk.
 
487
# While at that, try out the limit of 2000 bytes in a text file line.
 
488
 
 
489
AT_CHECK_AT_TEST([Long test source lines],
 
490
[m4_for([nnn], [1], [999], [], [: ])
 
491
AT_CHECK([:])
 
492
], [], [], [], [ignore],
 
493
[AT_CHECK([$CONFIG_SHELL ./micro-suite -k skipalltests], [], [ignore], [ignore])
 
494
])
297
495
 
298
496
 
299
497
## ----------------- ##
304
502
  [AT_CHECK([:])], [], [], [], [ignore],
305
503
[# Without options, when all tests pass, no test directory should exist.
306
504
AT_CHECK([test -d micro-suite.dir/1 && exit 42
307
 
          ./micro-suite -d 1], [], [ignore], [ignore])
 
505
          $CONFIG_SHELL ./micro-suite -d 1], [], [ignore], [ignore])
308
506
# Running with -d should leave a reproducible test group.
309
507
# Also, running the test script from the test group locks the
310
508
# directory from removal on some platforms; the script should still be
341
539
])
342
540
 
343
541
 
 
542
# Setting default variable values via atlocal.
 
543
AT_CHECK_AT_TEST([Using atlocal],
 
544
  [AT_CHECK([test "x$MY_VAR" = "xodd;  'string" || exit 42])],
 
545
  [], [1], [ignore], [ignore], [
 
546
dnl check that command line can set variable
 
547
AT_CHECK([$CONFIG_SHELL ./micro-suite MY_VAR="odd;  'string"], [0], [ignore])
 
548
dnl check that command line overrides environment
 
549
AT_CHECK([MY_VAR="odd;  'string" $CONFIG_SHELL ./micro-suite MY_VAR=unset],
 
550
         [1], [ignore], [ignore])
 
551
dnl check that atlocal can give it a default
 
552
AT_CHECK([cat <<EOF >atlocal
 
553
MY_VAR="odd;  'string"
 
554
export MY_VAR
 
555
dnl Also populate enough of atlocal to do what atconfig normally does.
 
556
at_testdir=.
 
557
abs_builddir='`pwd`'
 
558
at_srcdir=.
 
559
abs_srcdir='`pwd`'
 
560
at_top_srcdir=.
 
561
abs_top_srcdir='`pwd`'
 
562
at_top_build_prefix=
 
563
abs_top_builddir='`pwd`'
 
564
EOF
 
565
])
 
566
AT_CHECK([$CONFIG_SHELL ./micro-suite], [0], [ignore])
 
567
dnl check that atlocal overrides environment
 
568
AT_CHECK([MY_VAR=unset $CONFIG_SHELL ./micro-suite], [0], [ignore])
 
569
dnl check that command line overrides atlocal
 
570
AT_CHECK([$CONFIG_SHELL ./micro-suite MY_VAR=], [1], [ignore], [ignore])
 
571
dnl check that syntax error is detected
 
572
AT_CHECK([$CONFIG_SHELL ./micro-suite =], [1], [], [ignore], [ignore])
 
573
AT_CHECK([$CONFIG_SHELL ./micro-suite 1=2], [1], [], [ignore], [ignore])
 
574
])
 
575
 
 
576
 
 
577
# Controlling where the testsuite is run.
 
578
AT_CHECK_AT_TEST([Choosing where testsuite is run],
 
579
  [AT_CHECK([:])], [], [], [], [], [
 
580
dnl AT_CHECK_AT_TEST tests the default of running in `.'.
 
581
AT_CHECK([$CONFIG_SHELL ./micro-suite --clean])
 
582
AT_CHECK([test -f micro-suite.log], [1])
 
583
AT_CHECK([test -d micro-suite.dir], [1])
 
584
AT_CHECK([mkdir sub1 sub2])
 
585
dnl check specifying a different relative path to run in.
 
586
AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1], [0], [ignore], [])
 
587
AT_CHECK([test -f micro-suite.log], [1])
 
588
AT_CHECK([test -f sub1/micro-suite.log], [0])
 
589
AT_CHECK([test -d micro-suite.dir], [1])
 
590
AT_CHECK([test -d sub1/micro-suite.dir], [0])
 
591
AT_CHECK([$CONFIG_SHELL ./micro-suite -C sub1 --clean])
 
592
AT_CHECK([test -f sub1/micro-suite.log], [1])
 
593
AT_CHECK([test -d sub1/micro-suite.dir], [1])
 
594
dnl check specifying an absolute path to run in.
 
595
AT_CHECK([$CONFIG_SHELL ./micro-suite --directory="`pwd`/sub2"],
 
596
         [0], [ignore], [])
 
597
AT_CHECK([test -f micro-suite.log], [1])
 
598
AT_CHECK([test -f sub2/micro-suite.log], [0])
 
599
AT_CHECK([$CONFIG_SHELL ./micro-suite --clean --directory="`pwd`/sub2"])
 
600
AT_CHECK([test -f sub2/micro-suite.log], [1])
 
601
AT_CHECK([test -f sub2/micro-suite.dir], [1])
 
602
dnl check for failure detection with bad, missing, or empty directory.
 
603
AT_CHECK([$CONFIG_SHELL ./micro-suite -C nonesuch], [1], [ignore], [ignore])
 
604
AT_CHECK([$CONFIG_SHELL ./micro-suite -C ''], [1], [ignore], [ignore])
 
605
AT_CHECK([$CONFIG_SHELL ./micro-suite -C -], [1], [ignore], [ignore])
 
606
AT_CHECK([$CONFIG_SHELL ./micro-suite -C], [1], [ignore], [ignore])
 
607
dnl check that --help overrides bad directory selection.
 
608
AT_CHECK([$CONFIG_SHELL ./micro-suite -C nonesuch --help], [0], [ignore], [])
 
609
])
 
610
 
 
611
 
 
612
## -------- ##
 
613
## Banners. ##
 
614
## -------- ##
 
615
AT_SETUP([Banners])
 
616
 
 
617
AT_CHECK_AT_PREP([b],
 
618
[[AT_INIT
 
619
AT_SETUP(zero)# 1
 
620
AT_CHECK(:)
 
621
AT_CLEANUP
 
622
 
 
623
AT_BANNER([first])
 
624
AT_SETUP(one a)# 2
 
625
AT_CHECK(:)
 
626
AT_CLEANUP
 
627
AT_SETUP(one b)# 3
 
628
AT_CHECK(:)
 
629
AT_CLEANUP
 
630
 
 
631
AT_BANNER()
 
632
AT_SETUP(two)# 4
 
633
AT_CHECK(:)
 
634
AT_CLEANUP
 
635
 
 
636
AT_BANNER([second])
 
637
AT_SETUP(three a)# 5
 
638
AT_CHECK(:)
 
639
AT_CLEANUP
 
640
AT_SETUP(three b)# 6
 
641
AT_CHECK(:)
 
642
AT_CLEANUP
 
643
]])
 
644
 
 
645
# AT_CHECK_BANNERS(TESTSUITE-OPTIONS, PATTERN1, COUNT1, PATTERN2, COUNT2)
 
646
m4_define([AT_CHECK_BANNERS],
 
647
[AT_CHECK([$CONFIG_SHELL ./b $1], [], [stdout])
 
648
AT_CHECK_EGREP([$2], m4_if([$3], [0], [1], [0]), [$3])
 
649
AT_CHECK_EGREP([$4], m4_if([$5], [0], [1], [0]), [$5])
 
650
])
 
651
 
 
652
AT_CHECK_BANNERS([],            [first], [1], [second], [1])
 
653
AT_CHECK_BANNERS([-k zero],     [first], [0], [second], [0])
 
654
AT_CHECK_BANNERS([1],           [first], [0], [second], [0])
 
655
AT_CHECK_BANNERS([-2],          [first], [1], [second], [0])
 
656
AT_CHECK_BANNERS([-3],          [first], [1], [second], [0])
 
657
AT_CHECK_BANNERS([-k one],      [first], [1], [second], [0])
 
658
AT_CHECK_BANNERS([3-4],         [first], [1], [second], [0])
 
659
AT_CHECK_BANNERS([3-5],         [first], [1], [second], [1])
 
660
AT_CHECK_BANNERS([4-5],         [first], [0], [second], [1])
 
661
AT_CHECK_BANNERS([3-],          [first], [1], [second], [1])
 
662
AT_CHECK_BANNERS([-k a],        [first], [1], [second], [1])
 
663
AT_CHECK_BANNERS([4],           [first], [0], [second], [0])
 
664
AT_CHECK_BANNERS([4-],          [first], [0], [second], [1])
 
665
AT_CHECK_BANNERS([-k two],      [first], [0], [second], [0])
 
666
AT_CHECK_BANNERS([1 4],         [first], [0], [second], [0])
 
667
AT_CHECK_BANNERS([-k three],    [first], [0], [second], [1])
 
668
AT_CHECK_BANNERS([5],           [first], [0], [second], [0])
 
669
AT_CHECK_BANNERS([5-],          [first], [0], [second], [1])
 
670
AT_CLEANUP
 
671
 
 
672
 
344
673
## --------- ##
345
674
## Keywords. ##
346
675
## --------- ##
347
676
AT_SETUP([Keywords and ranges])
348
 
AT_KEYWORDS([autotest])
349
677
 
350
 
AT_DATA([k.at],
351
 
[[m4_define([AT_PACKAGE_STRING],[k])
352
 
m4_define([AT_PACKAGE_BUGREPORT],[devnull])
353
 
AT_INIT
354
 
AT_SETUP(none)
355
 
AT_CHECK(:)
356
 
AT_CLEANUP
357
 
AT_SETUP(first)
358
 
AT_KEYWORDS(key1)
359
 
AT_CHECK(:)
360
 
AT_CLEANUP
361
 
AT_SETUP(second)
362
 
AT_KEYWORDS(key2)
363
 
AT_CHECK(:)
364
 
AT_CLEANUP
365
 
AT_SETUP(both)
366
 
AT_KEYWORDS(key1)
367
 
AT_KEYWORDS(key2)
 
678
AT_CHECK_AT_PREP([k],
 
679
[[AT_INIT
 
680
AT_SETUP(none) # 01
 
681
AT_CHECK(:)
 
682
AT_CLEANUP
 
683
AT_SETUP(first) # 02
 
684
AT_KEYWORDS(key1)
 
685
AT_CHECK(:)
 
686
AT_CLEANUP
 
687
AT_SETUP(second) # 03
 
688
AT_KEYWORDS(key2)
 
689
AT_CHECK(:)
 
690
AT_CLEANUP
 
691
AT_SETUP(both) # 04
 
692
AT_KEYWORDS([key1 key2])
 
693
AT_KEYWORDS([m4@&t@_echo([Key1])])
 
694
AT_CHECK(:)
 
695
AT_CLEANUP
 
696
AT_SETUP(test5) # 05
 
697
AT_CHECK(:)
 
698
AT_CLEANUP
 
699
AT_SETUP(test6) # 06
 
700
AT_CHECK(:)
 
701
AT_CLEANUP
 
702
AT_SETUP(test7) # 07
 
703
AT_CHECK(:)
 
704
AT_CLEANUP
 
705
AT_SETUP(test8) # 08
 
706
AT_CHECK(:)
 
707
AT_CLEANUP
 
708
AT_SETUP(test9) # 09
 
709
AT_CHECK(:)
 
710
AT_CLEANUP
 
711
AT_SETUP(test10) # 10
368
712
AT_CHECK(:)
369
713
AT_CLEANUP
370
714
]])
371
 
AT_CHECK_AUTOM4TE([--language=autotest -o k k.at])
372
 
 
373
 
# AT_CHECK_EGREP(PATTERN, STATUS, COUNT)
374
 
m4_define([AT_CHECK_EGREP],
375
 
[AT_CHECK([$EGREP -c '$1' stdout], $2, [$3
376
 
], ignore)
377
 
])
 
715
dnl check that AT_KEYWORDS does not duplicate words
 
716
AT_CHECK([grep -i 'key1.*key1' k], [1])
 
717
dnl check that -k requires an argument
 
718
AT_CHECK([$CONFIG_SHELL ./k -k], [1], [], [ignore])
378
719
 
379
720
# AT_CHECK_KEYS(TESTSUITE-OPTIONS, PATTERN1, COUNT1, PATTERN2, COUNT2)
380
721
m4_define([AT_CHECK_KEYS],
381
 
[AT_CHECK([./k $1], 0, [stdout])
 
722
[AT_CHECK([$CONFIG_SHELL ./k $1], 0, [stdout])
382
723
AT_CHECK_EGREP([$2], 0, [$3])
383
724
AT_CHECK_EGREP([$4], 1, [$5])
384
725
])
410
751
AT_CHECK_KEYS([-k 'fir.*'], [first], [1], [none|second|both], [0])
411
752
 
412
753
AT_CHECK_KEYS([1-2], [none|first], [2], [second|both], [0])
 
754
AT_CHECK_KEYS([01-002 08], [none|first], [2], [second|both], [0])
413
755
AT_CHECK_KEYS([1-3 2-1], [none|first|second], [3], [both], [0])
414
756
AT_CHECK_KEYS([-3], [none|first|second], [3], [both], [0])
415
757
AT_CHECK_KEYS([4-], [both], [1], [none|first|second], [0])
 
758
AT_CHECK_KEYS([010], [test10], [1], [none|first|second|both], [0])
416
759
AT_CHECK_KEYS([-k second 4-], [second|both], [2], [none|first], [0])
 
760
 
 
761
AT_CHECK([$CONFIG_SHELL ./k 0], [1], [ignore], [ignore])
 
762
AT_CHECK([$CONFIG_SHELL ./k 0-], [1], [ignore], [ignore])
 
763
AT_CHECK([$CONFIG_SHELL ./k -0], [1], [ignore], [ignore])
 
764
AT_CHECK([$CONFIG_SHELL ./k 11], [1], [ignore], [ignore])
 
765
AT_CHECK([$CONFIG_SHELL ./k 11-], [1], [ignore], [ignore])
 
766
AT_CHECK([$CONFIG_SHELL ./k 1-011], [1], [ignore], [ignore])
 
767
AT_CHECK([$CONFIG_SHELL ./k -k nonexistent], [0], [ignore])
 
768
 
 
769
AT_CHECK_KEYS([--list -k nonexistent], [KEYWORDS], [1], [first|second|both], [0])
 
770
AT_CHECK_KEYS([--list 1], [none], [1], [first|second|both], [0])
 
771
AT_CHECK_KEYS([--list 01], [none], [1], [first|second|both], [0])
 
772
AT_CHECK_KEYS([--list -k none -k first], [none|first], [2], [second|both], [0])
 
773
AT_CLEANUP
 
774
 
 
775
 
 
776
## ------------------- ##
 
777
## srcdir propagation. ##
 
778
## ------------------- ##
 
779
 
 
780
AT_SETUP([srcdir propagation])
 
781
 
 
782
mkdir pkg vpath-outside vpath-abs
 
783
mkdir pkg/t pkg/vpath-inside
 
784
AT_DATA([pkg/a])
 
785
AT_DATA([pkg/t/b])
 
786
 
 
787
AT_DATA([pkg/configure.ac], [[AC_INIT
 
788
AC_CONFIG_TESTDIR([t])
 
789
AC_OUTPUT
 
790
]])
 
791
cp "$abs_top_srcdir/build-aux/install-sh" pkg
 
792
 
 
793
cd pkg
 
794
AT_CHECK_AUTOCONF
 
795
cd ..
 
796
 
 
797
AT_CHECK_AT_PREP([suite],
 
798
[[AT_INIT([suite to check srcdir])
 
799
AT_SETUP([my only test])
 
800
AT_CHECK([test -f "$top_srcdir"/a && test -f "$srcdir"/b])
 
801
AT_CLEANUP
 
802
]], [], [], [], [pkg/t])
 
803
 
 
804
# Build directory totally outside source directory.
 
805
cd vpath-outside
 
806
AT_CHECK([../pkg/configure], [0], [ignore])
 
807
cd t
 
808
AT_CHECK([../../pkg/t/suite], [0], [ignore])
 
809
cd ../..
 
810
 
 
811
# Build directory totally outside source directory (absolute).
 
812
my_srcdir=`pwd`/pkg
 
813
cd vpath-abs
 
814
AT_CHECK(["$my_srcdir"/configure], [0], [ignore])
 
815
cd t
 
816
AT_CHECK(["$my_srcdir"/t/suite], [0], [ignore])
 
817
cd ../..
 
818
 
 
819
# Build directory as subdirectory of source directory.
 
820
cd pkg/vpath-inside
 
821
AT_CHECK([../configure], [0], [ignore])
 
822
cd t
 
823
AT_CHECK([../../t/suite], [0], [ignore])
 
824
cd ../../..
 
825
 
 
826
# Build directory as parent of source directory.
 
827
AT_CHECK([pkg/configure], [0], [ignore])
 
828
cd t
 
829
AT_CHECK([../pkg/t/suite], [0], [ignore])
 
830
cd ..
 
831
 
 
832
# Build directory as source directory.
 
833
cd pkg
 
834
AT_CHECK_CONFIGURE
 
835
cd t
 
836
AT_CHECK([./suite], [0], [ignore])
 
837
cd ../..
 
838
 
 
839
AT_CLEANUP
 
840
 
 
841
 
 
842
## ------------------------------ ##
 
843
## whitespace in absolute testdir ##
 
844
## ------------------------------ ##
 
845
 
 
846
AT_SETUP([whitespace in absolute testdir])
 
847
 
 
848
dir='dir with  whitespace'
 
849
mkdir "$dir"
 
850
cd "$dir"
 
851
wd=`pwd`
 
852
 
 
853
AT_DATA([a])
 
854
AT_CHECK_AT_PREP([suite],
 
855
[[AT_INIT([suite to check srcdir])
 
856
AT_SETUP([my only test])
 
857
AT_CHECK([test -f "$top_srcdir"/a])
 
858
AT_CLEANUP
 
859
]])
 
860
AT_CHECK([top_srcdir=$wd ./suite], [0], [ignore])
 
861
AT_CHECK([top_srcdir=$wd ./suite -d], [0], [ignore])
 
862
AT_CHECK([cd suite.dir/1 && ./run top_srcdir="$wd"], [0], [ignore], [ignore])
 
863
AT_CLEANUP
 
864
 
 
865
 
 
866
## ------------------ ##
 
867
## unusual file names ##
 
868
## ------------------ ##
 
869
 
 
870
AT_SETUP([unusual file names])
 
871
 
 
872
AT_DATA_M4SUGAR([d@&t@nl.at],
 
873
[[AT@&t@_SETUP([test one])
 
874
m4_pattern_allow([^dnl$])
 
875
AT@&t@_CHECK([test "]m4_dquote(AT@&t@_LINE)[" = dn[]l.at:3])
 
876
AT@&t@_CLEANUP
 
877
]])
 
878
 
 
879
mkdir sub
 
880
AT_DATA_M4SUGAR([sub/"two  spaces".at],
 
881
[[AT@&t@_SETUP([test two])
 
882
AT@&t@_CHECK([test "]m4_dquote(AT@&t@_LINE)[" = "two  spaces.at:2"])
 
883
AT@&t@_CLEANUP
 
884
]])
 
885
 
 
886
AT_CHECK_AT_PREP([suite],
 
887
[[AT_INIT([suite to check included file names])
 
888
m4@&t@_include([d][nl.at])
 
889
m4@&t@_include([sub/two  spaces.at])
 
890
]])
 
891
AT_CHECK([$CONFIG_SHELL ./suite], [0], [ignore])
417
892
AT_CLEANUP