]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: Fail test forcefully when bug is not fixed
authorShyam Saini <mayhs11saini@gmail.com>
Wed, 21 Jun 2017 08:47:45 +0000 (14:17 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 26 Jun 2017 17:23:26 +0000 (19:23 +0200)
When we have "fail" in the test cases then py test doesn't complain
anything, but the test should complain if the fix is not applied.

Before applying 986dea8a4a9d ("evaluate: avoid reference to multiple src
data in statements which set values"), nft throws following error
message and exits with error code 134.

$ nft add rule x y tcp dport set { 0 , 1 }
  BUG: unknown expression type set reference
  nft: netlink_linearize.c:696: netlink_gen_expr: Assertion `0' failed.
  Aborted

This commit enforces nft-test.py to throw error message when the fix
is not applied.

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/py/nft-test.py

index c1da71aaf827921d3e11bb6eda67a06d7a48ab89..8d099a15aaf80391538b3032751e896da2563884 100755 (executable)
@@ -702,7 +702,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path):
             ret = execute_cmd(cmd, filename, lineno, payload_log)
 
             state = rule[1].rstrip()
-            if (ret == 0 and state == "fail") or (ret != 0 and state == "ok"):
+            if (ret in [0,134] and state == "fail") or (ret != 0 and state == "ok"):
                 if state == "fail":
                     test_state = "This rule should have failed."
                 else: