summaryrefslogtreecommitdiff
path: root/qa/040
diff options
context:
space:
mode:
Diffstat (limited to 'qa/040')
-rwxr-xr-xqa/04094
1 files changed, 94 insertions, 0 deletions
diff --git a/qa/040 b/qa/040
new file mode 100755
index 0000000..5182c01
--- /dev/null
+++ b/qa/040
@@ -0,0 +1,94 @@
+#! /bin/sh
+# PCP QA Test No. 040
+# mem leak in pmlogger
+#
+# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
+#
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+# get standard filters
+. ./common.product
+. ./common.filter
+. ./common.check
+
+trap "$sudo rm -f $tmp.*; exit" 0 1 2 3 15
+
+if ps l -p 1 2>/dev/null | sed -e 1q | grep RSS >/dev/null
+then
+ ps_arg=l
+elif ps -l -p 1 2>/dev/null | sed -e 1q | grep RSS >/dev/null
+then
+ ps_arg=-l
+elif ps -o uid,pid,rss,fname -p 1 2>/dev/null | sed -e 1q | grep RSS >/dev/null
+then
+ ps_arg="-o uid,pid,rss,fname"
+else
+ echo "$seq: how do I coerce RSS from your ps?"
+fi
+
+rss_field=`ps $ps_arg -p 1 2>/dev/null | $PCP_AWK_PROG '
+NR == 1 { for (i = 1; i <= NF; i++) {
+ if ($i ~ /RSS/) {
+ print i
+ break
+ }
+ }
+ exit
+ }'`
+
+# real QA test starts here
+
+rm -f $tmp.*
+cat <<End-of-File >$tmp.config
+log mandatory on 5 msec {
+ pmcd.control
+}
+End-of-File
+
+_start_up_pmlogger -c $tmp.config -l $tmp.log -s 3000 $tmp
+mylogger=$pid
+_wait_for_pmlogger $mylogger $tmp.log
+
+seen=0
+for i in 1 2 3 4 5 6 7 8
+do
+sleep 1
+ps $ps_arg -p $mylogger \
+ | $PCP_AWK_PROG '
+NR == 1 { print; next }
+$3 == '$mylogger' { print }'
+done \
+| tee $tmp.out \
+| sed -e '/RSS/d' \
+| $PCP_AWK_PROG '{ print $'$rss_field' }' \
+| LC_COLLATE=POSIX sort \
+| uniq -c \
+| while read cnt sz
+do
+ seen=`expr $seen + 1`
+ # expect one line, with a count of 8 sizes, all the same!
+ if [ $seen -gt 1 -o $cnt -ne 8 ]
+ then
+ echo "Error: pmlogger virtual or resident size grew ... memory leak?"
+ echo " or maybe pmlogger died, or failed to start"
+ echo " pmlogger pid=$mylogger seen=$seen cnt=$cnt"
+ echo
+ echo "ps output ..."
+ cat $tmp.out
+ echo
+ echo "pmlogger log ..."
+ cat $tmp.log
+ exit 1
+ fi
+done
+
+echo "OK"
+
+_wait_pmlogger_end $mylogger
+echo
+echo "pmlogger log"
+_filter_pmlogger_log <$tmp.log
+
+exit 0