tests: expose automake bug#14560
[platform/upstream/automake.git] / t / dejagnu-siteexp-useredit.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Check that the user can edit the Makefile-generated site.exp, and
18 # have its edits survive to the remaking of that file.
19
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
25
26 cat > Makefile.am << 'END'
27 AUTOMAKE_OPTIONS = dejagnu
28 DEJATOOL = foo
29 END
30
31 # Deliberately select a variable defined automatically by
32 # the Makefile-generated site.exp.
33 mkdir foo.test
34 cat > foo.test/foo.exp << 'END'
35 send_user "objdir: $objdir\n"
36 set pipe "|"
37 if { $objdir == "${pipe}objdir${pipe}" } {
38     pass "test_obj"
39 } else {
40     fail "test_obj"
41 }
42 END
43
44 $ACLOCAL
45 $AUTOCONF
46 $AUTOMAKE --add-missing
47
48 ./configure
49
50 $MAKE site.exp
51 echo 'set objdir "|objdir|"' >> site.exp
52 cat site.exp
53 $sleep
54 touch Makefile
55 $MAKE site.exp
56 cat site.exp
57 is_newest site.exp Makefile  # Sanity check.
58 grep '|objdir|' site.exp
59 test $($FGREP -c '|objdir|' site.exp) -eq 1
60
61 # We can do a "more semantic" check if DejaGnu is available.
62 if runtest SOMEPROGRAM=someprogram --version; then
63   $MAKE check
64   grep 'PASS: test_obj' foo.sum
65 fi
66
67 :