hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/tools/testing/selftests/net/udpgso_bench.sh
....@@ -7,6 +7,7 @@
77 readonly YELLOW='\033[0;33m'
88 readonly RED='\033[0;31m'
99 readonly NC='\033[0m' # No Color
10
+readonly TESTPORT=8000
1011
1112 readonly KSFT_PASS=0
1213 readonly KSFT_FAIL=1
....@@ -56,11 +57,26 @@
5657
5758 run_one() {
5859 local -r args=$@
60
+ local nr_socks=0
61
+ local i=0
62
+ local -r timeout=10
5963
60
- ./udpgso_bench_rx &
61
- ./udpgso_bench_rx -t &
64
+ ./udpgso_bench_rx -p "$TESTPORT" &
65
+ ./udpgso_bench_rx -p "$TESTPORT" -t &
6266
63
- ./udpgso_bench_tx ${args}
67
+ # Wait for the above test program to get ready to receive connections.
68
+ while [ "$i" -lt "$timeout" ]; do
69
+ nr_socks="$(ss -lnHi | grep -c "\*:${TESTPORT}")"
70
+ [ "$nr_socks" -eq 2 ] && break
71
+ i=$((i + 1))
72
+ sleep 1
73
+ done
74
+ if [ "$nr_socks" -ne 2 ]; then
75
+ echo "timed out while waiting for udpgso_bench_rx"
76
+ exit 1
77
+ fi
78
+
79
+ ./udpgso_bench_tx -p "$TESTPORT" ${args}
6480 }
6581
6682 run_in_netns() {