tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / tap-deps.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 # Basic TAP test protocol support:
18 #  - dependencies between test scripts
19
20 . test-init.sh
21
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
28
29 . tap-setup.sh
30
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
40
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
48 fi
49 # Creative quoting below to please maintainer-check.
50 sleep '3'
51 echo ok 2
52 : > b.run
53 END
54
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
62
63 chmod a+x *.test
64
65 run_make -O check
66 count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
67
68 cat > exp << 'END'
69 PASS: a.test 1
70 PASS: a.test 2
71 PASS: b.test 1
72 PASS: b.test 2
73 PASS: c.test 1
74 END
75
76 grep ': [abc]\.test' stdout > got
77
78 cat exp
79 cat got
80 diff exp got
81
82 # TODO: it would be nice to also redo the checks forcing parallel make...
83
84 :