/var/lib/pcp/testsuite/761 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 | #!/bin/sh
# PCP QA Test No. 761
# Exercise the PMCD privileged co-process (root) PMDA
# Install, Remove and handling of different container
# engines container.* metrics.
#
# Copyright (c) 2014-2015 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
case "$PCP_PLATFORM"
in
linux)
;;
*)
_notrun "No container support for PCP_PLATFORM $PCP_PLATFORM"
# NOTREACHED
;;
esac
_get_libpcp_config
$unix_domain_sockets || _notrun "No unix domain socket support available"
root=$tmp.root
status=1 # failure is the default!
$sudo rm -rf $tmp.* $seq.full
root_cleanup()
{
cd $here
[ -d $root ] && sudo rm -fr $root
[ -f $tmp.conf.backup ] && sudo cp $tmp.conf.backup $PCP_DIR/etc/pcp.conf
_restore_pmda_install root
rm -f $tmp.*
}
# do metrics one at a time, map all internal instance ids to N and sort
# instance lines
#
_check()
{
pminfo containers | LC_COLLATE=POSIX sort \
| while read metric
do
pminfo -f $metric >$tmp.tmp
grep -v ' inst \[' $tmp.tmp
sed -n -e '/inst \[/s/\[[0-9][0-9]*/[N/p' $tmp.tmp \
| LC_COLLATE=POSIX sort
done
}
_prepare_pmda root containers
trap "root_cleanup; exit \$status" 0 1 2 3 15
# backup main PCP config
cp $PCP_DIR/etc/pcp.conf $tmp.conf
cp $PCP_DIR/etc/pcp.conf $tmp.conf.backup
# simple testing script for LXC containers
cat >$tmp.test-lxc-info.sh <<EOF
#!/bin/bash
name="\$2"
test -d "\$PCP_LXC_DIR/\$name" || exit 0
echo "Name: \$name"
echo "State: RUNNING"
echo "PID: 17297"
echo "CPU use: 1.13 seconds"
EOF
chmod 755 $tmp.test-lxc-info.sh
export PCP_LXC_DIR=$root/var/lib/lxc
# real QA test starts here
_service pmcd stop | _filter_pcp_stop
echo >> $tmp.conf
echo "# from QA $seq ..." >> $tmp.conf
echo PCP_LXC_DIR=$root/var/lib/lxc >> $tmp.conf
echo PCP_LXC_INFO=$tmp.test-lxc-info.sh >> $tmp.conf
echo PCP_DOCKER_DIR=$root/var/lib/docker >> $tmp.conf
echo PCP_SYSTEMD_CGROUP=/tmp >> $tmp.conf
$sudo cp $tmp.conf $PCP_DIR/etc/pcp.conf
_service pcp restart | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
echo "=== Checking empty containers configuration, no values"
pmprobe -v containers | LC_COLLATE=POSIX sort
echo "== done" && echo
tarballs=`echo $here/linux/containers-*.tgz | LC_COLLATE=POSIX sort`
for tgz in $tarballs
do
$sudo rm -fr $root
mkdir $root || _fail "root in use when processing $tgz"
cd $root
$sudo tar xzf $tgz
base=`basename $tgz`
echo "== Checking values for active containers"
_check
echo && echo "== done" && echo
cd $here
done
# success, all done
status=0
exit
|