readme: fixlets to HACKING
[automake.git] / t / tap-deps.sh
blob8e84a63bc1057cb1d077d184ca841370da9e84a4
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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 <http://www.gnu.org/licenses/>.
17 # Basic TAP test protocol support:
18 # - dependencies between test scripts
20 . ./defs || exit 1
22 cat > Makefile.am << 'END'
23 # The tests are *deliberately* listed in inversed order here.
24 TESTS = c.test b.test a.test
25 b.log: a.log
26 c.log: b.log
27 END
29 . tap-setup.sh
31 cat > a.test << 'END'
32 #!/bin/sh
33 echo 1..2
34 echo ok 1
35 # Creative quoting below to please maintainer-check.
36 sleep '3'
37 echo ok 2
38 : > a.run
39 END
41 cat > b.test << 'END'
42 #!/bin/sh
43 echo 1..2
44 if test -f a.run; then
45 echo ok 1
46 else
47 echo not ok 1
49 # Creative quoting below to please maintainer-check.
50 sleep '3'
51 echo ok 2
52 : > b.run
53 END
55 cat > c.test << 'END'
56 #!/bin/sh
57 echo 1..1
58 test -f b.run || { echo 'Bail out!'; exit 1; }
59 echo ok 1
60 rm -f a.run b.run
61 END
63 chmod a+x *.test
65 $MAKE check >stdout || { cat stdout; exit 1; }
66 cat stdout
68 count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
70 cat > exp << 'END'
71 PASS: a.test 1
72 PASS: a.test 2
73 PASS: b.test 1
74 PASS: b.test 2
75 PASS: c.test 1
76 END
78 grep ': [abc]\.test' stdout > got
80 cat exp
81 cat got
82 diff exp got
84 # TODO: it would be nice to also redo the checks forcing parallel make...