From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH 7/7] tests: xlate: Support testing multiple individual files
Date: Thu, 26 Jan 2023 13:24:06 +0100 [thread overview]
Message-ID: <20230126122406.23288-8-phil@nwl.cc> (raw)
In-Reply-To: <20230126122406.23288-1-phil@nwl.cc>
Simple use-case: run xlate-test for ebtables-nft:
| % ./xlate-test.py extensions/libebt_*.txlate
The script interpreted all parameters as a single file.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
xlate-test.py | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/xlate-test.py b/xlate-test.py
index 4cb1401b71677..1b544600aa242 100755
--- a/xlate-test.py
+++ b/xlate-test.py
@@ -241,17 +241,22 @@ xtables_nft_multi = 'xtables-nft-multi'
+ '/iptables/' + xtables_nft_multi
files = tests = passed = failed = errors = 0
- if args.test:
- if not args.test.endswith(".txlate"):
- args.test += ".txlate"
+ for test in args.test:
+ if not test.endswith(".txlate"):
+ test += ".txlate"
try:
- with open(args.test, "r") as payload:
- files = 1
- tests, passed, failed, errors = run_test(args.test, payload)
+ with open(test, "r") as payload:
+ t, p, f, e = run_test(test, payload)
+ files += 1
+ tests += t
+ passed += p
+ failed += f
+ errors += e
except IOError:
print(red("Error: ") + "test file does not exist", file=sys.stderr)
return 99
- else:
+
+ if files == 0:
files, tests, passed, failed, errors = load_test_files()
if files > 1:
@@ -272,6 +277,6 @@ parser.add_argument('-n', '--nft', type=str, default='nft',
help='Replay using given nft binary (default: \'%(default)s\')')
parser.add_argument('--no-netns', action='store_true',
help='Do not run testsuite in own network namespace')
-parser.add_argument("test", nargs="?", help="run only the specified test file")
+parser.add_argument("test", nargs="*", help="run only the specified test file(s)")
args = parser.parse_args()
sys.exit(main())
--
2.38.0
next prev parent reply other threads:[~2023-01-26 12:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 12:23 [iptables PATCH 0/7] Small ebtables-translate review + extras Phil Sutter
2023-01-26 12:24 ` [iptables PATCH 1/7] Proper fix for "unknown argument" error message Phil Sutter
2023-01-26 12:24 ` [iptables PATCH 2/7] ebtables: Refuse unselected targets' options Phil Sutter
2023-01-26 12:24 ` [iptables PATCH 3/7] ebtables-translate: Drop exec_style Phil Sutter
2023-01-26 12:24 ` [iptables PATCH 4/7] ebtables-translate: Use OPT_* from xshared.h Phil Sutter
2023-01-26 12:24 ` [iptables PATCH 5/7] ebtables-translate: Ignore '-j CONTINUE' Phil Sutter
2023-01-26 12:24 ` [iptables PATCH 6/7] ebtables-translate: Print flush command after parsing is finished Phil Sutter
2023-01-26 12:24 ` Phil Sutter [this message]
2023-01-31 15:30 ` [iptables PATCH 0/7] Small ebtables-translate review + extras 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=20230126122406.23288-8-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).