Welcome to mirror list, hosted at ThFree Co, Russian Federation.

diff.sh « tools - github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b09ba542a15f26dc1cab06504e3d881a2c997563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
#
# Usage:
#   ./diff.sh file1 file2 [number-of-allowed-diff-lines]

[[ "$#" -ge 2 ]] && >&2 echo "Command: $(realpath $0) $(realpath -m $1) $(realpath -m $2)"
diff $1 $2
exitcode=$?
if [ -z "$3" ]; then
  exit $exitcode
else
  numlines=$(diff -y --suppress-common-lines $1 $2 | wc -l)
  >&2 echo "Different lines: $numlines, allowed: $3"
  if [[ "$numlines" -gt "$3" ]]; then
    exit $exitcode
  else
    exit 0
  fi
fi