summaryrefslogtreecommitdiff
path: root/qa/258
blob: 47ac3bbaf2a1ff177502db19699a406f9aab6ca5 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#! /bin/sh
# PCP QA Test No. 258
# pmdatrace and libpcp_trace reconnect test
#
# 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.check
. ./common.filter

signal=$PCP_BINADM_DIR/pmsignal
status=1
LOCALHOST=`hostname`
_needclean=true

_interrupt()
{
    status=1
}

if [ -d $PCP_LOG_DIR/pmlogger ]
then
    LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
    LOGGING_DIR=$PCP_LOG_DIR
fi

_cleanup()
{
    cd $here
    if $_needclean
    then
	pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
	&& $sudo sh $tmp.cmd
	$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
	_wait_for_pmcd
	_wait_for_pmlogger
	if $install_on_cleanup
	then
	    ( cd $PCP_PMDAS_DIR/trace; $sudo ./Install </dev/null >/dev/null 2>&1 )
	else
	    ( cd $PCP_PMDAS_DIR/trace; $sudo ./Remove </dev/null >/dev/null 2>&1 )
	fi
	_needclean=false
    fi
    if [ -n "$savedtracehost" ]
    then
	PCP_TRACE_HOST=$savedtracehost; export PCP_TRACE_HOST
    fi
    rm -f $tmp.*
    exit $status
}

_change_config pmlogger on
_change_config pmcd on

install_on_cleanup=false
pminfo trace >/dev/null 2>&1 && install_on_cleanup=true

trap "_cleanup" 0
trap "_interrupt; _cleanup" 1 2 3 15

if [ -n "$PCP_TRACE_HOST" ]
then
    savedtracehost=$PCP_TRACE_HOST; unset PCP_TRACE_HOST
fi

# real QA test starts here

cd $PCP_PMDAS_DIR/trace
$sudo ./Install -R / </dev/null >/dev/null 2>&1
cd $here

cd $PCP_DEMOS_DIR/trace
$sudo make app2 2>&1 >$tmp.make
if [ $? -ne 0 ]
then
    echo app2 programs make failed.  Heres the make output ...
    cat $tmp.make
else
    echo make succeeded.
fi

# Allow app2 to reconnect asap
#
PCP_TRACE_RECONNECT=1
export PCP_TRACE_RECONNECT

( ( $PCP_DEMOS_DIR/trace/app2 >/dev/null 2>&1 & ) )
sleep 3
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd

# time_sucker transaction sleeps for 10 secs - wait for this
sleep 11
vals=`pminfo -f trace.transact.count | fgrep 'No value(s) available!' | wc -l`
if [ $vals -eq 1 ]
then
    echo "Error: No value(s) available!"
else
    echo "Reconnect succeeded."
echo
fi

$signal -a -s KILL app2 2>&1 >/dev/null

# xcheck observe problem where value of second observation of same tag
# gives first calls value.
echo
echo "=== Checking observed value matches latest call ==="
$here/src/obs
# these values are deteministic
pminfo -f trace.observe.count trace.observe.value

# success, all done
status=0
exit