Make diff_files/diff_files_sorted error on mismatch

Previously these functions returned 1 on mismatch but no caller
checked the return value, allowing roundtrip failures to go
undetected. Now they call error() so the sta process exits
non-zero and the regression runner catches the failure.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
This commit is contained in:
Jaehyun Kim 2026-04-06 14:29:23 +09:00
parent b6429ffe95
commit b30c82b2d0
1 changed files with 3 additions and 10 deletions

View File

@ -56,14 +56,10 @@ proc diff_files_sorted { file1 file2 } {
} else {
for {set i 0} {$i < [llength $lines1] && $i < [llength $lines2]} {incr i} {
if { [lindex $lines1 $i] ne [lindex $lines2 $i] } {
puts "Differences found (sorted)."
puts "[lindex $lines1 $i]"
puts "[lindex $lines2 $i]"
return 1
error "diff_files_sorted: $file1 vs $file2 differ at sorted line $i\n< [lindex $lines1 $i]\n> [lindex $lines2 $i]"
}
}
puts "Differences found (sorted): file lengths differ."
return 1
error "diff_files_sorted: $file1 vs $file2 differ: file lengths differ"
}
}
@ -106,10 +102,7 @@ proc diff_files { file1 file2 { ignore "" } } {
close $stream1
close $stream2
if { $found_diff || $line1_length != $line2_length } {
puts "Differences found at line $line."
puts "$line1"
puts "$line2"
return 1
error "diff_files: $file1 vs $file2 differ at line $line\n< $line1\n> $line2"
} else {
puts "No differences found."
return 0