mirror of
https://github.com/Architeuthis-Flux/JumperlessV5.git
synced 2025-09-05 10:47:58 +00:00
61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify node file validation and repair functionality.
|
|
This script simulates the bad data scenario reported by the user.
|
|
"""
|
|
|
|
# Test case showing the bad data that was causing the issue
|
|
bad_nodefile_content = """
|
|
Slot 0 <--- current slot
|
|
nodeFileSlot0.txt
|
|
|
|
f {
|
|
ILES,
|
|
BUFFER_IN-DAC0,
|
|
GPIO_3-D2,
|
|
GPIO_4-D3,
|
|
UART_RX-D1,
|
|
UART_TX-D0,
|
|
}
|
|
"""
|
|
|
|
# Expected output after repair
|
|
expected_repaired_content = """
|
|
{
|
|
BUFFER_IN-DAC0,
|
|
GPIO_3-D2,
|
|
GPIO_4-D3,
|
|
UART_RX-D1,
|
|
UART_TX-D0,
|
|
}
|
|
"""
|
|
|
|
print("Node File Validation and Repair Test")
|
|
print("====================================")
|
|
print()
|
|
|
|
print("Original problematic content:")
|
|
print(bad_nodefile_content.strip())
|
|
print()
|
|
|
|
print("Expected behavior:")
|
|
print("1. System detects 'ILES,' as invalid connection (no dash)")
|
|
print("2. System removes the malformed line")
|
|
print("3. System validates remaining connections")
|
|
print("4. System saves repaired file")
|
|
print("5. System continues normal operation")
|
|
print()
|
|
|
|
print("Functions added to FileParsing.cpp:")
|
|
print("- validateAndRepairNodeFile() - Main validation and repair function")
|
|
print("- attemptNodeFileRepair() - Cleans up malformed connections")
|
|
print("- openNodeFile() now validates before parsing")
|
|
print()
|
|
|
|
print("Recovery process:")
|
|
print("1. If validation fails, attempt repair by removing bad lines")
|
|
print("2. If repair fails, clear the file entirely")
|
|
print("3. System remains responsive and functional")
|
|
print()
|
|
|
|
print("This prevents the infinite loop/unresponsive behavior reported.") |