Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 448
blob076e58d55dde0acea29ce7da7bd8393972a73526
1 #!/bin/sh
2 # PCP QA Test No. 448
3 # pmGetConfig exerciser
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=0 # success is the default!
17 $sudo rm -rf $tmp.* $seq.full
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 # real QA test starts here
21 echo "error cases ..."
22 echo "bad variable"
23 src/getconfig NO_SUCH_VAR
24 echo "exit status=$?"
26 echo
27 echo "bad \$PCP_CONF"
28 PCP_CONF=/no/such/file src/getconfig PCP_BIN_DIR
29 echo "exit status=$?"
31 echo
32 echo "bad \$PCP_DIR"
33 PCP_DIR=/no/such/directory src/getconfig PCP_BIN_DIR
34 echo "exit status=$?"
36 if [ ! -r $PCP_DIR/etc/pcp.conf ]
37 then
38 echo "Error: unable to read $PCP_DIR/etc/pcp.conf!"
39 exit 1
42 echo
43 echo "all vars in pcp.conf ... report only errors"
44 sed <$PCP_DIR/etc/pcp.conf \
45 -e '/^#/d' \
46 -e '/^[ ]*$/d' \
47 -e 's/[ ][ ]*"/"/' \
48 -e 's/"[ ][ ]*/"/' \
49 -e 's/"//g' \
50 -e 's/=/ /' \
51 -e 's/\\/<backslash>/g' \
52 | while read var value
54 xvalue=`src/getconfig "$var" | sed -e 's/.* -> //' -e 's/[ ]*$//' -e 's/\\\\/<backslash>/g'`
55 #debug# echo "$var: $value ? $xvalue"
56 if [ "X${value}X" != "X${xvalue}X" ]
57 then
58 echo "$var: expecting \"$value\", got \"$xvalue\""
60 done
62 # success, all done
63 exit