| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 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 | if ! ./in_netns.sh $0 __subprocess; then |
| 9 | # test is time sensitive, can be flaky |
| 10 | echo "test failed: retry once" |
| 11 | ./in_netns.sh $0 __subprocess |
| 12 | fi |
| 13 | |
| 14 | exit $? |
| 15 | fi |
| 16 | |
| 17 | set -e |
| 18 | |
| 19 | tc qdisc add dev lo root fq |
| 20 | ./so_txtime -4 -6 -c mono a,-1 a,-1 |
| 21 | ./so_txtime -4 -6 -c mono a,0 a,0 |
| 22 | ./so_txtime -4 -6 -c mono a,10 a,10 |
| 23 | ./so_txtime -4 -6 -c mono a,10,b,20 a,10,b,20 |
| 24 | ./so_txtime -4 -6 -c mono a,20,b,10 b,20,a,20 |
| 25 | |
| 26 | if tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 400000; then |
| 27 | ! ./so_txtime -4 -6 -c tai a,-1 a,-1 |
| 28 | ! ./so_txtime -4 -6 -c tai a,0 a,0 |
| 29 | ./so_txtime -4 -6 -c tai a,10 a,10 |
| 30 | ./so_txtime -4 -6 -c tai a,10,b,20 a,10,b,20 |
| 31 | ./so_txtime -4 -6 -c tai a,20,b,10 b,10,a,20 |
| 32 | else |
| 33 | echo "tc ($(tc -V)) does not support qdisc etf. skipping" |
| 34 | fi |
| 35 | |
| 36 | echo OK. All tests passed |