summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-07-19 00:06:12 +0200
committerFlorian Westphal <fw@strlen.de>2016-07-19 00:06:12 +0200
commit43d4b72aa45b669f839ef2c4e2eeb9bb316dd894 (patch)
tree588f25ddcdd9a5a9231791ac206d453a8770a37f /tests
parent211742c61945a60d12da19988fe32e530c485134 (diff)
meta: add tests for meta random
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/py/any/meta.t3
-rw-r--r--tests/py/any/meta.t.payload9
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/py/any/meta.t b/tests/py/any/meta.t
index 424cb188..909de8bc 100644
--- a/tests/py/any/meta.t
+++ b/tests/py/any/meta.t
@@ -200,3 +200,6 @@ meta cgroup {1048577-1048578};ok;cgroup { 1048577-1048578}
meta iif . meta oif { lo . eth0 };ok
meta iif . meta oif . meta mark { lo . eth0 . 0x0000000a };ok
meta iif . meta oif vmap { lo . eth0 : drop };ok
+
+meta random eq 1;ok;meta random 1
+meta random gt 1000000;ok;meta random > 1000000
diff --git a/tests/py/any/meta.t.payload b/tests/py/any/meta.t.payload
index d5848731..acd78510 100644
--- a/tests/py/any/meta.t.payload
+++ b/tests/py/any/meta.t.payload
@@ -781,3 +781,12 @@ ip test-ip4 output
[ meta load oif => reg 9 ]
[ lookup reg 1 set __map%d dreg 0 ]
+# meta random eq 1
+ip test-ip4 input
+ [ meta load prandom => reg 1 ]
+ [ cmp eq reg 1 0x01000000 ]
+
+# meta random gt 1000000
+ip test-ip4 input
+ [ meta load prandom => reg 1 ]
+ [ cmp gt reg 1 0x40420f00 ]