19
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23
# AT_CHECK_AT_PREP(NAME, SUITE-CODE, [STATUS = 0], [STDOUT], [STDERR],
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
37
AT_CAPTURE_FILE([$1.log])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])
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])
51
m4_popdef([AT_dir])dnl
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],
33
AT_KEYWORDS([autotest])
34
AT_CAPTURE_FILE([micro-suite.log])
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])
45
AT_DATA([mysuite.at], [$2])
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])
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),
86
125
[[AT_INIT([empty test suite])
128
AT_CHECK_AT([Banner-only test suite],
129
[[AT_INIT([empty test suite])
89
133
# Next level of emptiness.
90
134
AT_CHECK_AT_TEST([Empty test], [])
92
136
# And finally, an empty check should not cause a syntax error.
93
137
AT_CHECK_AT_TEST([Empty check], [AT_CHECK])
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])
144
]], [AT@&t@_SETUP: missing AT@&t@_INIT detected])
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])
150
AT_CHECK_AT_SYNTAX([AT@&t@_CLEANUP without AT@&t@_INIT],
152
]], [AT@&t@_CLEANUP: missing AT@&t@_INIT detected])
154
AT_CHECK_AT_SYNTAX([Missing AT@&t@_CLEANUP],
155
[[AT_INIT([incomplete test suite])
156
AT_SETUP([only test])
158
]], [missing AT@&t@_CLEANUP detected])
160
AT_CHECK_AT_SYNTAX([AT@&t@_CHECK without AT@&t@_SETUP],
161
[[AT_INIT([incomplete test suite])
163
]], [AT@&t@_CHECK: missing AT@&t@_SETUP detected])
165
AT_CHECK_AT_SYNTAX([AT@&t@_DATA without AT@&t@_SETUP],
166
[[AT_INIT([incomplete test suite])
168
]], [AT@&t@_DATA: missing AT@&t@_SETUP detected])
170
AT_CHECK_AT_SYNTAX([AT@&t@_XFAIL_IF without AT@&t@_SETUP],
171
[[AT_INIT([incomplete test suite])
173
]], [AT@&t@_XFAIL_IF: missing AT@&t@_SETUP detected])
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])
180
AT_CHECK_AT_SYNTAX([AT@&t@_CLEANUP without AT@&t@_SETUP],
181
[[AT_INIT([incomplete test suite])
183
]], [AT@&t@_CLEANUP: missing AT@&t@_SETUP detected])
185
AT_CHECK_AT_SYNTAX([AT@&t@_BANNER inside AT@&t@_SETUP],
186
[[AT_INIT([incomplete test suite])
187
AT_SETUP([only test])
191
]], [AT@&t@_BANNER: nested AT@&t@_SETUP detected])
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])
201
]], [AT@&t@_SETUP: nested AT@&t@_SETUP detected])
203
AT_CHECK_AT_SYNTAX([Multiple AT@&t@_INIT],
204
[[AT_INIT([[suite, take one]])
206
]], [AT@&t@_INIT: invoked multiple times])
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])
214
[AT_CHECK([[sed -n 's|.*/\([^ /]* --version\)|\1|p' micro-suite.log]], [],
95
219
## ----------------------------------------------------- ##
96
220
## Newlines and command substitutions in test commands. ##
97
221
## ----------------------------------------------------- ##
378
## ----------------- ##
379
## Input from stdin. ##
380
## ----------------- ##
382
AT_SETUP([Input from stdin])
384
AT_CHECK_AT_PREP([micro-suite],
386
AT_SETUP([please enter hello<RETURN><EOF>])
387
AT_CHECK([cat], [], [hello
392
AT_CHECK([echo hello | $CONFIG_SHELL ./micro-suite], [], [ignore])
393
AT_CHECK([$CONFIG_SHELL ./micro-suite </dev/null], [1], [ignore], [ignore])
235
398
## ------------------------------- ##
236
399
## Funny characters in test names. ##
237
400
## ------------------------------- ##
239
402
# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, EXPANDED-TITLE-TO-TEST
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
408
# AT_CHECK_AT. Verify that `ok' prints at COLUMN.
246
409
m4_define([AT_CHECK_AT_TITLE],
247
410
[AT_CHECK_AT([$1],
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])
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 |
431
s/[^:]*: \(.*[^ ]\)[ ]*ok.*/\1/p
433
s/^.\{]]]m4_default($5, 53)[[[\}ok.*/ok/p
264
438
AT_CHECK([[$CONFIG_SHELL ./micro-suite -l |
265
439
sed -n 's/.*[0-9]: [^ ][^ ]*[ ][ ]*\(.*[^ ]\)[ ]*/\1/p']],,
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)])
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], [,])
285
AT_CHECK_AT_TITLE_CHAR([Quoted Macro], [[macro_name]],
287
AT_CHECK_AT_TITLE_CHAR([Macro], [macro_name],
289
AT_CHECK_AT_TITLE_CHAR([Macro with backquote], [macro_backquote],
449
[A ]m4_ifval([$3], [[$3]], [[$2]])[ in my name], $4, $5)])
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], [[)]], [)])
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],
294
# This test neither fails nor passes reliably.
295
# AT_CHECK_AT_TITLE_CHAR([Macro with backslash], [macro_backslash],
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])],
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])
482
## ----------------------- ##
483
## Long test source lines. ##
484
## ----------------------- ##
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.
489
AT_CHECK_AT_TEST([Long test source lines],
490
[m4_for([nnn], [1], [999], [], [: ])
492
], [], [], [], [ignore],
493
[AT_CHECK([$CONFIG_SHELL ./micro-suite -k skipalltests], [], [ignore], [ignore])
299
497
## ----------------- ##
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"
555
dnl Also populate enough of atlocal to do what atconfig normally does.
561
abs_top_srcdir='`pwd`'
563
abs_top_builddir='`pwd`'
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])
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"],
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], [])
617
AT_CHECK_AT_PREP([b],
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])
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])
347
676
AT_SETUP([Keywords and ranges])
348
AT_KEYWORDS([autotest])
351
[[m4_define([AT_PACKAGE_STRING],[k])
352
m4_define([AT_PACKAGE_BUGREPORT],[devnull])
678
AT_CHECK_AT_PREP([k],
687
AT_SETUP(second) # 03
692
AT_KEYWORDS([key1 key2])
693
AT_KEYWORDS([m4@&t@_echo([Key1])])
711
AT_SETUP(test10) # 10
371
AT_CHECK_AUTOM4TE([--language=autotest -o k k.at])
373
# AT_CHECK_EGREP(PATTERN, STATUS, COUNT)
374
m4_define([AT_CHECK_EGREP],
375
[AT_CHECK([$EGREP -c '$1' stdout], $2, [$3
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])
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])
410
751
AT_CHECK_KEYS([-k 'fir.*'], [first], [1], [none|second|both], [0])
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])
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])
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])
776
## ------------------- ##
777
## srcdir propagation. ##
778
## ------------------- ##
780
AT_SETUP([srcdir propagation])
782
mkdir pkg vpath-outside vpath-abs
783
mkdir pkg/t pkg/vpath-inside
787
AT_DATA([pkg/configure.ac], [[AC_INIT
788
AC_CONFIG_TESTDIR([t])
791
cp "$abs_top_srcdir/build-aux/install-sh" pkg
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])
802
]], [], [], [], [pkg/t])
804
# Build directory totally outside source directory.
806
AT_CHECK([../pkg/configure], [0], [ignore])
808
AT_CHECK([../../pkg/t/suite], [0], [ignore])
811
# Build directory totally outside source directory (absolute).
814
AT_CHECK(["$my_srcdir"/configure], [0], [ignore])
816
AT_CHECK(["$my_srcdir"/t/suite], [0], [ignore])
819
# Build directory as subdirectory of source directory.
821
AT_CHECK([../configure], [0], [ignore])
823
AT_CHECK([../../t/suite], [0], [ignore])
826
# Build directory as parent of source directory.
827
AT_CHECK([pkg/configure], [0], [ignore])
829
AT_CHECK([../pkg/t/suite], [0], [ignore])
832
# Build directory as source directory.
836
AT_CHECK([./suite], [0], [ignore])
842
## ------------------------------ ##
843
## whitespace in absolute testdir ##
844
## ------------------------------ ##
846
AT_SETUP([whitespace in absolute testdir])
848
dir='dir with whitespace'
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])
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])
866
## ------------------ ##
867
## unusual file names ##
868
## ------------------ ##
870
AT_SETUP([unusual file names])
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])
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"])
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])
891
AT_CHECK([$CONFIG_SHELL ./suite], [0], [ignore])