Drop unused condition check
[pcp.git] / qa / 524
blob7d69efbe74da7aef0b4be03e70f8efa0804c4ca1
1 #!/bin/sh
2 # PCP QA Test No. 524
3 # pmlogger silently exits when started in a directory that is
4 # not writeable
6 # Copyright (c) 2013 Ken McDonell. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 status=1 # failure is the default!
18 $sudo rm -rf $tmp.* $seq.full
19 trap "cd $here; chmod 755 $tmp.home; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
21 # _check log archive
23 _check()
25 if [ -f $1 ]
26 then
27 _filter_pmlogger_log <$1
28 else
29 echo "Error: no pmlogger.log created"
32 if [ -f $2.0 -a -f $2.meta ]
33 then
34 pmdumplog $2 sampledso.colour \
35 | _filter_pmdumplog \
36 | sed -e '/green/s/[0-9][0-9]*$/NUMBER/'
37 else
38 echo "Error: no TEST archive created"
41 for type in out err
43 if [ -f $tmp.$type ]
44 then
45 if [ -s $tmp.$type ]
46 then
47 echo "std$type contains ..."
48 _filter_pmlogger_log <$tmp.$type
49 else
50 echo "std$type is empty"
52 else
53 echo "Error: std$type not created!"
55 done
58 mkdir $tmp.home
59 cat >$tmp.home/config <<End-of-File
60 log mandatory on 1 sec {
61 sampledso.colour["green"]
63 End-of-File
65 # real QA test starts here
66 cd $tmp.home
67 echo "default case ... should work"
68 rm -f $tmp.out $tmp.err
69 $PCP_BINADM_DIR/pmlogger -s 2 -c ./config -l ./pmlogger.log ./TEST >$tmp.out 2>$tmp.err
70 _check ./pmlogger.log ./TEST
72 echo
73 echo "make current directory non-writeable and try again"
74 rm -f TEST.* pmlogger.log
75 rm -f $tmp.out $tmp.err
76 chmod 555 .
77 $PCP_BINADM_DIR/pmlogger -s 2 -c ./config -l ./pmlogger.log ./TEST >$tmp.out 2>$tmp.err
78 _check ./pmlogger.log ./TEST
80 echo
81 echo "now try with log somewhere writeable"
82 rm -f TEST.* $tmp.log
83 rm -f $tmp.out $tmp.err
84 chmod 555 .
85 $PCP_BINADM_DIR/pmlogger -s 2 -c ./config -l $tmp.log ./TEST >$tmp.out 2>$tmp.err
86 _check $tmp.log ./TEST
88 echo
89 echo "and finally with the archive somewhere writeable"
90 rm -f $tmp.TEST.* pmlogger.log
91 rm -f $tmp.out $tmp.err
92 chmod 555 .
93 $PCP_BINADM_DIR/pmlogger -s 2 -c ./config -l ./pmlogger.log $tmp.TEST >$tmp.out 2>$tmp.err
94 _check ./pmlogger.log $tmp.TEST
96 # success, all done
97 status=0
99 exit