diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:10:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:10:00 +0000 |
commit | 4ba2b326284765e942044db13a7f0dae702bec93 (patch) | |
tree | cbdfaec33eed4f3a970c54cd10e8ddfe3003b3b1 /xdp-trafficgen/tests/test-xdp-trafficgen.sh | |
parent | Initial commit. (diff) | |
download | xdp-tools-4ba2b326284765e942044db13a7f0dae702bec93.tar.xz xdp-tools-4ba2b326284765e942044db13a7f0dae702bec93.zip |
Adding upstream version 1.3.1.upstream/1.3.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xdp-trafficgen/tests/test-xdp-trafficgen.sh')
-rw-r--r-- | xdp-trafficgen/tests/test-xdp-trafficgen.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/xdp-trafficgen/tests/test-xdp-trafficgen.sh b/xdp-trafficgen/tests/test-xdp-trafficgen.sh new file mode 100644 index 0000000..a42032d --- /dev/null +++ b/xdp-trafficgen/tests/test-xdp-trafficgen.sh @@ -0,0 +1,42 @@ +XDP_LOADER=${XDP_LOADER:-./xdp-loader} +XDP_TRAFFICGEN=${XDP_TRAFFICGEN:-./xdp-trafficgen} +ALL_TESTS="test_udp test_tcp" + +PIDS="" + +skip_if_missing_kernel_support() +{ + $XDP_TRAFFICGEN probe + ret=$? + if [ "$ret" -eq "161" ]; then + exit $SKIPPED_TEST + elif [ "$ret" -ne "0" ]; then + exit 1 + fi +} + +test_udp() +{ + skip_if_missing_kernel_support + export XDP_SAMPLE_IMMEDIATE_EXIT=1 + + check_run $XDP_TRAFFICGEN udp $NS -n 1 +} + +test_tcp() +{ + skip_if_missing_kernel_support + export XDP_SAMPLE_IMMEDIATE_EXIT=1 + + PID=$(start_background_ns_devnull "nc -6 -l 10000") + $XDP_TRAFFICGEN tcp -i $NS $INSIDE_IP6 -n 1 + res=$? + stop_background $PID + return $res +} + +cleanup_tests() +{ + $XDP_LOADER unload $NS --all >/dev/null 2>&1 + $XDP_LOADER clean >/dev/null 2>&1 +} |