tests: nfct: make it suitable for CI pipeline
Florian Westphal
maintainerPATCH 1/1 tests: nfct: make it suitable for CI pipeline
1. make run-test.sh call test prog via unshare -n.
2. remove various modprobe calls, these are all built into nf_conntrack.ko.
3. make test.c exit nonzero when bad tests are detected.
4. remove dccp+udplite, they fail on modern kernels due to removal of these protocols.
5. update test-live.sh. Auto-rexec via unshare. Streamline output:
Check timeout policy test-generic for protocol 13
[NEW] unknown 13 3 src=10.0.0.1 dst=8.8.8.8 [UNREPLIED] src=8.8.8.8 dst=10.0.0.1
Check timeout policy test-tcp for protocol tcp
[NEW] tcp 6 2 SYN_SENT src=10.0.0.1 dst=8.8.8.8 sport=5050 dport=80 [UNREPLIED] src=8.8.8.8 dst=10.0.0.1 sport=80 dport=5050
Check timeout policy test-icmp for protocol icmp
[NEW] icmp 1 4 src=10.0.0.1 dst=8.8.8.8 type=8 code=0 id=41473 [UNREPLIED] src=8.8.8.8 dst=10.0.0.1 type=0 code=0 id=41473The effective timeout is validated by checking the new timeout reported via ctnetlink.
Signed-off-by Florian Westphal <[email protected]>
--- tests/nfct/run-test.sh | 15 +---- tests/nfct/test-live.sh | 125 +++++++++++++++++++++++------------ tests/nfct/test.c | 4 ++ tests/nfct/timeout/03udplite | 16 ----- tests/nfct/timeout/07dccp | 16 ----- 5 files changed, 89 insertions(+), 87 deletions(-) mode change 100644 => 100755 tests/nfct/run-test.sh mode change 100644 => 100755 tests/nfct/test-live.sh delete mode 100644 tests/nfct/timeout/03udplite delete mode 100644 tests/nfct/timeout/07dccp
tests/nfct/run-test.sh +2 -13
@@ -7,16 +7,5 @@ then exit 1 fi -gcc test.c -o test -# -# XXX: module auto-load not support by nfnetlink_cttimeout yet :-( -# -# any or all of these might be built-ins rather than modules, so don't error -# out on failure from modprobe -modprobe nf_conntrack_ipv4 || true -modprobe nf_conntrack_ipv6 || true -modprobe nf_conntrack_proto_udplite || true -modprobe nf_conntrack_proto_sctp || true -modprobe nf_conntrack_proto_dccp || true -modprobe nf_conntrack_proto_gre || true -./test timeout +test -x test || gcc test.c -o test +exec unshare -n ./test timeout
tests/nfct/test-live.sh +83 -42
154 lines not on this page · raw message
tests/nfct/test.c +4 -0
@@ -97,4 +97,8 @@ int main(int argc, char *argv[])closedir (d);fprintf (stdout,"OK: %d BAD: %d\n" , ok, bad); +if (bad) +return 1 ; + +return ok >0 ?0 :1 ; }
tests/nfct/timeout/03udplite deleted +0 -16
@@ -1,16 +0,0 @@ -# add policy object `test' -nfct add timeout test inet udplite unreplied 10 ; OK -# get policy object `test' -nfct get timeout test ; OK -# delete policy object `test' -nfct delete timeout test ; OK -# get unexistent policy object `dummy' -nfct get timeout test ; BAD -# delete policy object `test', however, it does not exists anymore -nfct delete timeout test ; BAD -# add policy object `test' -nfct add timeout test inet udplite unreplied 1 replied 2 ; OK -# get policy object `test' -nfct get timeout test ; OK -# delete policy object `test' -nfct delete timeout test ; OK
tests/nfct/timeout/07dccp deleted +0 -16
@@ -1,16 +0,0 @@ -# add policy object `test' -nfct add timeout test inet dccp request 100 ; OK -# get policy object `test' -nfct get timeout test ; OK -# delete policy object `test' -nfct delete timeout test ; OK -# get unexistent policy object `dummy' -nfct get timeout test ; BAD -# delete policy object `test', however, it does not exists anymore -nfct delete timeout test ; BAD -# add policy object `test' -nfct add timeout test inet dccp request 1 respond 2 partopen 3 open 4 closereq 5 closing 6 timewait 7 ; OK -# get policy object `test' -nfct get timeout test ; OK -# delete policy object `test' -nfct delete timeout test ; OK
Signature · 1 line
2.53.0