]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: make sure i is defined
authorFlorian Westphal <fw@strlen.de>
Fri, 16 Aug 2019 10:32:19 +0000 (12:32 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 16 Aug 2019 10:32:19 +0000 (12:32 +0200)
The test script can die in case there are severe problems,
such as rlen being 0 -- in that case i is undefined and script
evaluation is aborted.

Found during nft development, no existing test case shows this
problem.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/nft-test.py

index 7f424cf1e92d0c8d6158f56272ca9da5ee0f9c4a..bc0849e0410b564f76687d5064a1cf513a91576c 100755 (executable)
@@ -138,6 +138,7 @@ def color_differences(rule, other, color):
     rlen = len(rule)
     olen = len(other)
     out = ""
+    i = 0
 
     # find equal part at start
     for i in range(rlen):