diff options
author | Phil Sutter <phil@nwl.cc> | 2023-01-25 13:52:48 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2023-01-31 16:29:26 +0100 |
commit | 13a6bd5bb2c03911dc813e0539c676b10680aa74 (patch) | |
tree | 398c108ea8abd0ab6bfcb81b288d5774d14e1f18 /xlate-test.py | |
parent | b51aef061378b34fa9544b1af34021d89a76547a (diff) |
tests: xlate: Support testing multiple individual files
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>
Diffstat (limited to 'xlate-test.py')
-rwxr-xr-x | xlate-test.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/xlate-test.py b/xlate-test.py index 4cb1401b..1b544600 100755 --- a/xlate-test.py +++ b/xlate-test.py @@ -241,17 +241,22 @@ def main(): + '/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()) |