Skip to content

Commit dfa40b7

Browse files
fnordahligsilya
authored andcommitted
tests: Fix QoS tests for tc rounding behavior change.
The tc command from iproute2 changed its rounding behavior in commit d947f365602b ("tc: Fix rounding in tc_calc_xmittime and tc_calc_xmitsize."). This caused the "QoS - basic configuration", "QoS - 64bit" and "Ingress Policing - 64-bit" tests to fail because they were matching exact burst and cburst values in tc output. For consistency and as a proactive measure in case of further changes to tc, the following tests are also updated, although they are currently not directly affected: "offloads - set ingress_policing_rate and ingress_policing_burst - offloads disabled" "offloads - set ingress_policing_rate and ingress_policing_burst - offloads enabled" The rounding fix means that burst and cburst values may differ slightly from previous versions. For example, values that were previously 750000 might now be 749999 or similar variations. To maintain compatibility with both old and new versions of tc, the test assertions now use pattern matching with dots that: - Matches the most significant digit of the value - Uses dots to match any character for remaining digits - Maintains the correct total number of digits - Preserves the unit suffix (e.g., 'b' for bytes) For example, '375000b' now matches '3.....b' which accepts any 6-digit value starting with 3, allowing for rounding differences while still validating the general magnitude is correct. This follows the same approach as the related OVN patch: https://mail.openvswitch.org/pipermail/ovs-dev/2025-December/428593.html Reported-at: https://launchpad.net/bugs/2129005 Assisted-by: claude-sonnet-4.5, GitHub Copilot CLI Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
1 parent c682d7c commit dfa40b7

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

tests/system-offloads-traffic.at

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,10 @@ AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10])
106106
AT_CHECK([ovs-vsctl --columns=other_config list open], [0], [dnl
107107
other_config : {hw-offload="false"}
108108
])
109+
m4_define([POLICE_CONF], [rate 100Kbit burst 1...b])
109110
AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress |
110-
sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'],
111-
[0],[dnl
112-
rate 100Kbit burst 1280b
113-
])
111+
sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q' |
112+
grep -q 'POLICE_CONF'])
114113
AT_CHECK([tc -s -d filter show dev ovs-p0 ingress |
115114
grep -E "basic|matchall" > /dev/null], [0])
116115
OVS_TRAFFIC_VSWITCHD_STOP
@@ -128,11 +127,10 @@ AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10])
128127
AT_CHECK([ovs-vsctl --columns=other_config list open], [0], [dnl
129128
other_config : {hw-offload="true"}
130129
])
130+
m4_define([POLICE_CONF], [rate 100Kbit burst 1...b])
131131
AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress |
132-
sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'],
133-
[0],[dnl
134-
rate 100Kbit burst 1280b
135-
])
132+
sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q' |
133+
grep -q 'POLICE_CONF'])
136134
AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress | grep matchall |
137135
sed -n 's/.*\(matchall\).*/\1/; T; p; q'], [0], [dnl
138136
matchall

tests/system-traffic.at

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,8 +3242,8 @@ OVS_WAIT_UNTIL([tc qdisc show dev ovs-tap0 | grep -q htb])
32423242
OVS_WAIT_UNTIL([tc qdisc show dev ovs-tap1 | grep -q htb])
32433243

32443244
dnl Check the configuration.
3245-
m4_define([HTB_CONF0], [rate 2Mbit ceil 3Mbit burst 375000b cburst 375000b])
3246-
m4_define([HTB_CONF1], [rate 4Mbit ceil 5Gbit burst 500000b cburst 500000b])
3245+
m4_define([HTB_CONF0], [rate 2Mbit ceil 3Mbit burst 3.....b cburst 3.....b])
3246+
m4_define([HTB_CONF1], [rate 4Mbit ceil 5Gbit burst 5.....b cburst 5.....b])
32473247
AT_CHECK([tc class show dev ovs-tap0 | grep -q 'class htb .* HTB_CONF0'])
32483248
AT_CHECK([tc class show dev ovs-tap0 | grep -q 'class htb .* HTB_CONF1'])
32493249
AT_CHECK([tc class show dev ovs-tap1 | grep -q 'class htb .* HTB_CONF0'])
@@ -3273,7 +3273,7 @@ AT_CHECK([ovs-vsctl set port ovs-p0 qos=@qos -- set port ovs-p1 qos=@qos dnl
32733273
OVS_WAIT_UNTIL([tc qdisc show dev ovs-p0 | grep -q htb])
32743274
OVS_WAIT_UNTIL([tc qdisc show dev ovs-p1 | grep -q htb])
32753275

3276-
m4_define([HTB_CONF], [rate 40Gbit ceil 50Gbit burst 620000b cburst 618750b])
3276+
m4_define([HTB_CONF], [rate 40Gbit ceil 50Gbit burst 6.....b cburst 6.....b])
32773277
AT_CHECK([tc class show dev ovs-p0 | grep -q 'class htb .* HTB_CONF'])
32783278
AT_CHECK([tc class show dev ovs-p1 | grep -q 'class htb .* HTB_CONF'])
32793279

@@ -3290,10 +3290,10 @@ ADD_VETH(p0, ns0, br0, "10.1.1.1/24")
32903290
AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_rate=50000000])
32913291
AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=400000])
32923292

3293+
m4_define([POLICE_CONF], [rate 50Gbit burst 7.......b])
32933294
AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress |
3294-
sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'],
3295-
[0],[dnl
3296-
rate 50Gbit burst 74500000b
3295+
sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q' |
3296+
grep -q 'POLICE_CONF'
32973297
])
32983298

32993299
AT_CHECK([tc -s -d filter show dev ovs-p0 ingress |

0 commit comments

Comments
 (0)