File: 398

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (114 lines) | stat: -rwxr-xr-x 2,754 bytes parent folder | download
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
#! /bin/sh
# PCP QA Test No. 398
# checks pmcd handling empty $PCP_PMCDCONF_PATH
#
# 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

status=1	# failure is the default!
signal=$PCP_BINADM_DIR/pmsignal

_terminate()
{
    if [ -n "$pid" ]
    then
	$signal -s TERM $pid
	pid=""
	wait
    fi
}

_cleanup()
{
    _terminate
    _restore_config $PCP_PMCDCONF_PATH
    _restore_config $PCP_PMCDOPTIONS_PATH
    _service pmcd restart 2>&1 | _filter_pcp_restart
    _wait_for_pmcd
    _service pmlogger restart 2>&1 | _filter_pcp_restart
    _wait_for_pmlogger
    $sudo rm -f $tmp.*
}

_check()
{
    # try to provoke a core
    pminfo -v hinv >/dev/null 2>&1
    pmsleep 2.5

    $sudo touch $PCP_PMCDLOG_PATH
    grep -i "dumping to core" $PCP_PMCDLOG_PATH
    sts=$?
    if [ "`echo $PCP_LOG_DIR/core*`" != "$PCP_LOG_DIR/core*" -o "`echo $PCP_LOG_DIR/pmcd/core*`" != "$PCP_LOG_DIR/pmcd/core*" -o $sts -eq 0 ]
    then
	echo "=== core found or logfile claims dumping to core! ==="
	echo '=== Here is $PCP_PMCDLOG_PATH ==='
	cat $PCP_PMCDLOG_PATH
	exit
    else
	echo '--- No core file at $PCP_LOG_DIR/core or $PCP_LOG_DIR/pmcd/core ---'
    fi
}

trap "_cleanup; exit \$status" 0 1 2 3 15

# real QA test starts here
_save_config $PCP_PMCDOPTIONS_PATH
echo "# pmcd.options installed by PCP QA test $seq" >$tmp.options
echo PMCD_WAIT_TIMEOUT=10 >> $tmp.options
echo PMCD_CONNECT_TIMEOUT=10 >> $tmp.options
echo PMCD_REQUEST_TIMEOUT=10 >> $tmp.options
$sudo cp $tmp.options $PCP_PMCDOPTIONS_PATH

# terminate any pmcds and get rid of core file to get to a sane starting place
if ! _service pmlogger stop 2>&1; then _exit 1; fi \
| _filter_pcp_stop
_wait_pmlogger_end || _exit 1
if ! _service pmcd stop 2>&1; then _exit 1; fi \
| _filter_pcp_stop
_wait_pmcd_end || _exit 1
$sudo rm -f $PCP_LOG_DIR/core* $PCP_LOG_DIR/pmcd/core* $PCP_PMCDLOG_PATH

_check

# empty pmcd.conf
_save_config $PCP_PMCDCONF_PATH
$sudo cp /dev/null $PCP_PMCDCONF_PATH

# should be empty
echo "--- pmcd.conf contents follow ---"
cat $PCP_PMCDCONF_PATH
# Note: need to use $PCP_RC_DIR/* here, not _service pmcd and
# _service pmlogger so that systemd does not get a chance to have
# a look in and syphon off our (expected) error messages.
#
( $sudo $PCP_RC_DIR/pmcd restart; $sudo $PCP_RC_DIR/pmlogger restart ) \
	> $tmp.out 2>&1 &
pid=$!

echo "Waiting for PMCD ..."
pmcd_wait -t 5sec
if [ $? -ne 2 ]
then
    echo "Expected timeout - got status $? from pmcd_wait!"
else
    echo "Connection timed out as expected"
fi

echo "Checking for core file ..."
_check

_terminate
cat $tmp.out >> $seq_full

# success, all done
status=0
exit