#!/bin/sh

petit=$1
file=$2
flags=$3

# got rid of common because it was too hard to run with pmake on another cpu

echo "Generating $petit with flags \"${PETIT_TEST_FLAGS}$flags\" on $file"

tmp=/tmp/t-test.$$.`hostname`

if	test "${petit_dd_suffix}" = ""
then	petit_dd_suffix=rdd${flags}
fi

flags=`echo $flags | sed 's/\(.\)/-\1 /g'`

ofile=${2}.${petit_dd_suffix}

if	test "${PETIT_TEST_ALERT}" = ""
then	PETIT_TEST_ALERT=""
fi

${petit} -${PETIT_TEST_FLAGS} ${flags} -R${tmp} ${file}

if	test -r ${tmp}
then	sort < ${tmp} > ${ofile}
	rm -f ${tmp} </dev/null
fi
