zsh completions: minor tweaks
[pcp.git] / qa / 879
blobdc1329d95cc90df4d5ab3f42e0bc4b2e1a4e7e9e
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 _filter()
31 sed \
32 -e "s,$tmp.config,CONFIG,g" \
33 -e "s,$groupname,NAME,g" \
34 -e "s,$username,NAME,g" \
35 #end
38 _check_config()
40 debug="APPL0,APPL1,APPL2"
41 $PCP_PMDAS_DIR/pipe/pmdapipe -C -c $tmp.config -D $debug >$tmp.log 2>&1
42 sts=$?
43 cat $tmp.log | tee -a $seq.full | _filter
44 echo "sts=$sts" && echo
47 echo
49 _log "== checking instance name with special characters"
50 echo ';34@#bleurg root /bin/true' > $tmp.config
51 _check_config
53 _log "== checking missing user and command fields"
54 echo 'instance' > $tmp.config
55 _check_config
57 _log "== checking missing command field"
58 echo 'instance user ' > $tmp.config
59 _check_config
61 _log "== checking valid access control section"
62 echo 'instance user command and parameters' > $tmp.config
63 echo '[access]' >> $tmp.config
64 echo "allow user $username : instance" >> $tmp.config
65 echo "disallow user $username : instance" >> $tmp.config
66 echo "allow group $groupname : instance" >> $tmp.config
67 echo "disallow group $groupname : instance" >> $tmp.config
68 _check_config
70 # save a copy of goodness to append badness to
71 cp $tmp.config $tmp.valid
73 _log "== checking invalid access control line (no username)"
74 cp $tmp.valid $tmp.config
75 echo "allow user" >> $tmp.config
76 _check_config
78 _log "== checking invalid access control line (no separator)"
79 cp $tmp.valid $tmp.config
80 echo "allow group $groupname " >> $tmp.config
81 _check_config
83 _log "== checking invalid access control line (no instance)"
84 cp $tmp.valid $tmp.config
85 echo "allow group $groupname : " >> $tmp.config
86 _check_config
88 status=0
89 exit