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
|
#!/bin/sh
# PCP QA Test No. 1820
# Exercise memory allocation and time window bugs in pcp-atopsar(1).
#
# Copyright (c) 2020 Red Hat. All Rights Reserved.
#
seq=`basename $0`
if [ $# -eq 0 ]
then
echo "QA output created by $seq"
else
echo "QA output created by $seq $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
[ -f $PCP_BINADM_DIR/pcp-atopsar ] || _notrun "system monitoring tools not installed"
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
hostname=`hostname`
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e 's;^ *[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]$;DATESTAMP;g' \
-e '/initial metric value(s)/d' \
#end
}
# real QA test starts here
PCP_HOSTZONE=1; export PCP_HOSTZONE
PCP_ARCHIVE=$here/archives/pcp-atop-log; export PCP_ARCHIVE
echo && echo "=== Check memory allocation issue:"
$PCP_BINADM_DIR/pcp-atopsar -x -R 5 2 10 | _filter
echo && echo "=== Check time window issue:"
$PCP_BINADM_DIR/pcp-atopsar -x -b 16:14:29 -e 16:14:33 1 | _filter
echo && echo "=== Argument handling issue:"
PCP_ARCHIVE_DIR=$tmp.archives; export PCP_ARCHIVE_DIR
mkdir -p "$PCP_ARCHIVE_DIR/$hostname"
cp $PCP_ARCHIVE.* "$PCP_ARCHIVE_DIR/$hostname"
unset PCP_HOSTZONE PCP_ARCHIVE
pcp -z atopsar >$tmp.noargs 2>&1
pcp -z atopsar -H >$tmp.-H-arg 2>&1
diff $tmp.noargs $tmp.-H-arg >/dev/null
if [ $? -eq 0 ]
then
echo Passed - same output detected
cat $tmp.noargs | _filter
else
echo Bad, expected matching output
echo === noargs:
cat $tmp.noargs
echo === -H-arg:
cat $tmp.-H-arg
fi
# success, all done
status=0
exit
|