Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 933
blob20fb56045819e6b2e6a43da9c3109403568932f5
1 #!/bin/sh
2 # PCP QA Test No. 933
3 # Exercise fix for RH BZ #1372550
5 # Copyright (c) 2016 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 [ $PCP_PLATFORM = linux ] || _notrun "Linux proc PMDA specific test"
18 signal=$PCP_BINADM_DIR/pmsignal
19 status=1 # failure is the default!
20 $sudo rm -rf $tmp $tmp.* $seq.full
21 trap "_cleanup; exit \$status" 0 1 2 3 15
23 _cleanup()
25 if [ -n "$pid" ]
26 then
27 $signal -s TERM $pid
28 wait
29 pid=""
31 cd $here; rm -rf $tmp.*
34 # real QA test starts here
36 # Use the stopped runq metric as its less likely to be
37 # interfered with than some of the other metrics (like
38 # sleeping, runnable, etc) via other system activity.
40 sleep 10 &
41 pid=$!
42 pmsleep 0.1 # some time for sleep process to start
43 base=`pmprobe -v proc.runq.stopped | awk '{ print $3 }'`
45 kill -STOP $pid
46 pmsleep 0.1 # some time for process to stop
47 stop=`pmprobe -v proc.runq.stopped | awk '{ print $3 }'`
49 kill -CONT $pid
50 pmsleep 0.1 # some time for process to continue
51 cont=`pmprobe -v proc.runq.stopped | awk '{ print $3 }'`
53 echo "stopped counts:" > $seq.full
54 echo "base = $base" >> $seq.full
55 echo "stop = $stop" >> $seq.full
56 echo "cont = $cont" >> $seq.full
58 echo Silence is golden
59 # STOP should cause a jump in the number of stopped processes
60 [ $stop -gt $base ] || echo "Unexpected $stop (stop) le $base (base)"
61 # CONT should cause a drop in the number of stopped processes
62 [ $stop -gt $cont ] || echo "Unexpected $stop (stop) le $cont (cont)"
64 # success, all done
65 status=0
66 exit