/var/lib/pcp/testsuite/1243 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 | #!/bin/sh
# PCP QA Test No. 1243
# Exercise shell mechanism in pmDiscoverServices(3).
#
# Copyright (c) 2018 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.discovery
_check_valgrind
_get_libpcp_config
$service_discovery || _notrun "No support for service discovery"
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
hostname=`hostname`
hostip=`_host_to_ipaddr $hostname`
localip=`_host_to_ipaddr localhost`
$sudo rm -rf $tmp $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s,$tmp.discover,DISCOVER_DIR,g" \
-e "s,\[::1\],IP_ADDRESS,g" \
-e "s,$localip,IP_ADDRESS,g" \
-e "s,$hostip,IP_ADDRESS,g" \
#end
}
# real QA test starts here
mkdir -p $tmp.discover
# test script with local addresses
cat >$tmp.discover/localhost.sh <<EOF
#!/bin/sh
echo localhost
echo 127.0.0.1
EOF
chmod 755 $tmp.discover/localhost.sh
# test script with a mix of hostnames
cat >$tmp.discover/hostnames.sh <<EOF
#!/bin/sh
echo $hostname
echo no.such.host
EOF
chmod 755 $tmp.discover/hostnames.sh
# drop-in kubectl so we can see args
cat >$tmp.kubectl.sh <<EOF
#!/bin/sh
echo "\$@" > $tmp.kubectl.args
EOF
chmod 755 $tmp.kubectl.sh
export PCP_KUBECTL_PROG=$tmp.kubectl.sh
echo "== discovery directory" >> $seq.full
find $tmp.discover >> $seq.full
echo "== localhost.sh" >> $seq.full
$tmp.discover/localhost.sh >> $seq.full
echo "== hostnames.sh" >> $seq.full
$tmp.discover/hostnames.sh >> $seq.full
echo "== checking pcp-kube-pods argument handling" | tee -a $seq.full
$PCP_BINADM_DIR/discover/pcp-kube-pods
cat $tmp.kubectl.args | tee -a $seq.full
# handy pmfind debugging option: -Ddiscovery
echo "== checking pmfind results and memory access" | tee -a $seq.full
_run_valgrind pmfind -m shell,path=$tmp.discover,maxThreads=1 -s pmcd \
| _filter
echo "== checking pmfind results and thread locks" | tee -a $seq.full
_run_helgrind pmfind -m shell,path=$tmp.discover,maxThreads=4 -s pmcd \
| _filter
# success, all done
status=0
exit
|