Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / dejagnu-siteexp-useredit.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am << 'END'
29 AUTOMAKE_OPTIONS = dejagnu
30 DEJATOOL = foo
31 END
32
33 # Deliberately select a variable defined automatically by
34 # the Makefile-generated site.exp.
35 mkdir foo.test
36 cat > foo.test/foo.exp << 'END'
37 send_user "objdir: $objdir\n"
38 set pipe "|"
39 if { $objdir == "${pipe}objdir${pipe}" } {
40     pass "test_obj"
41 } else {
42     fail "test_obj"
43 }
44 END
45
46 $ACLOCAL
47 $AUTOCONF
48 $AUTOMAKE --add-missing
49
50 ./configure
51
52 $MAKE site.exp
53 echo 'set objdir "|objdir|"' >> site.exp
54 cat site.exp
55 $sleep
56 touch Makefile
57 $MAKE site.exp
58 cat site.exp
59 is_newest site.exp Makefile  # Sanity check.
60 grep '|objdir|' site.exp
61 test `grep -c '|objdir|' site.exp` -eq 1
62
63 # We can done a "more semantic" check if DejaGnu is available.
64 if runtest SOMEPROGRAM=someprogram --version; then
65   $MAKE check
66   grep 'PASS: test_obj' foo.sum
67 fi
68
69 :