summaryrefslogtreecommitdiff
path: root/Porting/testall.atom
blob: a709cfdb0167389aad727f4d93684e8991feba15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh

#
# testall.atom
# 
# This script creates all.Counts file that can be fed to prof(1)
# to produce various basic block counting profiles.
#
# This script needs to be run at the top level of the Perl build
# directory after the "make all" and "make test" targets have been run.
#
# You will also need to have perl.pixie built,
# which means that you will also have Configured with -Doptimize=-g.
#
# After the script has been run (this will take several minutes)
# you will have a file called all.Counts, which contains the cumulative
# basic block counting results over the whole Perl test suite.
# You can produce various reports using prof(1);
#
#   prof -pixie               -all -L. perl all.Counts
#   prof -pixie -heavy        -all -L. perl all.Counts
#   prof -pixie -invocations  -all -L. perl all.Counts
#   prof -pixie -lines        -all -L. perl all.Counts
#   prof -pixie -testcoverage -all -L. perl all.Counts
#   prof -pixie -zero         -all -L. perl all.Counts
#
# io/openpid and op/fork core on me, I don't know why and haven't
# taken a look yet.
#
# jhi@iki.fi
#

if test ! -f /usr/bin/atom
then
    echo "$0: no /usr/bin/atom"
    exit 1
fi

if test ! -f perl;       then echo "$0: no perl";      exit 1; fi
if test ! -f perl.pixie; then echo "$0: no perl.pixie; exit 1; fi
if test ! -f t/perl;     then echo "$0: no t/perl;     exit 1; fi

LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH

cd t || exit 1

ln -sf ../perl.pixie .

if test $# = 0; then
  the_t=`echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t uni/*.t pod/*.t x2p/*.t; find ../ext ../lib -name '*.t' -print`
else
  the_t=$@
fi

PERL_DESTRUCT_LEVEL=2
export PERL_DESTRUCT_LEVEL
PERL_CORE=1
export PERL_CORE

rm -f all.Counts

for t in $the_t
do
    case "$t" in
    ext/*|lib/*) t=../$t ;;
    t/*) t=`echo $t|sed 's:^t/::'` ;;
    esac
    echo $t|sed 's:\.t$::'
    sw=''
    case "`head -1 $t|egrep -e '^#.* -.*T'`" in
    *-*T*) sw="$sw -T" ;;
    esac
    case "`head -1 $t|egrep -e '^#.* -.*t'`" in
    *-*t*) sw="$sw -t" ;;
    esac
    ./perl.pixie -I../lib $sw $t > /dev/null
    if cd ..
    then
        if test -f all.Counts
        then
            prof -pixie -merge new.Counts -L. -incobj libperl.so perl t/perl.Counts all.Counts
            mv new.Counts all.Counts
        else
            mv t/perl.Counts all.Counts
        fi
        cd t
    fi
done

exit 0