summaryrefslogtreecommitdiff
path: root/tests/run-gprof
blob: 04379864a79da9fcca8c1095e71a622e3a30b590 (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
#! /bin/sh
: ${TMPDIR:=/tmp}
export TMPDIR

BASH_TSTOUT=/tmp/xx	# for now
export BASH_TSTOUT

trap 'rm -f $BASH_TSTOUT' 0

PATH=.:$PATH	# just to get recho/zecho/printenv if not run via `make tests'
export PATH

# unset BASH_ENV only if it is set
[ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV
# ditto for SHELLOPTS
#[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS

: ${THIS_SH:=../bash}
export THIS_SH

: ${BUILD_DIR:=..}
export BUILD_DIR

GPROF="gprof"

rm -f gmon.sum

${THIS_SH} ./version

rm -f "$BASH_TSTOUT"

# prime the pump; ${GPROF} complains if gmon.sum is empty
[ -f gmon.out ] && ${GPROF} -s ${THIS_SH} gmon.out >/dev/null

export GMON_OUT_PREFIX=bash
echo Any output from any test, unless otherwise noted, indicates a possible anomaly

for x in run-*
do
	case $x in
	$0|run-all|run-minimal|run-gprof)	;;
	*.orig|*~) ;;
	*)	echo $x ; sh $x
		if [ -f $TMPDIR/gmon.out ]; then
			if [ -f gmon.out ]; then
				${GPROF} -s ${THIS_SH} gmon.sum ${GMON_OUT_PREFIX}.[0-9]* $TMPDIR/${GMON_OUT_PREFIX}.[0-9]* >/dev/null
			else
				${GPROF} -s ${THIS_SH} gmon.sum $TMPDIR/${GMON_OUT_PREFIX}.[0-9]* >/dev/null				
			fi
		else
			${GPROF} -s ${THIS_SH} gmon.sum ${GMON_OUT_PREFIX}.[0-9]* >/dev/null
		fi
		rm -f $TMPDIR/${GMON_OUT_PREFIX}.[0-9]* ${GMON_OUT_PREFIX}.[0-9]*
		;;
	esac
done

if [ -f ./-specialname.gmon ]; then
	${GPROF} -s ${THIS_SH} gmon.sum ./-specialname.gmon > /dev/null
	rm -f ./-specialname.gmon
fi
if [ -f ./ohio-state.gmon ]; then
	${GPROF} -s ${THIS_SH} gmon.sum ./ohio-state.gmon > /dev/null
	rm -f ./ohio-state.gmon
fi

if [ -f specialname.gmon ]; then
	${GPROF} -s ${THIS_SH} gmon.sum ./specialname.gmon > /dev/null
	rm -f specialname.gmon
fi

exit 0