/var/lib/pcp/testsuite/1137 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 | #!/bin/sh
# PCP QA Test No. 1137
# Check new cpu-util.conf derived metrics
#
# Copyright (c) 2017 Red Hat. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
. ./common.python
$python -c "from pcp import pmapi" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python pcp pmapi module not installed"
$python -c "from collections import OrderedDict" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python collections OrderedDict module not installed"
# Note: set PCP_DERIVED_CONFIG explicitly for this test to
# ensure the availability of derived metrics being tested.
config=$PCP_VAR_DIR/config/derived/cpu-util.conf
[ ! -f $config ] && _notrun missing $config
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0
$sudo rm -rf $tmp $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15
# real QA test starts here
N=`pmprobe -v hinv.ncpu | awk '{print $NF}'`
for m in user nice sys idle intr steal
do
echo checking kernel.all.cpu.$m against derived utilization kernel.cpu.util.$m | tee -a $here/$seq.full
# kernel.all.cpu.util.X is ms/s and kernel.cpu.util.X is the average %util over all CPUs for mode X.
# So kernel.all.cpu.util.X should be about the same as kernel.cpu.util.X * (1000 / 100) * Ncpus.
# Subtract them and check they're equal within a reasonable tolerance
# (+/- 5%)
#
PCP_DERIVED_CONFIG=$config pmrep -t 1 -s 2 kernel.all.cpu.$m kernel.cpu.util.$m 2>$tmp.err >$tmp.out &
# do some work
#
src/chain 3 50000
wait
cat $tmp.err
cat $tmp.out \
| tee -a $here/$seq.full \
| $PCP_AWK_PROG '
BEGIN { tol_pct = 5 }
$1 !~ /^[0-9][0-9.]*$/ { next }
$2 !~ /^[0-9][0-9.]*$/ { next }
{ x = $1 - ($2 * 10 * '$N')
if ($1 != 0)
x = 100.0 * x / $1
if (x > tol_pct || x < -tol_pct)
print "FAIL " $1 " ? (" $2 "10 * '$N') = " x "%"
else
print "PASS"
}'
done
exit
|