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
|
#!/bin/sh
# PCP QA Test No. 1233
# name(attr) = string testing for derived metrics - error cases
#
# Copyright (c) 2020 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
if [ $# -eq 0 ]
then
echo "QA output created by $seq"
else
echo "QA output created by $seq $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
if [ "$1" = "--valgrind" ]
then
_check_valgrind
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s;$tmp;TMP;g" \
# end
}
# real QA test starts here
cat <<End-of-File >$tmp.config.1
# missing <name>
( = "foo"
(oneline = "foo"
(oneline)="foo"
# missing )
qa( = "foo"
qa.a(oneline="foo"
# missing ( => illegal metric name
) = "bar"
qa)= "bar"
qa.a) ="bar"
# missing <attr>
qa.seconds = sample.milliseconds / 1000
qa.seconds()="foo"
qa.seconds () = "foo"
qa.seconds ( ) = "foo"
# missing <value>
qa.seconds(oneline)=
# illegal <attr>
qa.seconds(foo) = bar;
# bad metric
qa.notdefined.yet ( foo ) = bar;
# terminated value ... check to see if line number is updated correctly
# for next error
qa.seconds(helptext) = 'foo
bar
fratz'
# next line is line number
qa.seconds(oneline) = "expect this error to be at line number ...
37
was it?
End-of-File
cat <<End-of-File >$tmp.config.2
qa.seconds = sample.milliseconds / 1000
qa.seconds(oneline) = "a string with extra text after the quote"extra stuff oneline
qa.seconds(helptext) = 'a block
with extra
text after
the quote'extra stuff helptext
End-of-File
for config in $tmp.config.*
do
echo
echo "=== `echo $config | sed -e 's;.*config\.;config.;'` ==="
PCP_DERIVED_CONFIG=$config; export PCP_DERIVED_CONFIG
if [ "$1" = "--valgrind" ]
then
_run_valgrind `which pminfo` -dtT -Dderive qa | _filter
else
pminfo -dtT -Dderive qa 2>&1 \
| _filter
fi
done
# success, all done
status=0
exit
|