#!/bin/sh
# PCP QA Test No. 1682
# Exercise pmrepconf generating pmrep.conf(5) format,
# valgrind-enabled variant.
#
# Copyright (c) 2020 Red Hat.  All Rights Reserved.
#

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

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

which pmrep >/dev/null 2>&1 || _notrun "no pmrep executable"

_check_valgrind

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=0	# success 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 seq
./1681 --valgrind \
| $PCP_AWK_PROG '
skip == 1 && $1 == "==="       { skip = 0 }
/^=== std err ===/             { skip = 1 }
skip == 0              { print }
skip == 1              { print >"'$here/$seq.full'" }'

# success, all done
exit
