#! /bin/sh
# PCP QA Test No. 363
# checks pmlogsummary error reporting
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter

rm -f $seq.out
if [ $PCP_VER -lt 3600 ]
then
    # V1 archives supported
    arch=src/ace
    ln $seq.out.1 $seq.out
else
    # no support for V1 archives
    arch=src/ace_v2
    ln $seq.out.2 $seq.out
fi

status=1	# failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

# strip marks from archives
src/stripmark src/changeinst.0 $tmp.changeinst.0 > /dev/null 2>&1
cp src/changeinst.index $tmp.changeinst.index
cp src/changeinst.meta $tmp.changeinst.meta

# deal with an annoying libc error ... using TZ=:Australia/Melbourne
# causes the -z option to report the wrong time, at least for some
# times of the year
#
TZ=EST-10
export TZ

# real QA test starts here
echo
echo "=== Sanity checks ==="
pmlogsummary -z -n src/root_irix -bmMy $arch \
     | LC_COLLATE=POSIX sort -f | ./xlate_2_new_pmns
echo
echo "=== Down-rev error check ==="
pmlogsummary -v -z -n src/root_irix -a src/err_v1
echo
echo "=== Changing inst check ==="
pmlogsummary -z -a $tmp.changeinst
echo
echo "=== Bogus archive check ==="

_filter()
{
    sed -e 's/sample.*colour .*none/sample.colour (masked out)/g' \
	-e 's/pmcd.pmlogger.port .* none/pmcd.pmlogger.port [PID] PORT none/g' \
	-e 's/  1.001 none/  1.000 none/g'
	# sample[dso].milliseconds is a fickle mistress
}

pmlogsummary src/truncbin | _filter
pmlogsummary src/null


# success, all done
status=0
exit
