~ubuntu-branches/ubuntu/lucid/autoconf/lucid

« back to all changes in this revision

Viewing changes to tests/torture.at

  • Committer: Bazaar Package Importer
  • Author(s): Ben Pfaff
  • Date: 2005-01-08 16:59:38 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050108165938-1t9x9n0wdoby57oe
Tags: 2.59a-3
Flush info dir entry for autoconf.info.  Closes: #289012.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#                                                       -*- Autotest -*-
2
2
 
3
 
# Copyright 2000, 2001, 2002 (C) Free Software Foundation, Inc.
 
3
# Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4
4
#
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
30
30
]])
31
31
 
32
32
 
 
33
## -------------------------- ##
 
34
## Multiple AC_CONFIG_FILES.  ##
 
35
## -------------------------- ##
 
36
 
 
37
AT_SETUP([Multiple AC_CONFIG_FILES])
 
38
 
 
39
AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
 
40
AT_CHECK_AUTOCONF([], 1, [], [ignore])
 
41
 
 
42
AT_CLEANUP
 
43
 
 
44
 
 
45
 
33
46
## ------------ ##
34
47
## AC_ARG_VAR.  ##
35
48
## ------------ ##
37
50
# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
38
51
# ----------------------------------------------
39
52
# Check that AC_ARG_VAR caches the latest values, diagnoses
40
 
# inconsistances, and arms config.status.
 
