3 # Exercise pmdapipe config file parsing and error handling.
5 # Copyright (c) 2015 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 [ -f $PCP_PMDAS_DIR/pipe
/pmdapipe
] || _notrun
"pipe PMDA not installed"
18 status
=1 # failure is the default!
21 $sudo rm -f $tmp.
* $seq.full
22 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
26 echo $@ |
tee -a $seq.full
31 debug
="APPL0,APPL1,APPL2"
32 $PCP_PMDAS_DIR/pipe
/pmdapipe
-C -c $tmp.config
-D $debug >$tmp.log
2>&1
34 cat $tmp.log |
tee -a $seq.full |
sed -e "s,$tmp.config,CONFIG,g"
35 echo "sts=$sts" && echo
40 _log
"== checking instance name with special characters"
41 echo ';34@#bleurg root /bin/true' > $tmp.config
44 _log
"== checking missing user and command fields"
45 echo 'instance' > $tmp.config
48 _log
"== checking missing command field"
49 echo 'instance user ' > $tmp.config
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
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
72 _log
"== checking invalid access control line (no separator)"
73 cp $tmp.valid
$tmp.config
74 echo "allow group $groupname " >> $tmp.config
77 _log
"== checking invalid access control line (no instance)"
78 cp $tmp.valid
$tmp.config
79 echo "allow group $groupname : " >> $tmp.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
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