/var/lib/pcp/testsuite/390 is in pcp-testsuite 3.8.12ubuntu1.
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 | #! /bin/sh
# PCP QA Test No. 390
# Test out the proc agents handling of
# mapping external instance names to internal instance names (pids).
# It was truncating the first number.
# i.e. if one does a "pmval -i "12345678" proc.psinfo.pid
# it might return a value of "12345" on a 6.2 system
#
# This was written when qa/044 failed because it looked
# for what it thought was an impossible instance id but
# it wasn't because it was truncated.
#
# Copyright (c) 2013 Red Hat.
# 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
pminfo proc.nprocs >/dev/null 2>&1 || _notrun "proc PMDA not installed"
# see if unix domain sockets are available (permissions)
unix_domain_sockets=false
eval `pmconfig -L 2>/dev/null`
target="-h localhost"
$unix_domain_sockets && target="-h unix:"
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
#debug=true
debug=false
host=`hostname`
_filter()
{
sed \
-e 's/host: unix:/host: localhost/g' \
-e "s/host: $host/host: localhost/g" \
-e "s/0*$mypid/PID/" -e 's/^[ \t]*//'
}
# real QA test starts here
mypid=$$
$debug && echo "mypid = $mypid"
pid_len=`ls /proc | head -1 | wc -c`
pid_len=`expr $pid_len - 1`
$debug && echo "pid_len = $pid_len"
mypid_len=`echo $mypid | wc -c`
mypid_len=`expr $mypid_len - 1`
$debug && echo "mypid_len = $mypid_len"
gap=`expr $pid_len - $mypid_len`
$debug && echo "gap = $gap"
# create a zeroes string for the leading zeroes
# to fill up a pid as seen in /proc
zeroes=""
i=0
while [ $i -lt $gap ]
do
zeroes="0$zeroes"
i=`expr $i + 1`
done
# should all succeed
args="$target -w 30 -s1"
pmval $args -i "$mypid" proc.psinfo.pid | _filter
pmval $args -i "${zeroes}$mypid" proc.psinfo.pid | _filter
pmval $args -i "${zeroes}${mypid}hi" proc.psinfo.pid | _filter
# should now fail - passed previously
pmval $args -i "${zeroes}${mypid}12345" proc.psinfo.pid | _filter
# success, all done
status=0
exit
|