fin_ack_lat.sh 507 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0
  3. #
  4. # Test latency spikes caused by FIN/ACK handling race.
  5. set +x
  6. set -e
  7. tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)
  8. cleanup() {
  9. kill $(pidof fin_ack_lat)
  10. rm -f $tmpfile
  11. }
  12. trap cleanup EXIT
  13. do_test() {
  14. RUNTIME=$1
  15. ./fin_ack_lat | tee $tmpfile &
  16. PID=$!
  17. sleep $RUNTIME
  18. NR_SPIKES=$(wc -l $tmpfile | awk '{print $1}')
  19. if [ $NR_SPIKES -gt 0 ]
  20. then
  21. echo "FAIL: $NR_SPIKES spikes detected"
  22. return 1
  23. fi
  24. return 0
  25. }
  26. do_test "30"
  27. echo "test done"