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
|
#!/bin/sh
# PCP QA Test No. 1295
#
# error checks for sample.dynamic.* config file
#
# Copyright (c) 2021 Ken McDonell. All Rights Reserved.
#
if [ $# -eq 0 ]
then
seq=`basename $0`
echo "QA output created by $seq"
else
# use $seq from caller, unless not set
[ -n "$seq" ] || seq=`basename $0`
echo "QA output created by `basename $0` $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
if [ "$1" = "--valgrind" ]
then
echo "Error: no --valgrind variant here"
exit 1
fi
_cleanup()
{
cd $here
[ -f $control.qa-$seq ] && $sudo mv $control.qa-$seq $control
$sudo rm -rf $tmp $tmp.*
}
control=$PCP_PMDAS_DIR/sample/dynamic.indom
status=0 # success is the default!
$sudo rm -f $control.qa-$seq
trap "_cleanup; exit \$status" 0 1 2 3 15
[ -f $control ] && $sudo mv $control $control.qa-$seq
_filter()
{
sed \
-e '/Log for pmdasample/s/ on .*/ on .../' \
# end
}
# prime the sample PMDA to refresh the dynamic indom
#
pminfo -f sample.dynamic >/dev/null 2>&1
# real QA test starts here
if ! _service pmcd restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmcd || _exit 1
if ! _service pmlogger restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmlogger || _exit 1
# missing instance name (200)
#
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
200
201 two-hundred-and-one
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control
sleep 1
pmprobe -I sample.dynamic.counter sample.dynamic.instant sample.dynamic.discrete
sleep 1
# negative instance identifier (-200)
#
echo
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
-200 two-hundred
201 two-hundred-and-one
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control
sleep 1
pmprobe -I sample.dynamic.counter sample.dynamic.instant sample.dynamic.discrete
sleep 1
# too big an instance identifier (4194304) .. won't fit in 22 bits
#
echo
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
4194304 two-hundred
201 two-hundred-and-one
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control
sleep 1
pmprobe -I sample.dynamic.counter sample.dynamic.instant sample.dynamic.discrete
sleep 1
# and what's in the PMDA log?
#
_filter <$PCP_LOG_DIR/pmcd/sample.log
# success, all done
exit
|