summaryrefslogtreecommitdiff
path: root/qa/187
blob: fd67d723cfa3018e6ad2eea9fa46f5c0a48d5fd2 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
#! /bin/sh
# PCP QA Test No. 187
# for bug #327288 - $PCP_RC_DIR/pcp blows away $PCP_TMP_DIR/pmlogger entries
#
# Note ... this will be a "sometimes" failure ... requires special
# combinations of pids such that sort != sort -n and comm gets confused
#  $PCP_RC_DIR/pcp
#
# 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

sts=0
trap "$sudo rm -f $tmp.*; exit \$sts" 0 1 2 3 15
signal=$PCP_BINADM_DIR/pmsignal

rm -f $seq.full

_burn_pids()
{
    # burn off 1024 pids
    #
    for i in 1 2 3 4 5 6 7 8
    do
	for j in 1 2 3 4 5 6 7 8
	do
	    for k in 1 2 3 4 5 6 7 8
	    do
		for l in 1 2
		do
		    true
		done
	    done
	done
    done
}

_check()
{
    ( echo "this" $this_pid;
      echo "other" $other_pid;
      echo "other-fqdn" $otherfqdn_pid; ) \
    | while read tag pid
    do
	$PCP_ECHO_PROG $PCP_ECHO_N "map file for $tag host""$PCP_ECHO_C"
	if [ -f $PCP_TMP_DIR/pmlogger/$pid ]
	then
	    $PCP_ECHO_PROG " present"
	else
	    $PCP_ECHO_PROG $PCP_ECHO_N " missing ... ""$PCP_ECHO_C"

	    if [ "$tag" = this ]
	    then
		$PCP_ECHO_PROG "expected for this host when PMCD killed"
	    else
		$PCP_ECHO_PROG "NOT EXPECTED"
		echo "pid=$pid, $PCP_TMP_DIR/pmlogger contains"
		ls -l $PCP_TMP_DIR/pmlogger
		echo "pmlogger processes ..."
		ps $PCP_PS_ALL_FLAGS | grep pmlogger
		echo "pmlogger log file for missing one ..."
		cat $tmp.$pid
	    fi
	fi
    done
}

otherhost=`./getpmcdhosts -L -n 1`
[ -z "$otherhost" ] && _notrun "Cannot find a remote host running pmcd"
echo "otherhost=$otherhost" >>$seq.full
otherip=`_host_to_ipaddr $otherhost`
if [ -z "$otherip" ]
then
    echo "Arrgh ... cannot get IP addr for otherhost=$otherhost"
    sts=1
    exit
fi
echo "otherip=$otherip" >>$seq.full

# real QA test starts here
_start_up_pmlogger -L -c /dev/null -l $tmp.log1 -s1 $tmp.this >/dev/null 2>&1
this_pid=$pid
echo "this logger pid=$this_pid" >>$seq.full
_wait_for_pmlogger $this_pid $tmp.log1
$sudo mv $tmp.log1 $tmp.$this_pid

trap "$signal $this_pid $other_pid $otherfqdn_pid >/dev/null 2>&1; wait; $sudo rm -fr $tmp.*; exit \$sts" 0 1 2 3 15

_burn_pids

_start_up_pmlogger -h $otherhost -L -c /dev/null -l $tmp.log2 -s1 $tmp.other >/dev/null 2>&1
other_pid=$pid
echo "other host=$otherhost logger pid=$other_pid" >>$seq.full
_wait_for_pmlogger $other_pid $tmp.log2
$sudo mv $tmp.log2 $tmp.$other_pid

_burn_pids

_start_up_pmlogger -h $otherip -L -c /dev/null -l $tmp.log3 -s1 $tmp.other.fqdn >/dev/null 2>&1
otherfqdn_pid=$pid
echo "other fqdnhost=$otherip logger pid=$otherfqdn_pid" >>$seq.full
_wait_for_pmlogger $otherfqdn_pid $tmp.log3
$sudo mv $tmp.log3 $tmp.$otherfqdn_pid

# check entries
_check

$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger

# check again
_check

echo >>$seq.full
echo "=== this log ===" >>$seq.full
cat $tmp.$this_pid >>$seq.full


echo >>$seq.full
echo "=== other log ===" >>$seq.full
cat $tmp.$other_pid >>$seq.full


echo >>$seq.full
echo "=== otherfqdn log ===" >>$seq.full
cat $tmp.$otherfqdn_pid >>$seq.full