Skip to content

Commit

Permalink
[Bugfix] Bugfix for getting maximum matching length of conditional ma…
Browse files Browse the repository at this point in the history
…rk. (sonic-net#14515)

Description of PR
We changed the matching rule of conditional mark in PR sonic-net#14395. There is a bug when getting the maximum matching length. In this PR, we fix this bug.

Approach
What is the motivation for this PR?
We changed the matching rule of conditional mark in PR sonic-net#14395. There is a bug when getting the maximum matching length. In this PR, we fix this bug.

co-authorized by: jianquanye@microsoft.com
  • Loading branch information
yutongzhang-microsoft authored and hdwhdw committed Sep 20, 2024
1 parent 745ffc6 commit c079079
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/common/plugins/conditional_mark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def find_all_matches(nodeid, conditions):
marks = match[case_starting_substring].keys()
for mark in marks:
if mark in conditional_marks:
if length > max_length:
if length >= max_length:
conditional_marks.update({
mark: {
case_starting_substring: {
Expand All @@ -441,6 +441,7 @@ def find_all_matches(nodeid, conditions):
case_starting_substring: {
mark: match[case_starting_substring][mark]}
}})
max_length = length

# We may have the same matches of different marks
# Need to remove duplicate here
Expand Down

0 comments on commit c079079

Please sign in to comment.