Skip to content

Commit de7c911

Browse files
committed
contest: env_check: try to ignore carrier state changes
Carrier state changes are not a real problem. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 56ddfdd commit de7c911

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

contest/scripts/env_check.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ def collect_system_state():
6262
return state
6363

6464

65+
def is_linkstate(a, b, path):
66+
"""System state key is related to carrier (whether link has come up, yet)"""
67+
68+
if path.startswith(".links."):
69+
if path.endswith(".operstate"):
70+
return True
71+
if path.endswith(".flags"):
72+
a = set(a)
73+
b = set(b)
74+
diff = a ^ b
75+
return not (diff - {'NO-CARRIER', 'LOWER_UP'})
76+
return False
77+
6578
def compare_states(current, saved, path=""):
6679
"""Compare current system state with saved state."""
6780

@@ -79,7 +92,8 @@ def compare_states(current, saved, path=""):
7992
if current != saved:
8093
print(f"Saved {path}:", saved)
8194
print(f"Current {path}:", current)
82-
ret = 1
95+
96+
ret |= not is_linkstate(current, saved, path)
8397

8498
return ret
8599

0 commit comments

Comments
 (0)