All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft 1/3] tests: add *.got files to .gitignore
@ 2015-12-01 22:45 Pablo M. Bermudo Garay
  2015-12-01 22:45 ` [PATCH nft 2/3] tests: remove useless logic Pablo M. Bermudo Garay
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pablo M. Bermudo Garay @ 2015-12-01 22:45 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo M. Bermudo Garay

During tests execution, some *.payload.got files may be generated. To
avoid annoyances, this commit adds the pattern to .gitignore. Also, the
file "dup.t.payload.got", that was presumably included by mistake, has
been deleted.

Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com>
---
 .gitignore                            |  3 +++
 tests/regression/ip/dup.t.payload.got | 26 --------------------------
 2 files changed, 3 insertions(+), 26 deletions(-)
 delete mode 100644 tests/regression/ip/dup.t.payload.got

diff --git a/.gitignore b/.gitignore
index 63ef1a2..009f7d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,5 +24,8 @@ ylwrap
 src/parser_bison.c
 src/parser_bison.h
 
+# Generated by tests
+*.payload.got
+
 # Debian package build temporary files
 build-stamp
diff --git a/tests/regression/ip/dup.t.payload.got b/tests/regression/ip/dup.t.payload.got
deleted file mode 100644
index 23e0a7e..0000000
--- a/tests/regression/ip/dup.t.payload.got
+++ /dev/null
@@ -1,26 +0,0 @@
-# dup to 192.168.2.1 device eth0
-ip test-ip4 input 
-  [ immediate reg 1 0x0102a8c0 ]
-  [ immediate reg 2 0x00000002 0x00000000 0x00000000 0x00000000 ]
-  [ dup sreg_addr 1  sreg_dev 2 ]
-
-# dup to ip saddr map { 192.168.2.120 : 192.168.2.1 } device eth0
-map%d test-ip4 b
-map%d test-ip4 0
-	element 7802a8c0  : 0102a8c0 0 [end]
-ip test-ip4 input 
-  [ payload load 4b @ network header + 12 => reg 1 ]
-  [ lookup reg 1 set map%d dreg 1 ]
-  [ immediate reg 2 0x00000002 0x00000000 0x00000000 0x00000000 ]
-  [ dup sreg_addr 1  sreg_dev 2 ]
-
-# dup to ip saddr map { 192.168.2.120 : 192.168.2.1 } device eth0
-map%d test-ip4 b
-map%d test-ip4 0
-	element 7802a8c0  : 0102a8c0 0 [end]
-ip test-ip4 input 
-  [ payload load 4b @ network header + 12 => reg 1 ]
-  [ lookup reg 1 set map%d dreg 1 ]
-  [ immediate reg 2 0x00000002 0x00000000 0x00000000 0x00000000 ]
-  [ dup sreg_addr 1 sreg_dev 2 ]
-
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH nft 2/3] tests: remove useless logic
  2015-12-01 22:45 [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo M. Bermudo Garay
@ 2015-12-01 22:45 ` Pablo M. Bermudo Garay
  2015-12-01 22:45 ` [PATCH nft 3/3] tests: fix crash when rule test is malformed Pablo M. Bermudo Garay
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Pablo M. Bermudo Garay @ 2015-12-01 22:45 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo M. Bermudo Garay

In the test files, some lines defining tables was commented out with a
minus "-" sign, also used to mark broken rules. This commit replaces
these signs with actual comments "#" and removes the code that handled
the situation.

Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com>
---
 tests/regression/any/ct.t     | 4 ++--
 tests/regression/ip/icmp.t    | 2 +-
 tests/regression/ip6/icmpv6.t | 2 +-
 tests/regression/ip6/snat.t   | 2 +-
 tests/regression/nft-test.py  | 2 --
 5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tests/regression/any/ct.t b/tests/regression/any/ct.t
index ab4b167..0f5394a 100644
--- a/tests/regression/any/ct.t
+++ b/tests/regression/any/ct.t
@@ -2,8 +2,8 @@
 *ip6;test-ip6
 *inet;test-inet
 # ct expresion is not supported in arp and bridge family yet.
-- *arp;test-arp
-- *bridge;test-bridge
+# *arp;test-arp
+# *bridge;test-bridge
 
 :output;type filter hook output priority 0
 
diff --git a/tests/regression/ip/icmp.t b/tests/regression/ip/icmp.t
index 9c2aba7..bd00f5c 100644
--- a/tests/regression/ip/icmp.t
+++ b/tests/regression/ip/icmp.t
@@ -1,6 +1,6 @@
 *ip;test-ip4
 # BUG: There is a bug with icmp protocol and inet family.
-- *inet;test-inet
+# *inet;test-inet
 :input;type filter hook input priority 0
 
 icmp type echo-reply accept;ok
diff --git a/tests/regression/ip6/icmpv6.t b/tests/regression/ip6/icmpv6.t
index c86c825..fca903f 100644
--- a/tests/regression/ip6/icmpv6.t
+++ b/tests/regression/ip6/icmpv6.t
@@ -1,6 +1,6 @@
 *ip6;test-ip6
 # BUG: There is a bug with icmpv6 and inet tables
-- *inet;test-inet
+# *inet;test-inet
 :input;type filter hook input priority 0
 
 icmpv6 type destination-unreachable accept;ok
diff --git a/tests/regression/ip6/snat.t b/tests/regression/ip6/snat.t
index 44ca9e4..8f841da 100644
--- a/tests/regression/ip6/snat.t
+++ b/tests/regression/ip6/snat.t
@@ -1,5 +1,5 @@
 *ip6;test-ip6
-- *inet;test-inet
+# *inet;test-inet
 :postrouting;type nat hook postrouting priority 0
 
 tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:: :80-100;ok;tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:::80-100
diff --git a/tests/regression/nft-test.py b/tests/regression/nft-test.py
index 0b0be5d..9d623b7 100755
--- a/tests/regression/nft-test.py
+++ b/tests/regression/nft-test.py
@@ -809,8 +809,6 @@ def run_test_file(filename, force_all_family_option, specific_file):
         # Rule
         rule = line.split(';')  # rule[1] Ok or FAIL
         if line[0] == "-":  # Run omitted lines
-            if line[1:].find("*") != -1:
-                continue
             if need_fix_option:
                 rule[0] = rule[0].rstrip()[1:].strip()
             else:
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH nft 3/3] tests: fix crash when rule test is malformed
  2015-12-01 22:45 [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo M. Bermudo Garay
  2015-12-01 22:45 ` [PATCH nft 2/3] tests: remove useless logic Pablo M. Bermudo Garay
