aboutsummaryrefslogtreecommitdiff
path: root/tests/do.sh.in
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2022-05-30 17:33:03 +0200
committerGitHub <noreply@github.com>2022-05-30 17:33:03 +0200
commit48065d80e989bdf708f7b87283e0625b490f1f19 (patch)
tree73a8a55d9fbfa550027046f636966aacdb31beac /tests/do.sh.in
parent32750271c38ff754395e167c5a646172140aaf9f (diff)
Support word diff for tests/do.sh for better readability. (#1565)
* Sync unit tests Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'tests/do.sh.in')
-rwxr-xr-xtests/do.sh.in11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/do.sh.in b/tests/do.sh.in
index 65716c057..99917f5ae 100755
--- a/tests/do.sh.in
+++ b/tests/do.sh.in
@@ -15,6 +15,10 @@ elif [ "${NDPI_TESTS_VALGRIND}" = "1" ]; then
CMD_PREFIX="valgrind -q --leak-check=full"
fi
+CMD_DIFF="$(which diff)"
+CMD_WDIFF="$(which wdiff)"
+CMD_COLORDIFF="$(which colordiff)"
+
EXE_SUFFIX=@EXE_SUFFIX@
PCRE_ENABLED=@PCRE_ENABLED@
PCRE_PCAPS="WebattackRCE.pcap"
@@ -73,7 +77,7 @@ check_results() {
$CMD
CMD_RET=$?
if [ $CMD_RET -eq 0 ]; then
- NUM_DIFF=`diff result/$f.out /tmp/reader.out | wc -l`
+ NUM_DIFF=`${CMD_DIFF} result/$f.out /tmp/reader.out | wc -l`
else
printf "%-48s\tERROR (ndpiReader${EXE_SUFFIX} exit code: ${CMD_RET})\n" "$f"
RC=$(( RC + 1 ))
@@ -85,7 +89,10 @@ check_results() {
else
printf "%-48s\tERROR\n" "$f"
echo "$CMD [old vs new]"
- diff result/$f.out /tmp/reader.out
+ ${CMD_DIFF} result/$f.out /tmp/reader.out
+ if [ ! -z "${CMD_COLORDIFF}" -a ! -z "${CMD_WDIFF}" ]; then
+ ${CMD_WDIFF} -n -3 result/$f.out /tmp/reader.out | ${CMD_COLORDIFF}
+ fi
RC=$(( RC + 1 ))
fi