summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/fin_ack_lat.sh
blob: a3ff6e0b2c7a6df39390230c474e2f48c8725ac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Test latency spikes caused by FIN/ACK handling race.

set +x
set -e

tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)

cleanup() {
	kill $(pidof fin_ack_lat)
	rm -f $tmpfile
}

trap cleanup EXIT

do_test() {
	RUNTIME=$1

	./fin_ack_lat | tee $tmpfile &
	PID=$!

	sleep $RUNTIME
	NR_SPIKES=$(wc -l $tmpfile | awk '{print $1}')
	if [ $NR_SPIKES -gt 0 ]
	then
		echo "FAIL: $NR_SPIKES spikes detected"
		return 1
	fi
	return 0
}

do_test "30"
echo "test done"