53
# inconsistencies, and arms config.status.
41
54
m4_define([AT_CHECK_AC_ARG_VAR],
42
55
[rm -f config.cache
43
56
 
44
57
# Initial value.
45
58
m4_ifval([$1],
46
 
         [precious='$1'; export precious],
47
 
         [unset precious])
48
 
AT_CHECK_CONFIGURE([--config-cache])
 
59
         [precious='$1'; export precious],
 
60
         [unset precious])
 
61
AT_CHECK_CONFIGURE([--config-cache -q])
49
62
AT_CHECK([cat file], [], [`$1'
50
63
])
51
64
 
52
 
# Testing --recheck.
 
65
# Testing --recheck: 1. have the environment `forget' about PRECIOUS.
53
66
unset precious
 
67
# 2. Rerun config.status to recreate `file'.
54
68
AT_CHECK([./config.status --recheck], [], [ignore])
55
69
AT_CHECK([./config.status], [], [ignore])
 
70
# 3. Check that file contains the old value of PRECIOUS.
56
71
AT_CHECK([cat file], [], [`$1'
57
72
])
58
73
 
59
 
# Second value.
 
74
# Second value: we should issue an error here: the value
 
75
# has changed!
60
76
m4_ifval([$2],
61
 
         [precious='$2'; export precious],
62
 
         [unset precious])
 
77
         [precious='$2'; export precious],
 
78
         [unset precious])
63
79
AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
64
80
 
65
81
])# AT_CHECK_AC_ARG_VAR
80
96
AT_DATA([configure.ac],
81
97
[[AC_INIT
82
98
AC_ARG_VAR([precious], [this variable costs a lot])
 
99
echo "precious:$precious"
83
100
AC_OUTPUT(file)
84
101
]])
85
102
 
128
145
 
129
146
 command)
130
147
   AC_CONFIG_COMMANDS(command:input,
131
 
                      [cp input command]);;
 
148
                      [cp input command]);;
132
149
 var-command)
133
150
   AC_CONFIG_COMMANDS(var-command:$command_in,
134
 
                      [cp $command_in var-command], [command_in=input]);;
 
151
                      [cp $command_in var-command], [command_in=input]);;
135
152
 
136
153
 link)
137
154
   AC_CONFIG_LINKS(link:input);;
153
170
m4_define([AT_CHECK_CONFIG_CREATION],
154
171
[AT_CHECK_CONFIGURE([what_to_test=$1])
155
172
AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
156
 
         [ignore], [$1
 
173
         [ignore], [$1
157
174
])
158
175
AT_CHECK([grep OK $1], [], [OK
159
176
])
163
180
# really broken...
164
181
AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
165
182
AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
166
 
         [ignore], [var-$1
 
183
         [ignore], [var-$1
167
184
])
168
185
AT_CHECK([grep OK var-$1], [], [OK
169
186
])
233
250
AT_CHECK_AUTOCONF
234
251
 
235
252
AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
236
 
                     sed -n -e 's/^result=//p'], 0,
237
 
                   [onetwothree
 
253
                     sed -n -e 's/^result=//p'], 0,
 
254
                   [onetwothree
238
255
])
239
256
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
240
 
         [onetwothree
 
257
         [onetwothree
241
258
])
242
259
 
243
260
AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
244
 
                      sed -n -e 's/^result=//p'], 0,
245
 
                   ["'$ " ' $ "'$
 
261
                      sed -n -e 's/^result=//p'], 0,
 
262
                   ["'$ " ' $ "'$
246
263
])
247
264
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
248
 
         ["'$ " ' $ "'$
 
265
         ["'$ " ' $ "'$
249
266
])
250
267
 
251
268
AT_CLEANUP
280
297
# Things included in confdefs.h, but which make no sense in
281
298
# config.h, nor in $DEFS.
282
299
cat <<\EOF >>confdefs.h
283
 
/* Hi Mum! Look, I'm doing C++! */
 
300
/* Hi Mum! Look, I am doing C++! */
284
301
#ifdef __cplusplus
285
302
void exit (int status);
286
303
#endif
411
428
m4_defun([AC_DEFUBST],
412
429
[AC_DUMMY_VAR($1)="AC_BIG_VALUE"
413
430
AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
414
 
                   AC_DESCRIPTION)
 
431
                   AC_DESCRIPTION)
415
432
AC_SUBST(AC_DUMMY_VAR($1))])
416
433
 
417
434
AC_INIT
477
494
AC_CONFIG_COMMANDS([report],
478
495
[test -f $srcdir/configure.ac ||
479
496
   AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
480
 
                   [srcdir=$srcdir])
 
497
                   [srcdir=$srcdir])
481
498
 
482
499
AC_OUTPUT
483
500
rm -rf foo at-dir/bar
542
559
AT_KEYWORDS(autoreconf)
543
560
 
544
561
# We use aclocal (via autoreconf).
545
 
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
546
 
 
547
 
# Move into a fresh testSubDir.  But Autotest is not ready for such
548
 
# tricks, albeit most useful :( It expects to find its files
549
 
# (at-setup-line and so on) in the original `.', and it will complain
550
 
# not to find even one.  So just run mkdir as if it were a test.  This
551
 
# will create at-setup-line blah blah, and Autotest will leave us in
552
 
# peace.
553
 
#
554
 
# FIXME: The more I think about it, the more I am tempted to *always*
555
 
# have test groups run in a subdir, a` la Automake.
556
 
AT_CHECK([AS_MKDIR_P([testSubDir])])
557
 
cd testSubDir
 
562
AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
 
563
# It should understand configure.ac.
 
564
AT_CHECK([[grep '1.[01234]' stdout && exit 77]], [1], [ignore])
558
565
 
559
566
# The contents of `inner/', and `inner/innermost/'.
560
567
AS_MKDIR_P([inner/innermost])
563
570
# be compatible with Automake 1.4: aclocal (run by autoreconf) would
564
571
# die because it can't find configure.in.
565
572
AT_DATA([inner/configure.in],
566
 
[AC_INIT(GNU Inner, 1.0)
 
573
[[AC_INIT(GNU Inner, 1.0)
567
574
AC_CONFIG_SRCDIR([innermost/config.in])
568
575
AC_ARG_VAR([INNER], [an inner variable])
569
 
AC_SUBST([INNER], "inner")
 
576
AC_SUBST([INNER])
 
577
if test "x$INNER" = x; then
 
578
  INNER=inner
 
579
fi
570
580
AC_CONFIG_FILES([innermost/config])
571
581
AC_OUTPUT
572
 
])
 
582
]])
573
583
 
574
584
AT_DATA([inner/innermost/config.in],
575
585
[INNER=@INNER@
576
586
srcdir=@srcdir@
577
587
top_srcdir=@top_srcdir@
 
588
prefix=@prefix@
578
589
])
579
590
 
580
591
# The contents of `.'
582
593
 
583
594
# nonexistent is allowed not to exist.
584
595
AT_DATA([configure.in],
585
 
[AC_INIT(GNU Outer, 1.0)
 
596
[[AC_INIT(GNU Outer, 1.0)
586
597
AC_ARG_VAR([OUTER], [an outer variable])
587
598
if false; then
588
599
  AC_CONFIG_SUBDIRS([nonexistent])
589
600
fi
590
601
AC_CONFIG_SUBDIRS([inner])
591
602
AC_OUTPUT
592
 
])
 
603
]])
593
604
 
594
 
AT_CHECK([autoreconf])
 
605
# If there are improperly quoted AC_DEFUN installed in share/aclocal,
 
606
# they trigger warnings from aclocal 1.8, so ignore stderr.
 
607
AT_CHECK([autoreconf], [], [], [ignore])
595
608
AT_CHECK([test -f inner/configure])
596
609
 
597
610
# Running the outer configure recursively should provide the innermost
604
617
[INNER=inner
605
618
srcdir=.
606
619
top_srcdir=..
 
620
prefix=/usr/local
607
621
])
608
622
 
609
623
# The same, but from a builddir.
613
627
[INNER=inner
614
628
srcdir=../../../inner/innermost
615
629
top_srcdir=../../../inner
616
 
])
617
 
 
 
630
prefix=/usr/local
 
631
])
 
