1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#!/bin/bash
#
# Script to accept the current output for some output comparing test as the golden output
#
# Usage: accept <test>
#
# Will copy build/tests/<test>.output to tests/<test>.expected
if [ "$#" -ne 1 ]
then
echo "Usage: accept <test>"
exit 1
fi
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir=$(dirname $scriptdir)
if [[ ! -f $rootdir/build/tests/$1.output ]]
then
echo "Output file does not exist."
exit
fi
echo "About to 'cp build/tests/$1.output tests/$1.expected'"
read -r -p "Are you sure? [y/N] " response
if [[ ! $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
exit
fi
cp $rootdir/build/tests/$1.output $rootdir/tests/$1.expected
echo "Accepted!"
|