#!/bin/sh
# PCP QA Test No. 1820
# Exercise memory allocation bug 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!
$sudo rm -rf $tmp $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15

# real QA test starts here
export PCP_HOSTZONE=1
export PCP_ARCHIVE=$here/archives/pcp-atop-log
$PCP_BINADM_DIR/pcp-atopsar -x -R 5 2 10

# success, all done
status=0
exit
