#! /bin/sh
# PCP QA Test No. 281
# Exercise pmNewContext() for archives close to the NOFILE max fd limit.
# For incident: 504616
#
# 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

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

rm -rf $tmp
mkdir $tmp
cp tmparch/foo.* $tmp

# real QA test starts here
cd $tmp

$here/src/arch_maxfd foo \
| tee $seq.full \
| $PCP_AWK_PROG '
$1 == "max"	{ if (maxctx == "") maxctx = $NF
		  $NF = "<max>-" maxctx-$NF
		}
		{ print }'

if [ "`echo core*`" != "core*" ]
then
    echo "$here/src/arch_maxfd dumped core!"
    ls -l core*
    unset TOOLROOT
    echo where | dbx $here/src/arch_maxfd
    exit
fi

# success, all done
status=0
exit
