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