mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-14 04:43:38 +08:00
2010-08-02 Tristan Gingold <gingold@adacore.com>
* lib/gas-defs.exp (get_standard_section_names): New function. (run_dump_tests): Document the new behavior for objdump, document to new section-subst option. Automatically perform substitutions for objdump. (objdump_finish): Add REF_SUBST argument. (run_list_test): Adjust call of regexp_diff. (run_list_test_stdin): Ditto. * gas/all/gas.exp (test_cond): Adjust call of regexp_diff. * gas/symver/symver.exp (run_error_test): Ditto. * gas/mt/relocs.exp (regexp_test): Ditto. * gas/mep/complex-relocs.exp (regexp_test): Ditto. * gas/m68k/all.exp: Ditto. * gas/elf/elf.exp (run_elf_list_test): Ditto. * gas/rx/rx-asm-good.d: Set section-subst to no.
This commit is contained in:
parent
cd94c7fbb3
commit
b27423bb54
@ -1,3 +1,20 @@
|
|||||||
|
2010-08-02 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
|
* lib/gas-defs.exp (get_standard_section_names): New function.
|
||||||
|
(run_dump_tests): Document the new behavior for objdump,
|
||||||
|
document to new section-subst option. Automatically perform
|
||||||
|
substitutions for objdump.
|
||||||
|
(objdump_finish): Add REF_SUBST argument.
|
||||||
|
(run_list_test): Adjust call of regexp_diff.
|
||||||
|
(run_list_test_stdin): Ditto.
|
||||||
|
* gas/all/gas.exp (test_cond): Adjust call of regexp_diff.
|
||||||
|
* gas/symver/symver.exp (run_error_test): Ditto.
|
||||||
|
* gas/mt/relocs.exp (regexp_test): Ditto.
|
||||||
|
* gas/mep/complex-relocs.exp (regexp_test): Ditto.
|
||||||
|
* gas/m68k/all.exp: Ditto.
|
||||||
|
* gas/elf/elf.exp (run_elf_list_test): Ditto.
|
||||||
|
* gas/rx/rx-asm-good.d: Set section-subst to no.
|
||||||
|
|
||||||
2010-08-02 Alan Modra <amodra@gmail.com>
|
2010-08-02 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* gas/i386/i386.exp (dw2-compress-1): Only run on ELF targets.
|
* gas/i386/i386.exp (dw2-compress-1): Only run on ELF targets.
|
||||||
|
@ -287,7 +287,7 @@ proc test_cond {} {
|
|||||||
send_log "$comp_output\n"
|
send_log "$comp_output\n"
|
||||||
fail $testname
|
fail $testname
|
||||||
} else {
|
} else {
|
||||||
if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } {
|
if { [regexp_diff dump.out $srcdir/$subdir/cond.l ""] } {
|
||||||
fail $testname
|
fail $testname
|
||||||
} else {
|
} else {
|
||||||
pass $testname
|
pass $testname
|
||||||
|
@ -9,7 +9,7 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } {
|
|||||||
set file $srcdir/$subdir/$name
|
set file $srcdir/$subdir/$name
|
||||||
gas_run ${name}.s "$opts -o dump.o" ">&dump.out"
|
gas_run ${name}.s "$opts -o dump.o" ">&dump.out"
|
||||||
if { ![string match "" $opts]
|
if { ![string match "" $opts]
|
||||||
&& [regexp_diff "dump.out" "${file}.l"] } then {
|
&& [regexp_diff "dump.out" "${file}.l" ""] } then {
|
||||||
fail $testname
|
fail $testname
|
||||||
verbose "output is [file_contents "dump.out"]" 2
|
verbose "output is [file_contents "dump.out"]" 2
|
||||||
return
|
return
|
||||||
@ -28,7 +28,7 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
verbose_eval {[file_contents "dump.out"]} 3
|
verbose_eval {[file_contents "dump.out"]} 3
|
||||||
if { [regexp_diff "dump.out" "${file}.e${suffix}"] } then {
|
if { [regexp_diff "dump.out" "${file}.e${suffix}" ""] } then {
|
||||||
fail $testname
|
fail $testname
|
||||||
verbose "output is [file_contents "dump.out"]" 2
|
verbose "output is [file_contents "dump.out"]" 2
|
||||||
return
|
return
|
||||||
|
@ -83,7 +83,7 @@ if { [istarget m68*-*-*] || [istarget fido*-*-*] } then {
|
|||||||
verbose "$comp_output" 3
|
verbose "$comp_output" 3
|
||||||
fail $testname
|
fail $testname
|
||||||
} else {
|
} else {
|
||||||
if [regexp_diff "err.out" "$srcdir/$subdir/op68000.d"] then {
|
if [regexp_diff "err.out" "$srcdir/$subdir/op68000.d" ""] then {
|
||||||
fail $testname
|
fail $testname
|
||||||
} else {
|
} else {
|
||||||
pass $testname
|
pass $testname
|
||||||
|
@ -18,7 +18,7 @@ proc objdump_test { exec flags dest test } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc regexp_test { file1 file2 test } {
|
proc regexp_test { file1 file2 test } {
|
||||||
if [regexp_diff $file1 $file2] then { fail $test } else { pass $test }
|
if [regexp_diff $file1 $file2 ""] then { fail $test } else { pass $test }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ proc objdump_test { exec flags dest test } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc regexp_test { file1 file2 test } {
|
proc regexp_test { file1 file2 test } {
|
||||||
if [regexp_diff $file1 $file2] then { fail $test } else { pass $test }
|
if [regexp_diff $file1 $file2 ""] then { fail $test } else { pass $test }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# name: Compatibility with Renesas's own assembler
|
# name: Compatibility with Renesas's own assembler
|
||||||
# objdump: -D --prefix-addresses --show-raw-insn
|
# objdump: -D --prefix-addresses --show-raw-insn
|
||||||
|
# section-subst: no
|
||||||
|
|
||||||
.*: +file format elf32-rx-.*
|
.*: +file format elf32-rx-.*
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ proc run_error_test { name opts } {
|
|||||||
set testname "symver $name"
|
set testname "symver $name"
|
||||||
set file $srcdir/$subdir/$name
|
set file $srcdir/$subdir/$name
|
||||||
gas_run ${name}.s $opts ">&dump.out"
|
gas_run ${name}.s $opts ">&dump.out"
|
||||||
if { [regexp_diff "dump.out" "${file}.l"] } then {
|
if { [regexp_diff "dump.out" "${file}.l" ""] } then {
|
||||||
fail $testname
|
fail $testname
|
||||||
verbose "output is [file_contents "dump.out"]" 2
|
verbose "output is [file_contents "dump.out"]" 2
|
||||||
return
|
return
|
||||||
|
@ -341,6 +341,15 @@ proc is_pecoff_format {} {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Internal procedure: return the names of the standard sections
|
||||||
|
#
|
||||||
|
proc get_standard_section_names {} {
|
||||||
|
if [istarget "rx-*-*"] {
|
||||||
|
return { "P" "D_1" "B_1" }
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
# run_dump_tests TESTCASES EXTRA_OPTIONS
|
# run_dump_tests TESTCASES EXTRA_OPTIONS
|
||||||
# Wrapper for run_dump_test, which is suitable for invoking as
|
# Wrapper for run_dump_test, which is suitable for invoking as
|
||||||
# run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
|
# run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
|
||||||
@ -413,6 +422,11 @@ proc run_dump_tests { testcases {extra_options {}} } {
|
|||||||
# of symbols. If no FLAGS are needed then use:
|
# of symbols. If no FLAGS are needed then use:
|
||||||
# PROG: [nm objcopy objdump readelf addr2line]
|
# PROG: [nm objcopy objdump readelf addr2line]
|
||||||
# instead.
|
# instead.
|
||||||
|
# Note: for objdump, we automatically replaces the standard section
|
||||||
|
# names (.text, .data and .bss) by target ones if any (eg. rx-elf
|
||||||
|
# uses "P" instead of .text). The substition is done for both
|
||||||
|
# the objdump options (eg: "-j .text" is replaced by "-j P") and the
|
||||||
|
# reference file.
|
||||||
#
|
#
|
||||||
# source: SOURCE
|
# source: SOURCE
|
||||||
# Assemble the file SOURCE.s. If omitted, this defaults to FILE.s.
|
# Assemble the file SOURCE.s. If omitted, this defaults to FILE.s.
|
||||||
@ -463,6 +477,9 @@ proc run_dump_tests { testcases {extra_options {}} } {
|
|||||||
# is expected to exit unsuccessfully (therefore PROG, objdump, nm,
|
# is expected to exit unsuccessfully (therefore PROG, objdump, nm,
|
||||||
# and objcopy have no meaning and should not be supplied).
|
# and objcopy have no meaning and should not be supplied).
|
||||||
#
|
#
|
||||||
|
# section-subst: no
|
||||||
|
# Means that the section substitution for objdump is disabled.
|
||||||
|
#
|
||||||
# Each option may occur at most once.
|
# Each option may occur at most once.
|
||||||
#
|
#
|
||||||
# After the option lines come regexp lines. `run_dump_test' calls
|
# After the option lines come regexp lines. `run_dump_test' calls
|
||||||
@ -508,6 +525,7 @@ proc run_dump_test { name {extra_options {}} } {
|
|||||||
set opts(not-target) {}
|
set opts(not-target) {}
|
||||||
set opts(skip) {}
|
set opts(skip) {}
|
||||||
set opts(not-skip) {}
|
set opts(not-skip) {}
|
||||||
|
set opts(section-subst) {}
|
||||||
|
|
||||||
foreach i $opt_array {
|
foreach i $opt_array {
|
||||||
set opt_name [lindex $i 0]
|
set opt_name [lindex $i 0]
|
||||||
@ -718,7 +736,7 @@ proc run_dump_test { name {extra_options {}} } {
|
|||||||
}
|
}
|
||||||
set stderrfile $srcdir/$subdir/$opts(stderr)
|
set stderrfile $srcdir/$subdir/$opts(stderr)
|
||||||
verbose "wrote pruned stderr to dump.stderr" 3
|
verbose "wrote pruned stderr to dump.stderr" 3
|
||||||
if { [regexp_diff "dump.stderr" "$stderrfile"] } then {
|
if { [regexp_diff "dump.stderr" "$stderrfile" ""] } then {
|
||||||
if { $opts(error) != "" } {
|
if { $opts(error) != "" } {
|
||||||
verbose -log "$exitstat with: <$comp_output>, expected: <$opts(error)>"
|
verbose -log "$exitstat with: <$comp_output>, expected: <$opts(error)>"
|
||||||
if [regexp $opts(error) $comp_output] {
|
if [regexp $opts(error) $comp_output] {
|
||||||
@ -752,6 +770,15 @@ proc run_dump_test { name {extra_options {}} } {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# For objdump, automatically translate standard section names to the targets one,
|
||||||
|
# if they are different.
|
||||||
|
set sect_names [get_standard_section_names]
|
||||||
|
if { $sect_names != "" && $program == "objdump" && $opts(section-subst) == ""} {
|
||||||
|
regsub -- "-j \\.text" $progopts1 "-j [lindex $sect_names 0]" progopts1
|
||||||
|
regsub -- "-j \\.data" $progopts1 "-j [lindex $sect_names 1]" progopts1
|
||||||
|
regsub -- "-j \\.bss" $progopts1 "-j [lindex $sect_names 2]" progopts1
|
||||||
|
}
|
||||||
|
|
||||||
if { $progopts1 == "" } { set $progopts1 "-r" }
|
if { $progopts1 == "" } { set $progopts1 "-r" }
|
||||||
verbose "running $binary $progopts $progopts1" 3
|
verbose "running $binary $progopts $progopts1" 3
|
||||||
|
|
||||||
@ -784,8 +811,18 @@ proc run_dump_test { name {extra_options {}} } {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create the substition list only for objdump reference.
|
||||||
|
if { $sect_names != "" && $program == "objdump" } {
|
||||||
|
# Some testcases use ".text" while others use "\.text".
|
||||||
|
set regexp_subst [list "\\\\?\\.text" [lindex $sect_names 0] \
|
||||||
|
"\\\\?\\.data" [lindex $sect_names 1] \
|
||||||
|
"\\\\?\\.bss" [lindex $sect_names 2] ]
|
||||||
|
} else {
|
||||||
|
set regexp_subst ""
|
||||||
|
}
|
||||||
|
|
||||||
verbose_eval {[file_contents "dump.out"]} 3
|
verbose_eval {[file_contents "dump.out"]} 3
|
||||||
if { [regexp_diff "dump.out" "${dumpfile}"] } then {
|
if { [regexp_diff "dump.out" "${dumpfile}" $regexp_subst] } then {
|
||||||
fail $testname
|
fail $testname
|
||||||
verbose "output is [file_contents "dump.out"]" 2
|
verbose "output is [file_contents "dump.out"]" 2
|
||||||
return
|
return
|
||||||
@ -859,13 +896,14 @@ expect_after -i {
|
|||||||
eof { perror "eof" }
|
eof { perror "eof" }
|
||||||
}
|
}
|
||||||
|
|
||||||
# regexp_diff, based on simple_diff taken from ld test suite
|
# regexp_diff, based on simple_diff taken from ld test suite.
|
||||||
# compares two files line-by-line
|
# Compares two files line-by-line.
|
||||||
# file1 contains strings, file2 contains regexps and #-comments
|
# FILE_1 contains strings, FILE_2 contains regexps and #-comments
|
||||||
# blank lines are ignored in either file
|
# Blank lines are ignored in either file.
|
||||||
# returns non-zero if differences exist
|
# Subsitutions in REF_SUBST are applied on FILE_2 lines.
|
||||||
|
# Returns non-zero if differences exist.
|
||||||
#
|
#
|
||||||
proc regexp_diff { file_1 file_2 } {
|
proc regexp_diff { file_1 file_2 ref_subst} {
|
||||||
|
|
||||||
set eof -1
|
set eof -1
|
||||||
set end_1 0
|
set end_1 0
|
||||||
@ -894,6 +932,7 @@ proc regexp_diff { file_1 file_2 } {
|
|||||||
set line_a ""
|
set line_a ""
|
||||||
set line_b ""
|
set line_b ""
|
||||||
while { [string length $line_a] == 0 } {
|
while { [string length $line_a] == 0 } {
|
||||||
|
# Ignore blank line in FILE_1.
|
||||||
if { [gets $file_a line_a] == $eof } {
|
if { [gets $file_a line_a] == $eof } {
|
||||||
set end_1 1
|
set end_1 1
|
||||||
break
|
break
|
||||||
@ -910,6 +949,10 @@ proc regexp_diff { file_1 file_2 } {
|
|||||||
set diff_pass 1
|
set diff_pass 1
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
# Substitute on the reference.
|
||||||
|
foreach {name value} $ref_subst {
|
||||||
|
regsub -- $name $line_b $value line_b
|
||||||
|
}
|
||||||
verbose "looking for \"^$line_b$\"" 3
|
verbose "looking for \"^$line_b$\"" 3
|
||||||
while { ![regexp "^$line_b$" "$line_a"] } {
|
while { ![regexp "^$line_b$" "$line_a"] } {
|
||||||
verbose "skipping \"$line_a\"" 3
|
verbose "skipping \"$line_a\"" 3
|
||||||
@ -941,6 +984,10 @@ proc regexp_diff { file_1 file_2 } {
|
|||||||
set differences 1
|
set differences 1
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
|
# Substitute on the reference.
|
||||||
|
foreach {name value} $ref_subst {
|
||||||
|
regsub -- $name $line_b $value line_b
|
||||||
|
}
|
||||||
verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
|
verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
|
||||||
if ![regexp "^$line_b$" "$line_a"] {
|
if ![regexp "^$line_b$" "$line_a"] {
|
||||||
send_log "regexp_diff match failure\n"
|
send_log "regexp_diff match failure\n"
|
||||||
@ -1018,7 +1065,7 @@ proc run_list_test { name {opts {}} {testname {}} } {
|
|||||||
}
|
}
|
||||||
set file $srcdir/$subdir/$name
|
set file $srcdir/$subdir/$name
|
||||||
gas_run ${name}.s $opts ">&dump.out"
|
gas_run ${name}.s $opts ">&dump.out"
|
||||||
if { [regexp_diff "dump.out" "${file}.l"] } then {
|
if { [regexp_diff "dump.out" "${file}.l" ""] } then {
|
||||||
fail $testname
|
fail $testname
|
||||||
verbose "output is [file_contents "dump.out"]" 2
|
verbose "output is [file_contents "dump.out"]" 2
|
||||||
return
|
return
|
||||||
@ -1037,7 +1084,7 @@ proc run_list_test_stdin { name {opts {}} {testname {}} } {
|
|||||||
}
|
}
|
||||||
set file $srcdir/$subdir/$name
|
set file $srcdir/$subdir/$name
|
||||||
gas_run_stdin ${name}.s $opts ">&dump.out"
|
gas_run_stdin ${name}.s $opts ">&dump.out"
|
||||||
if { [regexp_diff "dump.out" "${file}.l"] } then {
|
if { [regexp_diff "dump.out" "${file}.l" ""] } then {
|
||||||
fail $testname
|
fail $testname
|
||||||
verbose "output is [file_contents "dump.out"]" 2
|
verbose "output is [file_contents "dump.out"]" 2
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user