Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / tools / testing / selftests / net / so_txtime.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 #
4 # Regression tests for the SO_TXTIME interface
5
6 # Run in network namespace
7 if [[ $# -eq 0 ]]; then
8         ./in_netns.sh $0 __subprocess
9         exit $?
10 fi
11
12 set -e
13
14 tc qdisc add dev lo root fq
15 ./so_txtime -4 -6 -c mono a,-1 a,-1
16 ./so_txtime -4 -6 -c mono a,0 a,0
17 ./so_txtime -4 -6 -c mono a,10 a,10
18 ./so_txtime -4 -6 -c mono a,10,b,20 a,10,b,20
19 ./so_txtime -4 -6 -c mono a,20,b,10 b,20,a,20
20
21 if tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 200000; then
22         ! ./so_txtime -4 -6 -c tai a,-1 a,-1
23         ! ./so_txtime -4 -6 -c tai a,0 a,0
24         ./so_txtime -4 -6 -c tai a,10 a,10
25         ./so_txtime -4 -6 -c tai a,10,b,20 a,10,b,20
26         ./so_txtime -4 -6 -c tai a,20,b,10 b,10,a,20
27 else
28         echo "tc ($(tc -V)) does not support qdisc etf. skipping"
29 fi
30
31 echo OK. All tests passed