summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2018-11-23 19:58:49 +0100
committerTim Rühsen <tim.ruehsen@gmx.de>2018-12-13 08:52:28 +0100
commita7d1fcc935e77ddae6aad599d78cee487f9f4517 (patch)
treecfa244af35d6eb11330fdf4e7cf3fddc97368b3e
parentcf1dc83785cf52c788c4efe913e0bfc576f46263 (diff)
downloadgnutls-a7d1fcc935e77ddae6aad599d78cee487f9f4517.tar.gz
tests/scripts/common.sh: Add check_if_equal()
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r--tests/scripts/common.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh
index fcad3d7af0..adc69b3062 100644
--- a/tests/scripts/common.sh
+++ b/tests/scripts/common.sh
@@ -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 $?
}