diff options
author | Phil Sutter <phil@nwl.cc> | 2020-12-15 13:52:47 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-02-04 01:23:08 +0100 |
commit | 2cfab7a3e10fcb8ec1aeacc2713a24c1f1d71aae (patch) | |
tree | 30b9c8e4b1b79220ed781959840919f86b0f0d80 /tests/py/nft-test.py | |
parent | a02ef54d9c4fa82c10d199d027f42f136b1bddc3 (diff) |
tests/py: Write dissenting payload into the right file
The testsuite supports diverging payloads depending on table family.
This is necessary since for some families, dependency matches are
created.
If a payload mismatch happens, record it into a "got"-file which matches
the family-specific payload file, not the common one. This eases use of
diff-tools a lot as the extra other families' payloads confuse the
tools.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/py/nft-test.py')
-rwxr-xr-x | tests/py/nft-test.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index 7ca5a22a..18e9c67f 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -712,8 +712,10 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): if rule[1].strip() == "ok": payload_expected = None + payload_path = None try: payload_log = open("%s.payload" % filename_path) + payload_path = payload_log.name payload_expected = payload_find_expected(payload_log, rule[0]) except: payload_log = None @@ -756,6 +758,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): table_payload_expected = None try: payload_log = open("%s.payload.%s" % (filename_path, table.family)) + payload_path = payload_log.name table_payload_expected = payload_find_expected(payload_log, rule[0]) except: if not payload_log: @@ -802,7 +805,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path): if state == "ok" and not payload_check(table_payload_expected, payload_log, cmd): error += 1 - gotf = open("%s.payload.got" % filename_path, 'a') + gotf = open("%s.got" % payload_path, 'a') payload_log.seek(0, 0) gotf.write("# %s\n" % rule[0]) while True: |