This file is indexed.

/var/lib/pcp/testsuite/651 is in pcp-testsuite 4.0.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#! /bin/sh
# PCP QA Test No. 651
# basic pmproxy functionality
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

[ -x $PCP_BINADM_DIR/pmproxy ] || \
    _notrun "need $PCP_BINADM_DIR/pmproxy"

$sudo rm -f $seq.full

hostname=`_get_fqdn`
[ "$hostname" = "localhost" -o "$hostname" = "localhost.localdomain" ] && \
    _notrun "need sensible setup, not simply hostname => localhost"

echo "hostname=$hostname" >>$here/$seq.full

# for newer versions, we default to local sockets with different
# access controls.  dodge that, and test the usual pmproxy path.
target="-h $hostname"

_filter()
{
    sed \
	-e "s/$hostname/MYHOST/" \
	-e "s/`hostname`/MYHOST/" \
	-e "s/localhost/MYHOST/" \
	-e "s/local:/MYHOST/" \
	-e '/hinv.ncpu/s/ 1 [0-9][0-9]*/ 1 <n>/'
}

signal=$PCP_BINADM_DIR/pmsignal
username=`id -u -n`
status=0	# success is the default!
$sudo rm -rf $tmp.*
trap "_cleanup; exit \$status" 0 1 2 3 15

_cleanup()
{
    $sudo $signal -a pmproxy
    _wait_for_stop
    echo "final pmproxy log ..." >>$here/$seq.full
    cat $tmp.log >>$here/$seq.full
    _restore_auto_restart pmproxy
    $sudo rm -f $tmp.*
}

_wait_for_start()
{
    rm -f $tmp.started
    for i in 1 2 3 4 5
    do
	echo "startup delay i=$i" >>$here/$seq.full
	if pmprobe $target -v sample.long.hundred >$tmp.tmp 2>&1
	then
	    cat $tmp.tmp >>$here/$seq.full
	    sts=`$PCP_AWK_PROG <$tmp.tmp '{print $2}'`
	    echo "sts=$sts" >>$here/$seq.full
	    if [ "$sts" = 1 ]
	    then
		touch $tmp.started
		break
	    fi
	else
	    cat $tmp.tmp >>$here/$seq.full
	fi
	sleep 1
    done
    if [ -f $tmp.started ]
    then
	$PCP_PS_PROG $PCP_PS_ALL_FLAGS \
	| egrep 'PID|pmproxy|pmcd' >>$here/$seq.full
    else
	# NB: may be an expected situation at this stage of the test
	echo "Failed to probe pmproxy" >>$here/$seq.full
	$PCP_PS_PROG $PCP_PS_ALL_FLAGS \
	| egrep 'PID|pmproxy|pmcd' >>$here/$seq.full
	[ -f $tmp.log ] && cat $tmp.log >>$here/$seq.full
    fi
}

_wait_for_stop()
{
    rm -f $tmp.stopped
    for i in 1 2 3 4 5
    do
	echo "shutdown delay i=$i" >>$here/$seq.full
	if pmprobe $target -v sample.long.hundred >>$here/$seq.full 2>&1
	then
	    :
	else
	    touch $tmp.stopped
	    break
	fi
	sleep 1
    done
    if [ -f $tmp.stopped ]
    then
	:
    else
	echo "Failed to stop pmproxy"
	$PCP_PS_PROG $PCP_PS_ALL_FLAGS \
	| egrep 'PID|pmproxy|pmcd'
    fi
}

# real QA test starts here
export PMCD_HOST=localhost
export PMPROXY_HOST=$hostname
export PMPROXY_PORT=44322

_stop_auto_restart pmproxy
$sudo $signal -a pmproxy
_wait_for_stop

proxyargs="-l $tmp.log"
proxyargs="$proxyargs -Dcontext,pdu"
id pcp >/dev/null 2>&1 && proxyargs="$proxyargs -U pcp"

echo "== pmproxy not running ==" | tee -a $here/$seq.full
pmprobe $target -v sample.long.hundred 2>&1 | _filter

echo
echo "== simplest default case ==" | tee -a $here/$seq.full
$sudo $PCP_BINADM_DIR/pmproxy $proxyargs
_wait_for_start

pmprobe $target -v sample.long.hundred 2>&1 | _filter

echo
echo "== simple explicit host case ==" | tee -a $here/$seq.full
pmprobe -v -h localhost hinv.ncpu 2>&1 | _filter

echo
echo "== non-standard PMPROXY_PORT, expect failure ==" | tee -a $here/$seq.full
export PMPROXY_PORT=94322
pmprobe $target -v sample.long.hundred 2>&1 | _filter

$sudo $PCP_BINADM_DIR/pmsignal -a pmproxy
_wait_for_stop
echo "1st pmproxy log ..." >>$here/$seq.full
cat $tmp.log >>$here/$seq.full

echo
echo "== non-standard PMPROXY_PORT, expect success ==" | tee -a $here/$seq.full
$sudo $PCP_BINADM_DIR/pmproxy $proxyargs
_wait_for_start

pmprobe $target -v sample.long.hundred 2>&1 | _filter

unset PMPROXY_PORT
$sudo $PCP_BINADM_DIR/pmsignal -a pmproxy
_wait_for_stop
echo "2nd pmproxy log ..." >>$here/$seq.full
cat $tmp.log >>$here/$seq.full

echo
echo "== restricted interface for connections, expect failure ==" | tee -a $here/$seq.full
$sudo $PCP_BINADM_DIR/pmproxy -i 127.0.0.1 $proxyargs
_wait_for_start

pmprobe $target -v sample.long.hundred 2>&1 | _filter

echo
echo "== restricted interface for connections, expect success ==" | tee -a $here/$seq.full
export PMPROXY_HOST=localhost
pmprobe $target -v sample.long.hundred 2>&1 | _filter

# success, all done
exit