[nft PATCH 11/13] tests/py: Simplify parsing of 'set' lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 tests/py/nft-test.py | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
index f4ddc91b39291..ef9c6dbb769e5 100755
--- a/tests/py/nft-test.py
+++ b/tests/py/nft-test.py
@@ -855,19 +855,13 @@ def chain_process(chain_line, lineno):
 def set_process(set_line, filename, lineno):
     test_result = set_line[1]
 
-    tokens = set_line[0].split(" ")
-    set_name = tokens[0]
-    set_type = tokens[2]
-
-    i = 3
-    while len(tokens) > i and tokens[i] == ".":
-        set_type += " . " + tokens[i+1]
-        i += 2
-
-    if len(tokens) == i+2 and tokens[i] == "flags":
-        set_flags = tokens[i+1]
+    # set_line[0] is like '<name> type <type>[ flags <flags>]'
+    tokens = set_line[0].split(" flags ")
+    if len(tokens) > 1:
+        set_flags = tokens[1]
     else:
         set_flags = ""
+    set_name, set_type = tokens[0].split(" type ")
 
     s = Set("", "", set_name, set_type, set_flags)
 
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux