test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / tap-doc.sh
blob26659751f71ad51b5876f04011420efdaf6296f8
1 #! /bin/sh
2 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
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.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Check that an example given in the documentation really works.
18 # See section "Simple Tests" subsection "Script-based Testsuites".
20 . test-init.sh
22 fetch_tap_driver
24 cat >> configure.ac <<END
25 AC_PROG_CC
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 TESTS = foo.sh zardoz.tap bar.sh mu.tap
31 TEST_EXTENSIONS = .sh .tap
32 TAP_LOG_DRIVER = $(srcdir)/tap-driver
33 ## Ensure the test scripts are run in the correct order.
34 mu.log: bar.log
35 bar.log: zardoz.log
36 zardoz.log: foo.log
37 END
39 cat > foo.sh <<'END'
40 #!/bin/sh
41 exit 0
42 END
44 cat > bar.sh <<'END'
45 #!/bin/sh
46 exit 77
47 END
49 cat > zardoz.tap << 'END'
50 #!/bin/sh
51 echo 1..4
52 echo 'ok 1 - Daemon started'
53 echo 'ok 2 - Daemon responding'
54 echo 'ok 3 - Daemon uses /proc # SKIP /proc is not mounted'
55 echo 'ok 4 - Daemon stopped'
56 END
58 cat > mu.tap << 'END'
59 #!/bin/sh
60 echo 1..2
61 echo 'ok'
62 echo 'not ok # TODO frobnication not yet implemented'
63 END
65 chmod a+x *.sh *.tap
67 $ACLOCAL
68 $AUTOCONF
69 $AUTOMAKE -a
71 ./configure
73 run_make -O check
75 cat > exp <<'END'
76 PASS: foo.sh
77 PASS: zardoz.tap 1 - Daemon started
78 PASS: zardoz.tap 2 - Daemon responding
79 SKIP: zardoz.tap 3 - Daemon uses /proc # SKIP /proc is not mounted
80 PASS: zardoz.tap 4 - Daemon stopped
81 SKIP: bar.sh
82 PASS: mu.tap 1
83 XFAIL: mu.tap 2 # TODO frobnication not yet implemented
84 END
86 sed -n '/^PASS: foo\.sh/,/^XFAIL: mu\.tap/p' stdout > t
87 cat t
88 # Strip extra "informative" lines that could be printed by Solaris
89 # Distributed Make.
90 LC_ALL=C $EGREP -v ' --> ([0-9][0-9]* job|[Jj]ob output)' t > got
92 cat exp
93 cat got
94 diff exp got