mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-02-18 10:09:14 -05:00
44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) CZ.NIC, z.s.p.o. and contributors
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# For more information, see <https://www.knot-dns.cz/>
|
|
|
|
SOURCE=@top_srcdir@/tests/libzscanner
|
|
BUILD=@top_builddir@/tests/libzscanner
|
|
|
|
. @top_srcdir@/tests/tap/libtap.sh
|
|
|
|
cd "$BUILD"
|
|
|
|
TMPDIR=$(test_tmpdir)
|
|
TESTS_DIR="$SOURCE"/data
|
|
ZSCANNER_TOOL="$BUILD"/zscanner-tool
|
|
|
|
plan 87
|
|
|
|
mkdir -p "$TMPDIR"/includes/
|
|
for a in 1 2 3 4 5 6; do
|
|
cat "$TESTS_DIR"/includes/include"$a" > "$TMPDIR"/includes/include"$a";
|
|
done
|
|
|
|
for case in $(cat "$SOURCE"/TESTS); do
|
|
casein=$(test_file_path data/"$case".in)
|
|
caseout=$(test_file_path data/"$case".out)
|
|
filein="$TMPDIR"/"$case".in
|
|
fileout="$TMPDIR"/"$case".out
|
|
|
|
sed -e "s|@TMPDIR@|$TMPDIR|;" < "$casein" > "$filein"
|
|
|
|
"$ZSCANNER_TOOL" -m 2 . "$filein" > "$fileout"
|
|
|
|
if cmp -s "$fileout" "$caseout"; then
|
|
ok "$case: output matches" true
|
|
rm "$filein"
|
|
rm "$fileout"
|
|
else
|
|
ok "$case: output differs" false
|
|
diff -urNap "$caseout" "$fileout" | while read line; do diag "$line"; done
|
|
fi
|
|
done
|
|
|
|
rm -rf "$TMPDIR"/includes/
|