tests: expose automake bug#14560
[platform/upstream/automake.git] / t / tap-more2.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 # More on TAP support:
18 #  - more LOG_COMPILER at once for TAP tests
19 #  - binary programs in $(TESTS)
20 #  - interactions with 'check_*' variables
21
22 required='cc native'
23 . test-init.sh
24
25 fetch_tap_driver
26
27 cat >> configure.ac <<END
28 AC_PROG_CC
29 AC_OUTPUT
30 END
31
32 cat > Makefile.am << 'END'
33 TEST_EXTENSIONS = .sh .tap
34
35 tap_driver = $(srcdir)/tap-driver
36
37 LOG_DRIVER = $(tap_driver)
38 SH_LOG_DRIVER = $(tap_driver)
39 TAP_LOG_DRIVER = $(tap_driver)
40
41 TAP_LOG_COMPILER = cat
42 SH_LOG_COMPILER = $(SHELL)
43 LOG_COMPILER =
44
45 EXTRA_DIST = baz.tap
46
47 check_SCRIPTS = bar.sh
48 bar.sh: Makefile
49         echo '#!/bin/sh' > $@-t
50         echo 'echo 1..1' >> $@-t
51         echo 'echo "not ok 1 # TODO"' >> $@-t
52         chmod a-w $@-t && mv -f $@-t $@
53 CLEANFILES = bar.sh
54
55 check_PROGRAMS = foo-test
56 foo_test_SOURCES = foo.c
57
58 TESTS = foo-test $(check_SCRIPTS) baz.tap
59
60 EXTRA_DIST += tap-driver
61 END
62
63 cat > foo.c <<'END'
64 #include <stdio.h>
65 int main (void)
66 {
67   printf ("1..1\n");
68   printf ("ok 1\n");
69   return 0;
70 }
71 END
72
73 cat > baz.tap << 'END'
74 1..1
75 ok 1 # SKIP
76 END
77
78 $ACLOCAL
79 $AUTOCONF
80 $AUTOMAKE
81
82 ./configure
83
84 for target in check distcheck; do
85   run_make -O $target
86   count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
87 done
88
89 :