@ 2015-12-01 22:45 ` Pablo M. Bermudo Garay
  2015-12-10 17:28 ` [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo Neira Ayuso
  2015-12-14 19:39 ` Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Pablo M. Bermudo Garay @ 2015-12-01 22:45 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo M. Bermudo Garay

The tests script suffers a crash when a rule test line is malformed
(e.g. if expected result is missing). This commit fixes these crashes
and now the line is skipped and a warning is printed.

Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com>
---
 tests/regression/nft-test.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/regression/nft-test.py b/tests/regression/nft-test.py
index 9d623b7..e68087f 100755
--- a/tests/regression/nft-test.py
+++ b/tests/regression/nft-test.py
@@ -508,12 +508,6 @@ def rule_add(rule, table_list, chain_list, filename, lineno,
                     print_error("did not find payload information for rule '%s'" % rule[0], payload_log.name, 1)
 
         for chain in chain_list:
-            if len(rule) == 1:
-                reason = "Skipping malformed test. (" + \
-                    str(rule[0].rstrip('\n')) + ")"
-                print_warning(reason, filename, lineno)
-                continue
-
             unit_tests += 1
             table_flush(table, filename, lineno)
             table_info = " " + table[0] + " " + table[1] + " "
@@ -808,6 +802,11 @@ def run_test_file(filename, force_all_family_option, specific_file):
 
         # Rule
         rule = line.split(';')  # rule[1] Ok or FAIL
+        if len(rule) == 1 or len(rule) > 3 or rule[1].rstrip() not in {"ok", "fail"}:
+            reason = "Skipping malformed rule test. (" + line.rstrip('\n') + ")"
+            print_warning(reason, filename, lineno)
+            continue
+
         if line[0] == "-":  # Run omitted lines
             if need_fix_option:
                 rule[0] = rule[0].rstrip()[1:].strip()
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH nft 1/3] tests: add *.got files to .gitignore
  2015-12-01 22:45 [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo M. Bermudo Garay
  2015-12-01 22:45 ` [PATCH nft 2/3] tests: remove useless logic Pablo M. Bermudo Garay
  2015-12-01 22:45 ` [PATCH nft 3/3] tests: fix crash when rule test is malformed Pablo M. Bermudo Garay
@ 2015-12-10 17:28 ` Pablo Neira Ayuso
  2015-12-14 19:39 ` Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2015-12-10 17:28 UTC (permalink / raw)
  To: Pablo M. Bermudo Garay; +Cc: netfilter-devel

On Tue, Dec 01, 2015 at 11:45:21PM +0100, Pablo M. Bermudo Garay wrote:
> During tests execution, some *.payload.got files may be generated. To
> avoid annoyances, this commit adds the pattern to .gitignore. Also, the
> file "dup.t.payload.got", that was presumably included by mistake, has
> been deleted.

Series from 1 to 3 applied, thanks.

I have slightly mangled patch 2/3 to effectively remove some lines
that don't make sense to have at this stage.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH nft 1/3] tests: add *.got files to .gitignore
  2015-12-01 22:45 [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo M. Bermudo Garay
                   ` (2 preceding siblings ...)
  2015-12-10 17:28 ` [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo Neira Ayuso
@ 2015-12-14 19:39 ` Pablo Neira Ayuso
  3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2015-12-14 19:39 UTC (permalink / raw)
  To: Pablo M. Bermudo Garay; +Cc: netfilter-devel

Forgot to push out this series, this should show now there in master.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-14 19:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01 22:45 [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo M. Bermudo Garay
2015-12-01 22:45 ` [PATCH nft 2/3] tests: remove useless logic Pablo M. Bermudo Garay
2015-12-01 22:45 ` [PATCH nft 3/3] tests: fix crash when rule test is malformed Pablo M. Bermudo Garay
2015-12-10 17:28 ` [PATCH nft 1/3] tests: add *.got files to .gitignore Pablo Neira Ayuso
2015-12-14 19:39 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.