#! /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

# use V2 archives only
arch=archives/ace_v2

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

# strip marks from archives
src/stripmark archives/changeinst.0 $tmp.changeinst.0 > /dev/null 2>&1
cp archives/changeinst.index $tmp.changeinst.index
cp archives/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 badarchives/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 '/^pmcd\.seqnum/s/[0-9][0-9.]*/SEQNUM/' \
	-e '/^pmcd\.pid/s/[0-9][0-9.]*/PID/' \
	-e 's/  1.001 none/  1.000 none/g'
	# sample[dso].milliseconds is a fickle mistress
}

pmlogsummary tmparch/truncbin | _filter
pmlogsummary tmparch/null


# success, all done
status=0
exit
