Merge branch 'maint'
[platform/upstream/automake.git] / t / perf / testsuite-summary.sh
1 #! /bin/sh
2 # Copyright (C) 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 # Check performanceof recipe generating test-suite.log file and testsuite
18 # summary.  That has suffered of huge inefficiencies in the past.
19 # FIXME: this test is not currently able to detect whether the measured
20 # FIXME: performance is too low, and FAIL accordingly; it just offers
21 # FIXME: an easy way verify how effective a performance optimization is.
22
23 . ./defs || exit 1
24
25 count=10000
26
27 echo AC_OUTPUT >> configure.ac
28
29 cat > Makefile.am <<'END'
30 TEST_EXTENSIONS = .t
31 ## Will be updated later.
32 TESTS =
33 ## None of these should ever be run.
34 T_LOG_COMPILER = false
35 T_LOG_DRIVER = false
36 END
37
38 # Temporarily disable shell traces, to avoid bloating the log file.
39 set +x
40
41 for i in $(seq_ 1 $count); do
42   echo false > $i.t
43   echo dummy $i > $i.log
44   echo :global-test-result: PASS > $i.trs
45   echo :test-result: PASS >> $i.trs
46   echo :copy-in-global-log: yes >> $i.trs
47   echo TESTS += $i.t
48 done >> Makefile.am
49
50 # Re-enable shell traces.
51 set -x
52
53 head -n 100 Makefile.am || : # For debugging.
54 tail -n 100 Makefile.am || : # Likewise.
55 cat $count.trs               # Likewise, just the last specimen though.
56
57 # So that we don't need to create a ton of dummy tests.
58 #echo '$(TESTS):' >> Makefile.am
59
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE -a
63
64 ./configure
65
66 $MAKE test-suite.log >stdout || { cat stdout; exit 1; }
67 cat stdout
68
69 # Sanity checks.
70 grep "^# TOTAL: $count$" stdout
71 grep "^dummy $count$" test-suite.log
72 specimen=347 # Could be any number <= $count.
73 grep "^dummy $specimen$" test-suite.log
74
75 :