1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#! /bin/sh
# PCP QA Test No. 564
# exercise archive compression thru pmlogger_daily
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
# check-group-include: pmlogextract
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
NEEDREWRITE=$PCP_LOG_DIR/pmlogger/.NeedRewrite
_cleanup()
{
[ -d $tmp.distdir ] && rm -fr $tmp.distdir
[ -d $tmp.relaydir ] && rm -fr $tmp.relaydir
$sudo rm -f $tmp.*
[ -f $NEEDREWRITE.$seq ] && $sudo mv $NEEDREWRITE.$seq $NEEDREWRITE
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
[ -f $NEEDREWRITE ] && $sudo mv $NEEDREWRITE $NEEDREWRITE.$seq
# create test control file, directories and populate with dummy archives
cat >$tmp.ctl<<EOF
\$version=1.1
#Host P? S? directory args
dist.engr n n $tmp.distdir -c config.default
relay.engr n n $tmp.relaydir -c config.default
EOF
mkdir -p $tmp.distdir $tmp.relaydir
# some archives for today...
TODAY=`pmdate %Y%m%d`
cp $tmp.ctl $tmp.distdir/$TODAY.0
cp $tmp.ctl $tmp.distdir/$TODAY.meta
cp $tmp.ctl $tmp.distdir/$TODAY.index
cp $tmp.ctl $tmp.relaydir/$TODAY.0
cp $tmp.ctl $tmp.relaydir/$TODAY.meta
cp $tmp.ctl $tmp.relaydir/$TODAY.index
# some archives for a five days ago...
FIVEDAYS=`pmdate -5d %Y%m%d`
cp $tmp.ctl $tmp.distdir/$FIVEDAYS.0
cp $tmp.ctl $tmp.distdir/$FIVEDAYS.meta
cp $tmp.ctl $tmp.distdir/$FIVEDAYS.index
cp $tmp.ctl $tmp.relaydir/$FIVEDAYS.0
cp $tmp.ctl $tmp.relaydir/$FIVEDAYS.1
cp $tmp.ctl $tmp.relaydir/$FIVEDAYS.meta
cp $tmp.ctl $tmp.relaydir/$FIVEDAYS.index
cp $tmp.ctl $tmp.relaydir/mumble
cp $tmp.ctl $tmp.relaydir/mumble.0
STAMP=`pmdate -5d %Y%m%d`0010
touch -t "$STAMP" $tmp.*/$FIVEDAYS.* $tmp.relaydir/mumble*
# some archives for five months ago...
FIVEMONTHS=`pmdate -5m %Y%m%d`
cp $tmp.ctl $tmp.distdir/$FIVEMONTHS.0
cp $tmp.ctl $tmp.distdir/$FIVEMONTHS.meta
cp $tmp.ctl $tmp.distdir/$FIVEMONTHS.index
cp $tmp.ctl $tmp.relaydir/$FIVEMONTHS.0
cp $tmp.ctl $tmp.relaydir/$FIVEMONTHS.meta
cp $tmp.ctl $tmp.relaydir/$FIVEMONTHS.index
STAMP=`pmdate -5m %Y%m%d`0010
touch -t "$STAMP" $tmp.*/$FIVEMONTHS.*
# real QA test starts here
$sudo $PCP_BINADM_DIR/pmlogger_daily -P -V -N -x 3 -X bzip2 -c $tmp.ctl 2>&1 | \
sed \
-e '/date-and-timestamp/d' \
-e '/^Roll .*\/NOTICES/d' \
-e '/^Start .*\/NOTICES/d' \
-e '/^Start \[/s/ 2[0-9:. -]*/ DATESTAMP/' \
-e '/^End \[/s/ 2[0-9:. -]*/ DATESTAMP /' \
-e '/^Add merge callback for: pmlogger_daily_report/d' \
-e '/^+ mv .*\/NOTICES/d' \
-e '/^+ touch .*\/NOTICES/d' \
-e "s/$TODAY/TODAY/g" \
-e "s/$FIVEDAYS/FIVEDAYS/g" \
-e "s/$FIVEMONTHS/FIVEMONTHS/g" \
-e "s/$seq-$$/SEQ-PID/g" \
-e '/Warning: no archives found to merge/d' \
-e "s;/private/;/;g" \
-e "s,$PCP_TMP_DIR,TMP,g" \
-e "s,/var/tmp,TMP,g" \
-e "s,/tmp,TMP,g" \
-e '/+ ln /d' \
# end
# success, all done
status=0
exit
|