Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # SPDX-License-Identifier: GPL-2.0
0003 #
0004 # Test latency spikes caused by FIN/ACK handling race.
0005 
0006 set +x
0007 set -e
0008 
0009 tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)
0010 
0011 cleanup() {
0012         kill $(pidof fin_ack_lat)
0013         rm -f $tmpfile
0014 }
0015 
0016 trap cleanup EXIT
0017 
0018 do_test() {
0019         RUNTIME=$1
0020 
0021         ./fin_ack_lat | tee $tmpfile &
0022         PID=$!
0023 
0024         sleep $RUNTIME
0025         NR_SPIKES=$(wc -l $tmpfile | awk '{print $1}')
0026         if [ $NR_SPIKES -gt 0 ]
0027         then
0028                 echo "FAIL: $NR_SPIKES spikes detected"
0029                 return 1
0030         fi
0031         return 0
0032 }
0033 
0034 do_test "30"
0035 echo "test done"