ylwrap: preserve subdirectories in "#line" munging
[platform/upstream/automake.git] / t / parallel-tests-cmdline-override.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 we can use indirections when overriding TESTS and
18 # TEST_LOGS from the command line.
19
20 am_parallel_tests=yes
21 . ./defs || Exit 1
22
23 cat >> configure.ac << 'END'
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 TEST_EXTENSIONS = .test .t
29 TEST_LOG_COMPILER = cat
30 T_LOG_COMPILER = cat
31 TESTS = bad.test
32 var1 = b.test $(var2)
33 var2 = c.test
34 var3 = d.d
35 var4 = e
36 END
37
38 $ACLOCAL
39 $AUTOCONF
40 $AUTOMAKE -a
41
42 ./configure
43 rm -f config.log # Do not create false positives below.
44
45 cat > exp-log <<'END'
46 a.log
47 b.log
48 c.log
49 d.log
50 e.log
51 test-suite.log
52 END
53
54 cat > exp-out <<'END'
55 PASS: a.t
56 PASS: b.test
57 PASS: c.test
58 PASS: d.t
59 PASS: e.test
60 END
61
62 do_check ()
63 {
64   env "$@" $MAKE -e check >stdout || { cat stdout; Exit 1; }
65   cat stdout
66   grep '^PASS:' stdout | LC_ALL=C sort > got-out
67   cat got-out
68   ls . | grep '\.log$' | LC_ALL=C sort > got-log
69   cat got-log
70   st=0
71   diff exp-out got-out || st=1
72   diff exp-log got-log || st=1
73   return $st
74 }
75
76 tests='a.t $(var1) $(var3:.d=.t) $(var4:=.test)'
77 test_logs='a.log $(var1:.test=.log) $(var3:.d=.log) $(var4:=.log)'
78
79 touch a.t b.test c.test d.t e.test
80
81 do_check TESTS="$tests"
82 do_check TEST_LOGS="$test_logs"
83
84 :