]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests/scripts/common.sh: Add check_if_equal()
authorTim Rühsen <tim.ruehsen@gmx.de>
Fri, 23 Nov 2018 18:58:49 +0000 (19:58 +0100)
committerTim Rühsen <tim.ruehsen@gmx.de>
Tue, 18 Dec 2018 09:39:06 +0000 (10:39 +0100)
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
tests/scripts/common.sh

index fcad3d7af020e7cdcd0282dbf72e7753755ae591..adc69b3062c97114fab46fb54c16ccab6edb2d3d 100644 (file)
@@ -262,4 +262,21 @@ terminate_proc() {
        done
        kill_quiet -9 $pid
        sleep 0.1
+
+# $1, $2: the two files to check for equality
+# $3: Strings to be ignored, separated by |
+check_if_equal() {
+       if test -n "$3"; then
+               local tmp1=`basename "$1"`"1.tmp"
+               local tmp2=`basename "$2"`"2.tmp"
+               egrep -v "$3" "$1" | tr -d '\r' >"$tmp1"
+               egrep -v "$3" "$2" | tr -d '\r' >"$tmp2"
+               diff -b -B "$tmp1" "$tmp2"
+               local rc=$?
+               rm -f "$tmp1" "$tmp2"
+               return $rc
+       fi
+
+       diff -b -B "$1" "$2"
+       return $?
 }