docs: tweak formatting in pmrep(1) archive folio example
[pcp.git] / qa / 879
blob9af500caa784eb4a6832438a5c44e6167048371b
1 #!/bin/sh
2 # PCP QA Test No. 879
3 # Exercise pmdapipe config file parsing and error handling.
5 # Copyright (c) 2015 Red Hat.
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 [ -f $PCP_PMDAS_DIR/pipe/pmdapipe ] || _notrun "pipe PMDA not installed"
18 status=1 # failure is the default!
19 username=`id -u -n`
20 groupname=`id -g -n`
21 $sudo rm -f $tmp.* $seq.full
22 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
24 _log()
26 echo $@ | tee -a $seq.full
29 _check_config()
31 debug="APPL0,APPL1,APPL2"
32 $PCP_PMDAS_DIR/pipe/pmdapipe -C -c $tmp.config -D $debug >$tmp.log 2>&1
33 sts=$?
34 cat $tmp.log | tee -a $seq.full | sed -e "s,$tmp.config,CONFIG,g"
35 echo "sts=$sts" && echo
38 echo
40 _log "== checking instance name with special characters"
41 echo ';34@#bleurg root /bin/true' > $tmp.config
42 _check_config
44 _log "== checking missing user and command fields"
45 echo 'instance' > $tmp.config
46 _check_config
48 _log "== checking missing command field"
49 echo 'instance user ' > $tmp.config
50 _check_config
52 status=0
53 exit
55 _log "== checking valid access control section"
56 echo 'instance user command and parameters' > $tmp.config
57 echo '[access]' >> $tmp.config
58 echo "allow user $username : instance" >> $tmp.config
59 echo "disallow user $username : instance" >> $tmp.config
60 echo "allow group $groupname : instance" >> $tmp.config
61 echo "disallow group $groupname : instance" >> $tmp.config
62 _check_config
64 # save a copy of goodness to append badness to
65 cp $tmp.config $tmp.valid
67 _log "== checking invalid access control line (no username)"
68 cp $tmp.valid $tmp.config
69 echo "allow user" >> $tmp.config
70 _check_config
72 _log "== checking invalid access control line (no separator)"
73 cp $tmp.valid $tmp.config
74 echo "allow group $groupname " >> $tmp.config
75 _check_config
77 _log "== checking invalid access control line (no instance)"
78 cp $tmp.valid $tmp.config
79 echo "allow group $groupname : " >> $tmp.config
80 _check_config
82 _log "== checking invalid access control line (bad instance)"
83 cp $tmp.valid $tmp.config
84 echo "allow group $groupname : no-such-instance" >> $tmp.config
85 _check_config
87 _log "== checking invalid access control line (bad username)"
88 cp $tmp.valid $tmp.config
89 echo "allow user no-such-user : instance" >> $tmp.config
90 _check_config
92 status=0
93 exit