* binutils-all/readelf.exp (regexp_diff): Delete.

This commit is contained in:
Richard Earnshaw 2007-04-21 19:01:20 +00:00
parent 541d2ffd36
commit d301303549
2 changed files with 4 additions and 102 deletions

View file

@ -1,3 +1,7 @@
2007-04-21 Richard Earnshaw <rearnsha@arm.com>
* binutils-all/readelf.exp (regexp_diff): Delete.
2007-04-20 Richard Earnshaw <rearnsha@arm.com>
* binutils-all/arm/thumb2-cond.s: Allow for tab expansion by the pty.

View file

@ -31,108 +31,6 @@ proc file_contents { filename } {
return $contents
}
# regexp_diff, based on simple_diff taken from ld test suite
# compares two files line-by-line
# file1 contains strings, file2 contains regexps and #-comments
# blank lines are ignored in either file
# returns non-zero if differences exist
#
proc regexp_diff { file_1 file_2 } {
set eof -1
set end_1 0
set end_2 0
set differences 0
set diff_pass 0
if [file exists $file_1] then {
set file_a [open $file_1 r]
} else {
warning "$file_1 doesn't exist"
return 1
}
if [file exists $file_2] then {
set file_b [open $file_2 r]
} else {
fail "$file_2 doesn't exist"
close $file_a
return 1
}
verbose " Regexp-diff'ing: $file_1 $file_2" 2
while { 1 } {
set line_a ""
set line_b ""
while { [string length $line_a] == 0 } {
if { [gets $file_a line_a] == $eof } {
set end_1 1
break
}
}
while { [string length $line_b] == 0 || [string match "#*" $line_b] } {
if [ string match "#pass" $line_b ] {
set end_2 1
set diff_pass 1
break
} elseif [ string match "#..." $line_b ] {
if { [gets $file_b line_b] == $eof } {
set end_2 1
break
}
verbose "looking for \"^$line_b$\"" 3
while { ![regexp "^$line_b$" "$line_a"] } {
verbose "skipping \"$line_a\"" 3
if { [gets $file_a line_a] == $eof } {
set end_1 1
break
}
}
break
}
if { [gets $file_b line_b] == $eof } {
set end_2 1
break
}
}
if { $diff_pass } {
break
} elseif { $end_1 && $end_2 } {
break
} elseif { $end_1 } {
send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3
set differences 1
break
} elseif { $end_2 } {
send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n"
verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3
set differences 1
break
} else {
verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
if ![regexp "^$line_b$" "$line_a"] {
send_log "regexp_diff match failure\n"
send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n"
set differences 1
}
}
}
if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } {
send_log "$file_1 and $file_2 are different lengths\n"
verbose "$file_1 and $file_2 are different lengths" 3
set differences 1
}
close $file_a
close $file_b
return $differences
}
# Find out the size by reading the output of the EI_CLASS field.
# Similar to the test for readelf -h, but we're just looking for the
# EI_CLASS line here.