qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 258
blob49d431bee9350fac12884a698b14af8eef96d27d
1 #! /bin/sh
2 # PCP QA Test No. 258
3 # pmdatrace and libpcp_trace reconnect test
5 # Copyright (c) 2015 Red Hat.
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard filters
13 . ./common.product
14 . ./common.check
15 . ./common.filter
17 [ -f $PCP_PMDAS_DIR/trace/pmdatrace ] || _notrun "trace pmda not installed"
19 signal=$PCP_BINADM_DIR/pmsignal
20 status=1
21 LOCALHOST=`hostname`
22 _needclean=true
24 _interrupt()
26 status=1
29 if [ -d $PCP_LOG_DIR/pmlogger ]
30 then
31 LOGGING_DIR=$PCP_LOG_DIR/pmlogger
32 else
33 LOGGING_DIR=$PCP_LOG_DIR
36 _cleanup()
38 cd $here
39 if $_needclean
40 then
41 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
42 && $sudo sh $tmp.cmd
43 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
44 _wait_for_pmcd
45 _wait_for_pmlogger
46 if $install_on_cleanup
47 then
48 ( cd $PCP_PMDAS_DIR/trace; $sudo ./Install </dev/null >/dev/null 2>&1 )
49 else
50 ( cd $PCP_PMDAS_DIR/trace; $sudo ./Remove </dev/null >/dev/null 2>&1 )
52 _needclean=false
54 if [ -n "$savedtracehost" ]
55 then
56 PCP_TRACE_HOST=$savedtracehost; export PCP_TRACE_HOST
58 rm -f $tmp.*
59 exit $status
62 _change_config pmlogger on
63 _change_config pmcd on
65 install_on_cleanup=false
66 pminfo trace >/dev/null 2>&1 && install_on_cleanup=true
68 trap "_cleanup" 0
69 trap "_interrupt; _cleanup" 1 2 3 15
71 if [ -n "$PCP_TRACE_HOST" ]
72 then
73 savedtracehost=$PCP_TRACE_HOST; unset PCP_TRACE_HOST
76 # real QA test starts here
78 cd $PCP_PMDAS_DIR/trace
79 $sudo ./Install -R / </dev/null >/dev/null 2>&1
80 cd $here
82 cd $PCP_DEMOS_DIR/trace
83 $sudo make app2 2>&1 >$tmp.make
84 if [ $? -ne 0 ]
85 then
86 echo app2 programs make failed. Heres the make output ...
87 cat $tmp.make
88 else
89 echo make succeeded.
92 # Allow app2 to reconnect asap
94 PCP_TRACE_RECONNECT=1
95 export PCP_TRACE_RECONNECT
97 ( ( $PCP_DEMOS_DIR/trace/app2 >/dev/null 2>&1 & ) )
98 sleep 3
99 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
100 _wait_for_pmcd
102 # time_sucker transaction sleeps for 10 secs - wait for this
103 sleep 11
104 vals=`pminfo -f trace.transact.count | fgrep 'No value(s) available!' | wc -l`
105 if [ $vals -eq 1 ]
106 then
107 echo "Error: No value(s) available!"
108 else
109 echo "Reconnect succeeded."
110 echo
113 $signal -a -s KILL app2 2>&1 >/dev/null
115 # xcheck observe problem where value of second observation of same tag
116 # gives first calls value.
117 echo
118 echo "=== Checking observed value matches latest call ==="
119 $here/src/obs
120 # these values are deteministic
121 pminfo -f trace.observe.count trace.observe.value
123 # success, all done
124 status=0
125 exit