All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft 1/2] tests/py: prepare for set debug change
@ 2024-11-20 10:02 Florian Westphal
  2024-11-20 10:02 ` [PATCH nft 2/2] debug: include kernel set information on cache fill Florian Westphal
  0 siblings, 1 reply; 13+ messages in thread
From: Florian Westphal @ 2024-11-20 10:02 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

Next patch will make initial set dump from kernel emit set debug
information, so the obtained netlink debug file won't match what is
recorded in tests/py.

Furthermore, as the python add rules for each of the family the test is
for, subsequent dump will include debug information of the other/previous
families.

Change the script to skip all unrelated information to only compare the
relevant set element information and the generated expressions.

This change still finds changes in [ expr ... ] and set elem debug output.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 tests/py/nft-test.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
index 7acdb77f2d0a..ea70f19b196d 100755
--- a/tests/py/nft-test.py
+++ b/tests/py/nft-test.py
@@ -717,17 +717,20 @@ def payload_check(payload_buffer, file, cmd):
         return False
 
     for lineno, want_line in enumerate(payload_buffer):
+        # skip irreleant parts, such as "ip test-ipv4 output"
+        if want_line.find("[") < 0 or want_line.find("]") < 0:
+             continue
+
         line = file.readline()
+        while line.find("[") < 0 or line.find("]") < 0:
+            line = file.readline()
+            if line == "":
+                break
 
         if want_line == line:
             i += 1
             continue
 
-        if want_line.find('[') < 0 and line.find('[') < 0:
-            continue
-        if want_line.find(']') < 0 and line.find(']') < 0:
-            continue
-
         if payload_check_set_elems(want_line, line):
             continue
 
@@ -877,6 +880,8 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path):
                     gotf.write("# %s\n" % rule[0])
                     while True:
                         line = payload_log.readline()
+                        if line.startswith("family "):
+                            continue
                         if line == "":
                             break
                         gotf.write(line)
-- 
2.47.0


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

end of thread, other threads:[~2024-11-22 14:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 10:02 [PATCH nft 1/2] tests/py: prepare for set debug change Florian Westphal
2024-11-20 10:02 ` [PATCH nft 2/2] debug: include kernel set information on cache fill Florian Westphal
2024-11-20 23:29   ` Pablo Neira Ayuso
2024-11-20 23:38     ` Florian Westphal
2024-11-21  9:24       ` Florian Westphal
2024-11-21 10:00         ` Pablo Neira Ayuso
2024-11-21 12:02           ` Florian Westphal
2024-11-21 15:12             ` Pablo Neira Ayuso
2024-11-21 17:19               ` Florian Westphal
2024-11-22 13:35                 ` Pablo Neira Ayuso
2024-11-22 13:43                   ` Florian Westphal
2024-11-22 14:01                     ` Pablo Neira Ayuso
2024-11-22 14:38                       ` Florian Westphal

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.