1*4882a593Smuzhiyun#!/bin/bash 2*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# Regression tests for the SO_TXTIME interface 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun# Run in network namespace 7*4882a593Smuzhiyunif [[ $# -eq 0 ]]; then 8*4882a593Smuzhiyun if ! ./in_netns.sh $0 __subprocess; then 9*4882a593Smuzhiyun # test is time sensitive, can be flaky 10*4882a593Smuzhiyun echo "test failed: retry once" 11*4882a593Smuzhiyun ./in_netns.sh $0 __subprocess 12*4882a593Smuzhiyun fi 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun exit $? 15*4882a593Smuzhiyunfi 16*4882a593Smuzhiyun 17*4882a593Smuzhiyunset -e 18*4882a593Smuzhiyun 19*4882a593Smuzhiyuntc qdisc add dev lo root fq 20*4882a593Smuzhiyun./so_txtime -4 -6 -c mono a,-1 a,-1 21*4882a593Smuzhiyun./so_txtime -4 -6 -c mono a,0 a,0 22*4882a593Smuzhiyun./so_txtime -4 -6 -c mono a,10 a,10 23*4882a593Smuzhiyun./so_txtime -4 -6 -c mono a,10,b,20 a,10,b,20 24*4882a593Smuzhiyun./so_txtime -4 -6 -c mono a,20,b,10 b,20,a,20 25*4882a593Smuzhiyun 26*4882a593Smuzhiyunif tc qdisc replace dev lo root etf clockid CLOCK_TAI delta 400000; then 27*4882a593Smuzhiyun ! ./so_txtime -4 -6 -c tai a,-1 a,-1 28*4882a593Smuzhiyun ! ./so_txtime -4 -6 -c tai a,0 a,0 29*4882a593Smuzhiyun ./so_txtime -4 -6 -c tai a,10 a,10 30*4882a593Smuzhiyun ./so_txtime -4 -6 -c tai a,10,b,20 a,10,b,20 31*4882a593Smuzhiyun ./so_txtime -4 -6 -c tai a,20,b,10 b,10,a,20 32*4882a593Smuzhiyunelse 33*4882a593Smuzhiyun echo "tc ($(tc -V)) does not support qdisc etf. skipping" 34*4882a593Smuzhiyunfi 35*4882a593Smuzhiyun 36*4882a593Smuzhiyunecho OK. All tests passed 37