* [PATCH nft] tests/py: remove flow table json test cases
@ 2024-03-13 14:13 Florian Westphal
2024-03-13 16:26 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2024-03-13 14:13 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
ip(6)/flowtable.t tests fail both for normal and json mode.
WARNING: line 3: 'add rule ip test-ip input meter xyz size 8192 { ip saddr timeout 30s counter}': 'ip test-ip input' mismatches '[ payload load 4b @ network header + 12 => reg 1 ]'
ip/lowtable.t.payload.got: WARNING: line 2: Wrote payload for rule meter xyz size 8192 { ip saddr timeout 30s counter}
ip/flowtable.t: WARNING: line 5: 'add rule ip test-ip input meter xyz size 8192 { ip saddr timeout 30s counter}': 'meter xyz size 8192 { ip saddr timeout 30s counter}' mismatches 'update @xyz { ip saddr timeout 30s counter}'
WARNING: line 3: 'add rule ip6 test-ip6 input meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }': 'ip6 test-ip6 input' mismatches '[ meta load iif => reg 1 ]'
ip6/flowtable.t.payload.got: WARNING: line 2: Wrote payload for rule meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }
ip6/flowtable.t: WARNING: line 5: 'add rule ip6 test-ip6 input meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }': 'meter acct_out size 4096 { iif . ip6 saddr timeout 10m counter }' mismatches 'update @acct_out { iif . ip6 saddr timeout 10m counter}'
ip6/flowtable.t: ERROR: line 6: add rule ip6 test-ip6 input meter acct_out size 12345 { ip6 saddr . meta iif timeout 600s counter }: This rule should not have failed.
ip6/flowtable.t: 2 unit tests, 2 error, 1 warning
Fix at least the non-json mode, I do not know how to fix up -j
or wheter the failure is actually correct.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
tests/py/ip/flowtable.t | 2 +-
tests/py/ip/flowtable.t.json | 24 -----------
tests/py/ip/flowtable.t.payload | 6 +--
tests/py/ip6/flowtable.t | 4 +-
tests/py/ip6/flowtable.t.json | 62 ----------------------------
tests/py/ip6/flowtable.t.json.output | 62 ----------------------------
tests/py/ip6/flowtable.t.payload | 6 +--
7 files changed, 7 insertions(+), 159 deletions(-)
delete mode 100644 tests/py/ip/flowtable.t.json
delete mode 100644 tests/py/ip6/flowtable.t.json
delete mode 100644 tests/py/ip6/flowtable.t.json.output
diff --git a/tests/py/ip/flowtable.t b/tests/py/ip/flowtable.t
index 086c6cf6b449..f1541fdca158 100644
--- a/tests/py/ip/flowtable.t
+++ b/tests/py/ip/flowtable.t
@@ -2,4 +2,4 @@
*ip;test-ip;input
-meter xyz size 8192 { ip saddr timeout 30s counter};ok
+meter xyz size 8192 { ip saddr timeout 30s counter};ok;update @xyz { ip saddr timeout 30s counter}
diff --git a/tests/py/ip/flowtable.t.json b/tests/py/ip/flowtable.t.json
deleted file mode 100644
index a03cc9d79350..000000000000
--- a/tests/py/ip/flowtable.t.json
+++ /dev/null
@@ -1,24 +0,0 @@
-# meter xyz size 8192 { ip saddr timeout 30s counter}
-[
- {
- "meter": {
- "key": {
- "elem": {
- "timeout": 30,
- "val": {
- "payload": {
- "field": "saddr",
- "protocol": "ip"
- }
- }
- }
- },
- "name": "xyz",
- "size": 8192,
- "stmt": {
- "counter": null
- }
- }
- }
-]
-
diff --git a/tests/py/ip/flowtable.t.payload b/tests/py/ip/flowtable.t.payload
index c0aad39ea193..3d18070b7217 100644
--- a/tests/py/ip/flowtable.t.payload
+++ b/tests/py/ip/flowtable.t.payload
@@ -1,7 +1,5 @@
# meter xyz size 8192 { ip saddr timeout 30s counter}
-xyz test-ip 31
-xyz test-ip 0
-ip test-ip input
+xyz test-ip 30 size 8192
+ip test-ip input
[ payload load 4b @ network header + 12 => reg 1 ]
[ dynset update reg_key 1 set xyz timeout 30000ms expr [ counter pkts 0 bytes 0 ] ]
-
diff --git a/tests/py/ip6/flowtable.t b/tests/py/ip6/flowtable.t
index e58d51bb9b8e..f8994bce9382 100644
--- a/tests/py/ip6/flowtable.t
+++ b/tests/py/ip6/flowtable.t
@@ -2,5 +2,5 @@
*ip6;test-ip6;input
-meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter };ok;meter acct_out size 4096 { iif . ip6 saddr timeout 10m counter }
-meter acct_out size 12345 { ip6 saddr . meta iif timeout 600s counter };ok;meter acct_out size 12345 { ip6 saddr . iif timeout 10m counter }
+meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter };ok;update @acct_out { iif . ip6 saddr timeout 10m counter }
+meter acct_out2 size 12345 { ip6 saddr . meta iif timeout 600s counter };ok;update @acct_out2 { ip6 saddr . iif timeout 10m counter }
diff --git a/tests/py/ip6/flowtable.t.json b/tests/py/ip6/flowtable.t.json
deleted file mode 100644
index d0b3a957f01b..000000000000
--- a/tests/py/ip6/flowtable.t.json
+++ /dev/null
@@ -1,62 +0,0 @@
-# meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }
-[
- {
- "meter": {
- "key": {
- "elem": {
- "timeout": 600,
- "val": {
- "concat": [
- {
- "meta": { "key": "iif" }
- },
- {
- "payload": {
- "field": "saddr",
- "protocol": "ip6"
- }
- }
- ]
- }
- }
- },
- "name": "acct_out",
- "size": 4096,
- "stmt": {
- "counter": null
- }
- }
- }
-]
-
-# meter acct_out size 12345 { ip6 saddr . meta iif timeout 600s counter }
-[
- {
- "meter": {
- "key": {
- "elem": {
- "timeout": 600,
- "val": {
- "concat": [
- {
- "payload": {
- "field": "saddr",
- "protocol": "ip6"
- }
- },
- {
- "meta": { "key": "iif" }
- }
- ]
- }
- }
- },
- "name": "acct_out",
- "size": 12345,
- "stmt": {
- "counter": null
- }
- }
- }
-]
-
diff --git a/tests/py/ip6/flowtable.t.json.output b/tests/py/ip6/flowtable.t.json.output
deleted file mode 100644
index d0b3a957f01b..000000000000
--- a/tests/py/ip6/flowtable.t.json.output
+++ /dev/null
@@ -1,62 +0,0 @@
-# meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }
-[
- {
- "meter": {
- "key": {
- "elem": {
- "timeout": 600,
- "val": {
- "concat": [
- {
- "meta": { "key": "iif" }
- },
- {
- "payload": {
- "field": "saddr",
- "protocol": "ip6"
- }
- }
- ]
- }
- }
- },
- "name": "acct_out",
- "size": 4096,
- "stmt": {
- "counter": null
- }
- }
- }
-]
-
-# meter acct_out size 12345 { ip6 saddr . meta iif timeout 600s counter }
-[
- {
- "meter": {
- "key": {
- "elem": {
- "timeout": 600,
- "val": {
- "concat": [
- {
- "payload": {
- "field": "saddr",
- "protocol": "ip6"
- }
- },
- {
- "meta": { "key": "iif" }
- }
- ]
- }
- }
- },
- "name": "acct_out",
- "size": 12345,
- "stmt": {
- "counter": null
- }
- }
- }
-]
-
diff --git a/tests/py/ip6/flowtable.t.payload b/tests/py/ip6/flowtable.t.payload
index 559475f6d2c6..f251289d4b88 100644
--- a/tests/py/ip6/flowtable.t.payload
+++ b/tests/py/ip6/flowtable.t.payload
@@ -1,16 +1,14 @@
# meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }
-acct_out test-ip6 31
acct_out test-ip6 0
ip6 test-ip6 input
[ meta load iif => reg 1 ]
[ payload load 16b @ network header + 8 => reg 9 ]
[ dynset update reg_key 1 set acct_out timeout 600000ms expr [ counter pkts 0 bytes 0 ] ]
-# meter acct_out size 12345 { ip6 saddr . meta iif timeout 600s counter }
-acct_out test-ip6 31
+# meter acct_out2 size 12345 { ip6 saddr . meta iif timeout 600s counter }
acct_out test-ip6 0
ip6 test-ip6 input
[ payload load 16b @ network header + 8 => reg 1 ]
[ meta load iif => reg 2 ]
- [ dynset update reg_key 1 set acct_out timeout 600000ms expr [ counter pkts 0 bytes 0 ] ]
+ [ dynset update reg_key 1 set acct_out2 timeout 600000ms expr [ counter pkts 0 bytes 0 ] ]
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH nft] tests/py: remove flow table json test cases
2024-03-13 14:13 [PATCH nft] tests/py: remove flow table json test cases Florian Westphal
@ 2024-03-13 16:26 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2024-03-13 16:26 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Wed, Mar 13, 2024 at 03:13:22PM +0100, Florian Westphal wrote:
> ip(6)/flowtable.t tests fail both for normal and json mode.
>
> WARNING: line 3: 'add rule ip test-ip input meter xyz size 8192 { ip saddr timeout 30s counter}': 'ip test-ip input' mismatches '[ payload load 4b @ network header + 12 => reg 1 ]'
> ip/lowtable.t.payload.got: WARNING: line 2: Wrote payload for rule meter xyz size 8192 { ip saddr timeout 30s counter}
> ip/flowtable.t: WARNING: line 5: 'add rule ip test-ip input meter xyz size 8192 { ip saddr timeout 30s counter}': 'meter xyz size 8192 { ip saddr timeout 30s counter}' mismatches 'update @xyz { ip saddr timeout 30s counter}'
> WARNING: line 3: 'add rule ip6 test-ip6 input meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }': 'ip6 test-ip6 input' mismatches '[ meta load iif => reg 1 ]'
> ip6/flowtable.t.payload.got: WARNING: line 2: Wrote payload for rule meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }
> ip6/flowtable.t: WARNING: line 5: 'add rule ip6 test-ip6 input meter acct_out size 4096 { meta iif . ip6 saddr timeout 600s counter }': 'meter acct_out size 4096 { iif . ip6 saddr timeout 10m counter }' mismatches 'update @acct_out { iif . ip6 saddr timeout 10m counter}'
> ip6/flowtable.t: ERROR: line 6: add rule ip6 test-ip6 input meter acct_out size 12345 { ip6 saddr . meta iif timeout 600s counter }: This rule should not have failed.
> ip6/flowtable.t: 2 unit tests, 2 error, 1 warning
>
> Fix at least the non-json mode, I do not know how to fix up -j
> or wheter the failure is actually correct.
For the record:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/20240313162317.192314-1-pablo@netfilter.org/
I can change patch subject if you like instead to:
tests: py: move meter tests to tests/shell
this transformation is hard to deal with from tests/py.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-13 16:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 14:13 [PATCH nft] tests/py: remove flow table json test cases Florian Westphal
2024-03-13 16:26 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.