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-18 10:39:06 +0100
commit635c03751b3fb59b6b258cd3e4033ddac0599426 (patch)
tree16f2a05895c9ea8f6617691ceae3ce73d6b4930e
parent5893fde5b5533e3ee644a347493d92fb7e17d855 (diff)
downloadgnutls-635c03751b3fb59b6b258cd3e4033ddac0599426.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 $?
}