]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/monitor: Ignore newgen messages in output
authorPhil Sutter <phil@nwl.cc>
Tue, 25 Jul 2017 14:56:24 +0000 (16:56 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 25 Jul 2017 15:58:22 +0000 (17:58 +0200)
Predicting the new ID value is not feasible and neither is implementing
support for regular expressions when matching monitor output, so simply
ignore them.

Also use diff option '-w' instead of '-Z' to ignore all whitespace, not
just at EOL.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/monitor/run-tests.sh

index 7447adf1febd67f8f0bb1ff90cec703fa04c8f3d..e21ed6880bc1394eb8719ce153201fac494f2345 100755 (executable)
@@ -10,6 +10,9 @@ fi
 trap "rm -rf $testdir" EXIT
 
 nft=../../src/nft
+mydiff() {
+       diff -w -I '^# ' "$@"
+}
 command_file=$(mktemp -p $testdir)
 output_file=$(mktemp -p $testdir)
 
@@ -35,9 +38,9 @@ run_test() {
        sleep 0.5
        kill $monitor_pid
        wait >/dev/null 2>&1
-       if ! diff -Z -q $monitor_output $output_file >/dev/null 2>&1; then
+       if ! mydiff -q $monitor_output $output_file >/dev/null 2>&1; then
                echo "monitor output differs!"
-               diff -Z -u $output_file $monitor_output
+               mydiff -u $output_file $monitor_output
                exit 1
        fi
        rm $command_file