File: accept_output_for

package info (click to toggle)
cgreen 1.6.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,588 kB
  • sloc: ansic: 12,276; sh: 558; makefile: 474; cpp: 403; python: 181; xml: 33; sed: 13
file content (32 lines) | stat: -rwxr-xr-x 702 bytes parent folder | download | duplicates (3)
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!"