WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / net / fin_ack_lat.sh
bloba3ff6e0b2c7a6df39390230c474e2f48c8725ac8
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # Test latency spikes caused by FIN/ACK handling race.
6 set +x
7 set -e
9 tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)
11 cleanup() {
12 kill $(pidof fin_ack_lat)
13 rm -f $tmpfile
16 trap cleanup EXIT
18 do_test() {
19 RUNTIME=$1
21 ./fin_ack_lat | tee $tmpfile &
22 PID=$!
24 sleep $RUNTIME
25 NR_SPIKES=$(wc -l $tmpfile | awk '{print $1}')
26 if [ $NR_SPIKES -gt 0 ]
27 then
28 echo "FAIL: $NR_SPIKES spikes detected"
29 return 1
31 return 0
34 do_test "30"
35 echo "test done"