tests: use perl, not find+rm, to remove temporary directories
[platform/upstream/automake.git] / t / parallel-tests-log-override-2.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 # Check parallel-tests features: runtime redefinition of:
18 #  - $(TEST_SUITE_LOG) and $(TESTS)
19 #  - $(TEST_SUITE_LOG) and $(TEST_LOGS)
20
21 . test-init.sh
22
23 cat >> configure.ac <<'END'
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am <<'END'
28 TESTS = pass.test pass2.test skip.test skip2.test fail.test
29 END
30
31 cat > pass.test <<'END'
32 #! /bin/sh
33 exit 0
34 END
35
36 cp pass.test pass2.test
37
38 cat > skip.test <<'END'
39 #! /bin/sh
40 echo "% skipped test %"
41 exit 77
42 END
43
44 cp skip.test skip2.test
45
46 cat > fail.test <<'END'
47 #! /bin/sh
48 exit 1
49 END
50
51 chmod a+x *.test
52
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
56
57 ./configure
58
59 for test_list_override in \
60   'TESTS=pass.test skip.test' \
61   'TEST_LOGS=pass.log skip.log'
62 do
63   env TEST_SUITE_LOG=partial.log "$test_list_override" \
64     $MAKE -e check >stdout || { cat stdout; exit 1; }
65   cat stdout
66   ls -l
67   count_test_results total=2 pass=1 fail=0 skip=1 xfail=0 xpass=0 error=0
68   cat pass.log
69   cat skip.log
70   cat partial.log
71   test ! -e test-suite.log
72   test ! -e pass2.log
73   test ! -e skip2.log
74   test ! -e fail.log
75   grep '^PASS: pass\.test$' stdout
76   grep '^SKIP: skip\.test$' stdout
77   $FGREP 'SKIP: skip' partial.log
78   $FGREP '% skipped test %' partial.log
79   $EGREP '(pass2|skip2|fail)\.test' stdout && exit 1
80   $EGREP '(pass2|skip2|fail)' partial.log && exit 1
81   rm -f *.log
82 done
83
84 :