MCPcopy Create free account
hub / github.com/FastLED/FastLED / audit_memory_classification

Function audit_memory_classification

ci/tools/audit_memory_classification.py:94–180  ·  view source on GitHub ↗

Check all boards against expected memory classification.

()

Source from the content-addressed store, hash-verified

92
93
94def audit_memory_classification():
95 """Check all boards against expected memory classification."""
96 print("=" * 70)
97 print("MEMORY CLASSIFICATION AUDIT")
98 print("=" * 70)
99 print()
100
101 errors: list[str] = []
102 warnings: list[str] = []
103 passed = 0
104 total = 0
105
106 # Check boards we have explicit expectations for
107 checked_boards: set[str] = set()
108
109 for board in sorted(ALL, key=lambda b: b.board_name):
110 total += 1
111 board_name = board.board_name
112 checked_boards.add(board_name)
113
114 # Find expected classification
115 expected = None
116 for name_pattern, memory_class in EXPECTED_MEMORY_BY_PATTERN:
117 if board_name == name_pattern:
118 expected = memory_class
119 break
120
121 try:
122 actual = board.memory_class
123 except AttributeError as e:
124 print(f"✗ {board_name:25} ERROR: {e}")
125 print(f" Board type: {type(board)}")
126 print(f" Board repr: {repr(board)}")
127 errors.append(f"{board_name}: AttributeError - {e}")
128 continue
129
130 if expected is None:
131 # No explicit expectation - just log board properties for review
132 print(
133 f"ℹ️ {board_name:25} memory={actual:4} platform={board.platform_family:10} target={board.get_mcu_target() or 'N/A':15}"
134 )
135 continue
136
137 if expected == actual:
138 passed += 1
139 print(f"✓ {board_name:25} memory={actual:4} (as expected)")
140 else:
141 error_msg = f"{board_name}: expected {expected}, got {actual}"
142 errors.append(error_msg)
143 print(f"✗ {board_name:25} memory={actual:4} [EXPECTED {expected}]")
144
145 print()
146 print("=" * 70)
147 print("AUDIT RESULTS")
148 print("=" * 70)
149 print(f"Total boards checked: {total}")
150 print(f"Passed: {passed}")
151 print(f"Failed: {len(errors)}")

Callers 1

mainFunction · 0.85

Calls 5

printFunction · 0.50
setClass · 0.50
addMethod · 0.45
appendMethod · 0.45
get_mcu_targetMethod · 0.45

Tested by

no test coverage detected