ylwrap: preserve subdirectories in "#line" munging
[platform/upstream/automake.git] / t / check-exported-srcdir.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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 testsuite driver (either with or without the
18 # parallel-tests option enabled) exports the 'srcdir' value in the
19 # environment of the tests.  This is documented in the manual.
20
21 . ./defs || Exit 1
22
23 show_info ()
24 {
25   if test x"$am_parallel_tests" = x"yes"; then
26      cat foo.log
27      cat test-suite.log
28   else
29      :
30   fi
31 }
32
33 mkdir SrcDir
34 mv [!S]* SrcDir
35 mkdir BuildDir
36 cd SrcDir
37
38 cat >> configure.ac << 'END'
39 AC_OUTPUT
40 END
41
42 cat > Makefile.am << 'END'
43 TESTS = foo.test
44 END
45
46 cat > foo.test <<'END'
47 #!/bin/sh
48 echo "foo.test: srcdir='$srcdir'"
49 test x"$srcdir" = x"../SrcDir"
50 END
51 chmod a+x foo.test
52
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
56
57 cd ../BuildDir
58 ../SrcDir/configure
59
60 $MAKE check || { show_info; Exit 1; }
61 show_info
62
63 :