netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shyam Saini <mayhs11saini@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Shyam Saini <mayhs11saini@gmail.com>
Subject: [PATCH] tests: py: Fail test forcefully when bug is not fixed
Date: Wed, 21 Jun 2017 14:17:45 +0530	[thread overview]
Message-ID: <1498034865-11321-1-git-send-email-mayhs11saini@gmail.com> (raw)

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 the [Test] commit, 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.

Test:986dea8a4a9d ("evaluate: avoid reference to multiple src data in
statements which set values")
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
 tests/py/nft-test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
index c1da71aaf827..8d099a15aaf8 100755
--- a/tests/py/nft-test.py
+++ b/tests/py/nft-test.py
@@ -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:
-- 
1.9.1


             reply	other threads:[~2017-06-21  8:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  8:47 Shyam Saini [this message]
2017-06-26 17:24 ` [PATCH] tests: py: Fail test forcefully when bug is not fixed Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498034865-11321-1-git-send-email-mayhs11saini@gmail.com \
    --to=mayhs11saini@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).