Make diff normalize our test output files in place

pull/3336/head
Jelte Fennema 2019-12-23 14:36:21 +01:00
parent 3cfb9b64bf
commit b815425d2c
1 changed files with 7 additions and 5 deletions

View File

@ -9,6 +9,7 @@
#
# Note that src/test/regress/Makefile adds this directory to $PATH so
# pg_regress uses this diff tool instead of the system diff tool.
set -eu -o pipefail
file1="${@:(-2):1}"
file2="${@:(-1):1}"
@ -29,13 +30,14 @@ then
DIFF=/usr/bin/diff
fi
if test -z "$VANILLATEST"
if test -z "${VANILLATEST:-}"
then
sed -Ef $BASEDIR/normalize.sed < $file1 > $file1.modified
sed -Ef $BASEDIR/normalize.sed < $file2 > $file2.modified
$DIFF -w $args $file1.modified $file2.modified
sed -Ef $BASEDIR/normalize.sed < $file1 > "$file1.modified"
mv "$file1.modified" "$file1"
sed -Ef $BASEDIR/normalize.sed < "$file2" > "$file2.modified"
mv "$file2.modified" "$file2"
$DIFF -w $args $file1 $file2
exitcode=$?
rm -f $file1.modified $file2.modified
exit $exitcode
else
exec $DIFF -w $args $file1 $file2