summaryrefslogtreecommitdiffstats
path: root/tests/py/arp/arp.t.payload
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-04-10 19:00:24 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-04-11 09:57:28 +0200
commite760d200a4b9cd31928b68a1f2f882157344351e (patch)
tree036bb19faa6f17ff5eec97520ea8caa4b18e56e7 /tests/py/arp/arp.t.payload
parent4885331de84cbb895d31b83696a9b6d6542f2a81 (diff)
tests/py: Use libnftables instead of calling nft binary
This adds a simple nftables Python class in py/nftables.py which gives access to libnftables API via ctypes module. nft-test.py is extended to make use of the above class instead of calling nft binary. Since command line formatting had to be touched anyway, this patch also streamlines things a bit by introducing __str__ methods to classes Table and Chain and making extensive use of format strings instead of onerously adding all string parts together. Since the called commands don't see a shell anymore, all shell meta character escaping done in testcases is removed. The visible effects of this change are: * Four new warnings in ip/flowtable.t due to changing objref IDs (will be addressed later in a patch to libnftnl). * Reported command line in warning and error messages changed slightly for obvious reasons. * Reduction of a full test run's runtime by a factor of four. Status diff after running with 'time': < 83 test files, 77 files passed, 1724 unit tests, 0 error, 33 warning < 87.23user 696.13system 15:11.82elapsed 85%CPU (0avgtext+0avgdata 9604maxresident)k < 8inputs+36800outputs (0major+35171235minor)pagefaults 0swaps > 83 test files, 77 files passed, 1724 unit tests, 4 error, 33 warning > 6.80user 30.18system 3:45.86elapsed 16%CPU (0avgtext+0avgdata 14064maxresident)k > 0inputs+35808outputs (0major+2874minor)pagefaults 0swaps Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py/arp/arp.t.payload')
-rw-r--r--tests/py/arp/arp.t.payload2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/py/arp/arp.t.payload b/tests/py/arp/arp.t.payload
index 34ae2414..bb95e1c1 100644
--- a/tests/py/arp/arp.t.payload
+++ b/tests/py/arp/arp.t.payload
@@ -268,7 +268,7 @@ arp test-arp input
[ payload load 2b @ network header + 6 => reg 1 ]
[ cmp neq reg 1 0x00000200 ]
-# meta iifname \"invalid\" arp ptype 0x0800 arp htype 1 arp hlen 6 arp plen 4 @nh,192,32 0xc0a88f10 @nh,144,48 set 0x112233445566
+# meta iifname "invalid" arp ptype 0x0800 arp htype 1 arp hlen 6 arp plen 4 @nh,192,32 0xc0a88f10 @nh,144,48 set 0x112233445566
arp test-arp input
[ meta load iifname => reg 1 ]
[ cmp eq reg 1 0x61766e69 0x0064696c 0x00000000 0x00000000 ]