632
 
 
633
# Make sure precious variables and command line options are properly
 
634
# passed, even when there are duplicates.  Run another directory so
 
635
# that if the user has set config.site to have a config.cache, then
 
636
# the two runs don't have colliding caches.
 
637
AS_MKDIR_P([builddir2])
 
638
AT_CHECK([cd builddir2 && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
 
639
AT_CHECK([cat builddir2/inner/innermost/config], 0,
 
640
[INNER=good
 
641
srcdir=../../../inner/innermost
 
642
top_srcdir=../../../inner
 
643
prefix=/good
 
644
])
 
645
 
 
646
AT_CLEANUP
 
647
 
 
648
 
 
649
 
 
650
## -------------- ##
 
651
## Deep Package.  ##
 
652
## -------------- ##
 
653
 
 
654
AT_SETUP([Deep Package])
 
655
AT_KEYWORDS(autoreconf)
 
656
 
 
657
# We use aclocal (via autoreconf).
 
658
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
 
659
 
 
660
# The contents of `.'
 
661
AT_DATA([install-sh], [])
 
662
AT_DATA([configure.in],
 
663
[[AC_INIT(GNU Outer, 1.0)
 
664
AC_ARG_VAR([OUTER], [an outer variable])
 
665
AC_CONFIG_SUBDIRS([inner])
 
666
AC_OUTPUT
 
667
]])
 
668
 
 
669
# The contents of `inner/', and `inner/innermost/'.
 
670
AS_MKDIR_P([inner/innermost])
 
671
 
 
672
AT_DATA([inner/configure.ac],
 
673
[[AC_INIT(GNU Inner, 1.0)
 
674
AC_ARG_VAR([INNER], [an inner variable])
 
675
AC_CONFIG_SUBDIRS(innermost)
 
676
AC_OUTPUT
 
677
]])
 
678
 
 
679
AT_DATA([inner/innermost/configure.ac],
 
680
[[AC_INIT(GNU Innermost, 1.0)
 
681
AC_ARG_VAR([INNERMOST], [an innermost variable])
 
682
AC_CONFIG_HEADERS(config.h:config.hin)
 
683
AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
 
684
AC_OUTPUT
 
685
]])
 
686
 
 
687
AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
 
688
AT_CHECK([test -f inner/configure])
 
689
AT_CHECK([test -f inner/innermost/configure])
 
690
AT_CHECK([test -f inner/innermost/config.hin])
 
691
 
 
692
# Running the outer configure recursively should provide the innermost
 
693
# help strings.
 
694
AT_CHECK([./configure --help=recursive | grep " INNER "],     0, [ignore])
 
695
AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
 
696
 
 
697
# Running the outer configure should trigger the inner.
 
698
AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
 
699
AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
 
700
[[#define INNERMOST tsomrenni
 
701
]])
 
702
 
 
703
# The same, but from a builddir.
 
704
AS_MKDIR_P([builddir])
 
705
AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
 
706
AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
 
707
[[#define INNERMOST build/tsomrenni
 
708
]])
618
709
 
619
710
AT_CLEANUP