.. | .. |
---|
7 | 7 | readonly YELLOW='\033[0;33m' |
---|
8 | 8 | readonly RED='\033[0;31m' |
---|
9 | 9 | readonly NC='\033[0m' # No Color |
---|
| 10 | +readonly TESTPORT=8000 |
---|
10 | 11 | |
---|
11 | 12 | readonly KSFT_PASS=0 |
---|
12 | 13 | readonly KSFT_FAIL=1 |
---|
.. | .. |
---|
56 | 57 | |
---|
57 | 58 | run_one() { |
---|
58 | 59 | local -r args=$@ |
---|
| 60 | + local nr_socks=0 |
---|
| 61 | + local i=0 |
---|
| 62 | + local -r timeout=10 |
---|
59 | 63 | |
---|
60 | | - ./udpgso_bench_rx & |
---|
61 | | - ./udpgso_bench_rx -t & |
---|
| 64 | + ./udpgso_bench_rx -p "$TESTPORT" & |
---|
| 65 | + ./udpgso_bench_rx -p "$TESTPORT" -t & |
---|
62 | 66 | |
---|
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} |
---|
64 | 80 | } |
---|
65 | 81 | |
---|
66 | 82 | run_in_netns() { |
---|