Drop unused condition check
[pcp.git] / qa / 793
blobdc3742d95c821500f9be5bb4d1a5e8dbe34d2ba4
1 #!/bin/sh
2 # PCP QA Test No. 793
3 # pmlogger_check and pmlogger_daily with shell components in the dir field
4 # of the control file
6 # Copyright (c) 2015 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; rm -rf $tmp.*; _cleanup; exit \$status" 0 1 2 3 15
20 signal=$PCP_BINADM_DIR/pmsignal
22 _filter()
24 sed \
25 -e 's/\.\.\.*/[dots]/' \
26 -e "s/$FULLLOCALHOST/LOCALHOST/g" \
27 -e "s/$LOCALHOST/LOCALHOST/g" \
28 -e "s/localhost/LOCALHOST/g" \
29 -e "s/local:/LOCALHOST/g" \
30 -e 's/control:[0-9][0-9]*]/control:LINE]/' \
31 -e 's;/usr/var;/var;g' \
32 -e "s;$tmp;TMP;g" \
33 -e '/Duplicate/d' \
34 -e '/Roll [^ ]*\/NOTICES /d' \
35 -e '/Start new [^ ]*\/NOTICES$/d' \
36 -e '/Restarting/s/process [0-9][0-9]*/process PID/' \
37 -e '/Looking for pmlogger/s/process [0-9][0-9]*/process PID/' \
38 -e '/Terminating pmlogger/s/process [0-9][0-9]*/process PID/' \
39 -e '/^pmlogger \[/{
40 s/\[[0-9][0-9]*/[PID/
41 s/from host .*/from host .../
42 }' \
43 -e '/Latest folio created/s/ [0-9][0-9][0-9][0-9][01][0-9][0-3][0-9]\.[0-5][0-9]\.[0-5][0-9]/ DATE.TIME/' \
44 -e '/^pmlogger -m/s/ [0-9][0-9][0-9][0-9][01][0-9][0-3][0-9]\.[0-5][0-9]\.[0-5][0-9]/ DATE.TIME/' \
45 -e '/^pcp /s/ .*/ .../' \
46 -e '/^PMCD host /s/host .*/host .../' \
47 -e '/^log started /s/started .*/started .../' \
48 -e '/^last log entry /s/entry .*/entry .../' \
49 -e '/^current time /s/time .*/time .../' \
50 -e '/^log size /s/size .*/size .../' \
51 | _filter_cron_scripts
54 _stop_loggers()
56 $sudo $signal -a -s TERM pmlogger
59 _cleanup()
61 echo
62 echo "Cleaning up"
64 _stop_loggers >/dev/null 2>&1
66 cd # get out of tmp directory so we can delete it
67 $sudo rm -rf $tmp
69 $sudo $PCP_BINADM_DIR/pmlogger_check
70 _wait_for_pmlogger
73 _setup()
75 _stop_loggers >/dev/null 2>&1
77 rm -rf $tmp
78 mkdir $tmp
79 qatmp=$tmp
80 export qatmp
83 cat >$tmp.config <<End-of-File
84 log mandatory on 1 sec {
85 hinv.ndisk
86 hinv.ncpu
88 End-of-File
90 # real QA test starts here
92 _setup
94 # control file
96 cat >$tmp/control <<End-of-File
97 \$version=1.1
98 \$A=A
100 # $qatmp from the caller's environment
101 # $A from the control file above
102 LOCALHOSTNAME n n \$qatmp/\$A -c $tmp.config
103 LOCALHOSTNAME n n \$(echo $qatmp/B) -c $tmp.config
104 LOCALHOSTNAME n n "$qatmp/\`echo c | tr '[a-z]' '[A-Z]'\`" -c $tmp.config
105 End-of-File
107 echo "pmlogger_check #1" | tee -a $here/$seq.full
108 $sudo $PCP_BINADM_DIR/pmlogger_check -V -c $tmp/control -l $tmp/log
109 [ -s $tmp/log ] && $sudo cat $tmp/log | tee -a $here/$seq.full | _filter
110 for x in A B C
112 ls $tmp/$x >>$here/$seq.full
113 echo `ls $tmp/$x | grep "\.meta" | wc -l | sed -e 's/ //g'` archives in TMP/$x
114 done
116 sleep 2
117 _stop_loggers >/dev/null 2>&1
119 echo "pmlogger_check #2" | tee -a $here/$seq.full
120 $sudo $PCP_BINADM_DIR/pmlogger_check -V -c $tmp/control -l $tmp/log
121 [ -s $tmp/log ] && $sudo cat $tmp/log | tee -a $here/$seq.full | _filter
122 for x in A B C
124 ls $tmp/$x >>$here/$seq.full
125 echo `ls $tmp/$x | grep "\.meta" | wc -l | sed -e 's/ //g'` archives in TMP/$x
126 done
128 echo
129 echo "pmlogger_daily"
130 $sudo $PCP_BINADM_DIR/pmlogger_daily -V -c $tmp/control -l $tmp/log
131 [ -s $tmp/log ] && $sudo cat $tmp/log | tee -a $here/$seq.full | _filter
132 for x in A B C
134 ls $tmp/$x >>$here/$seq.full
135 echo `ls $tmp/$x | grep "\.meta" | wc -l | sed -e 's/ //g'` archives in TMP/$x
136 done
138 # success, all done
139 status=0
140 exit