netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH 2/4] tests: iptables-test: Simplify execute_cmd() calling
Date: Sat,  1 Oct 2022 11:43:08 +0200	[thread overview]
Message-ID: <20221001094310.29452-3-phil@nwl.cc> (raw)
In-Reply-To: <20221001094310.29452-1-phil@nwl.cc>

Default 'lineno' parameter to zero,

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables-test.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/iptables-test.py b/iptables-test.py
index 69c96b79927b5..25561bc9ba971 100755
--- a/iptables-test.py
+++ b/iptables-test.py
@@ -168,7 +168,7 @@ def run_test(iptables, rule, rule_save, res, filename, lineno, netns):
 
     return delete_rule(iptables, rule, filename, lineno)
 
-def execute_cmd(cmd, filename, lineno):
+def execute_cmd(cmd, filename, lineno = 0):
     '''
     Executes a command, checking for segfaults and returning the command exit
     code.
@@ -264,7 +264,7 @@ def run_test_file(filename, netns):
     total_test_passed = True
 
     if netns:
-        execute_cmd("ip netns add " + netns, filename, 0)
+        execute_cmd("ip netns add " + netns, filename)
 
     for lineno, line in enumerate(f):
         if line[0] == "#" or len(line.strip()) == 0:
@@ -336,7 +336,7 @@ def run_test_file(filename, netns):
             passed += 1
 
     if netns:
-        execute_cmd("ip netns del " + netns, filename, 0)
+        execute_cmd("ip netns del " + netns, filename)
     if total_test_passed:
         print(filename + ": " + maybe_colored('green', "OK", STDOUT_IS_TTY))
 
-- 
2.34.1


  parent reply	other threads:[~2022-10-01  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-01  9:43 [iptables PATCH 0/4] tests: iptables-test: Test both variants by default Phil Sutter
2022-10-01  9:43 ` [iptables PATCH 1/4] tests: iptables-test: Simplify '-N' option a bit Phil Sutter
2022-10-01  9:43 ` Phil Sutter [this message]
2022-10-01  9:43 ` [iptables PATCH 3/4] tests: iptables-test: Pass netns to execute_cmd() Phil Sutter
2022-10-01  9:43 ` [iptables PATCH 4/4] tests: iptables-test: Test both variants by default Phil Sutter

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=20221001094310.29452-3-phil@nwl.cc \
    --to=phil@nwl.cc \
    --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).