mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-16 20:38:26 +00:00
Rework readelf -wi tests to grep for expected strings.
This commit is contained in:
@@ -1,15 +1,26 @@
|
|||||||
|
2003-04-26 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* binutils-all/readelf.exp (prune_read_warnings): Rename to
|
||||||
|
prune_readelf_wi_warnings.
|
||||||
|
(readelf_wi_test): New proc: Test 'readelf -wi' by grepping
|
||||||
|
through its output.
|
||||||
|
Replace invocation of "readelf_test -wi" with "readelf_wi_test"
|
||||||
|
* binutils-all/readelf.wi: Delete.
|
||||||
|
|
||||||
2003-04-23 Nick Clifton <nickc@redhat.com>
|
2003-04-23 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* readelf.exp (proc prune_readelf_warnings): New function.
|
* binutils-all/readelf.exp (proc prune_readelf_warnings): New
|
||||||
|
function.
|
||||||
(proc readelf_test): Prune warning messages.
|
(proc readelf_test): Prune warning messages.
|
||||||
(readelf_test -wi): Add more expected failures.
|
(readelf_test -wi): Add more expected failures.
|
||||||
* readelf.wi: Severly reduce expected output.
|
* binutils-all/readelf.wi: Severly reduce expected output.
|
||||||
* testprog.c (string): Explicitly use unsigned chars.
|
* binutils-all/testprog.c (string): Explicitly use unsigned
|
||||||
|
chars.
|
||||||
(stdio.h, string.h): Remove inclusion.
|
(stdio.h, string.h): Remove inclusion.
|
||||||
|
|
||||||
2003-04-23 J"orn Rennecke <joern.rennecke@superh.com>
|
2003-04-23 J"orn Rennecke <joern.rennecke@superh.com>
|
||||||
|
|
||||||
* readelf.wi: Update.
|
* binutils-all/readelf.wi: Update.
|
||||||
|
|
||||||
2003-04-22 Dimitrie O. Paun <dpaun@rogers.com>
|
2003-04-22 Dimitrie O. Paun <dpaun@rogers.com>
|
||||||
|
|
||||||
|
|||||||
@@ -164,12 +164,6 @@ proc readelf_find_size { binary_file } {
|
|||||||
pass $testname
|
pass $testname
|
||||||
}
|
}
|
||||||
|
|
||||||
# Simple proc to skip certain expected warning messages.
|
|
||||||
proc prune_readelf_warnings { text } {
|
|
||||||
regsub -all "(^|\n)(.*Skipping unexpected symbol type.*)" $text "\\1" text
|
|
||||||
return $text
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run an individual readelf test.
|
# Run an individual readelf test.
|
||||||
# Basically readelf is run on the binary_file with the given options.
|
# Basically readelf is run on the binary_file with the given options.
|
||||||
# Readelf's output is captured and then compared against the contents
|
# Readelf's output is captured and then compared against the contents
|
||||||
@@ -190,8 +184,6 @@ proc readelf_test { options binary_file regexp_file xfails } {
|
|||||||
setup_xfail $xfail
|
setup_xfail $xfail
|
||||||
}
|
}
|
||||||
|
|
||||||
set got [prune_readelf_warnings $got]
|
|
||||||
|
|
||||||
if ![string match "" $got] then {
|
if ![string match "" $got] then {
|
||||||
fail "readelf $options (reason: unexpected output)"
|
fail "readelf $options (reason: unexpected output)"
|
||||||
send_log $got
|
send_log $got
|
||||||
@@ -225,6 +217,89 @@ proc readelf_test { options binary_file regexp_file xfails } {
|
|||||||
pass "readelf $options"
|
pass "readelf $options"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Simple proc to skip certain expected warning messages.
|
||||||
|
|
||||||
|
proc prune_readelf_wi_warnings { text } {
|
||||||
|
regsub -all "(^|\n)(.*Skipping unexpected symbol type.*)" $text "\\1" text
|
||||||
|
return $text
|
||||||
|
}
|
||||||
|
|
||||||
|
# Testing the "readelf -wi" option is difficult because there
|
||||||
|
# is no guaranteed order to the output, and because some ports
|
||||||
|
# will use indirect string references, whilst others will use
|
||||||
|
# direct references. So instead of having an expected output
|
||||||
|
# file, like the other readelf tests, we grep for strings that
|
||||||
|
# really ought to be there.
|
||||||
|
|
||||||
|
proc readelf_wi_test {} {
|
||||||
|
global READELF
|
||||||
|
global READELFFLAGS
|
||||||
|
global srcdir
|
||||||
|
global subdir
|
||||||
|
|
||||||
|
# Compile the second test file.
|
||||||
|
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
|
||||||
|
verbose "Unable to compile test file."
|
||||||
|
untested "readelf -wi"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download it.
|
||||||
|
set tempfile [remote_download host tmpdir/testprog.o];
|
||||||
|
|
||||||
|
# Run "readelf -wi" on it.
|
||||||
|
send_log "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out\n"
|
||||||
|
catch "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out" got
|
||||||
|
|
||||||
|
# Upload the results.
|
||||||
|
set output [remote_upload host readelf.out];
|
||||||
|
|
||||||
|
file_on_host delete $tempfile;
|
||||||
|
|
||||||
|
# Strip any superflous warnings.
|
||||||
|
set got [prune_readelf_wi_warnings $got]
|
||||||
|
|
||||||
|
if ![string match "" $got] then {
|
||||||
|
fail "readelf $options (reason: unexpected output)"
|
||||||
|
send_log $got
|
||||||
|
send_log "\n"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ![file size $output] then {
|
||||||
|
# If the output file is empty, then this target does not
|
||||||
|
# generate dwarf2 output. This is not a failure.
|
||||||
|
verbose "No output from 'readelf -wi'"
|
||||||
|
untested "readelf -wi"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Search for strings that should be in the output.
|
||||||
|
set sought {
|
||||||
|
".*DW_TAG_compile_unit.*"
|
||||||
|
".*DW_TAG_subprogram.*"
|
||||||
|
".*DW_TAG_base_type.*"
|
||||||
|
".*DW_AT_producer.*(GNU C|indirect string).*"
|
||||||
|
".*DW_AT_language.*ANSI C.*"
|
||||||
|
".*DW_AT_name.*(testprog.c|indirect string).*"
|
||||||
|
".*DW_AT_name.*fn.*"
|
||||||
|
".*DW_AT_name.*(main|indirect string).*"
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach looked_for $sought {
|
||||||
|
set lines [grep $output $looked_for]
|
||||||
|
if ![llength $lines] then {
|
||||||
|
fail "readelf -wi: missing: $looked_for"
|
||||||
|
send_log readelf.out
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file_on_host delete $output;
|
||||||
|
|
||||||
|
# All done.
|
||||||
|
pass "readelf -wi"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Only ELF based toolchains need readelf.
|
# Only ELF based toolchains need readelf.
|
||||||
@@ -281,20 +356,4 @@ readelf_test -S $tempfile readelf.s {}
|
|||||||
readelf_test -s $tempfile readelf.ss {}
|
readelf_test -s $tempfile readelf.ss {}
|
||||||
readelf_test -r $tempfile readelf.r {}
|
readelf_test -r $tempfile readelf.r {}
|
||||||
|
|
||||||
|
readelf_wi_test
|
||||||
# Compile the second test file.
|
|
||||||
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
|
|
||||||
untested "readelf -w"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if [is_remote host] {
|
|
||||||
set tempfile [remote_download host tmpdir/testprog.o];
|
|
||||||
} else {
|
|
||||||
set tempfile tmpdir/testprog.o
|
|
||||||
}
|
|
||||||
|
|
||||||
# The xfail targets here do not default to DWARF2 format debug information
|
|
||||||
# The symptom is that the output of 'readelf -wi' is empty.
|
|
||||||
|
|
||||||
readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* mips*-*-elf* avr-*-* d30v-*-* h8300*-*-* i960-*-* m32r-*-* sparc-*-*}
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
The section .debug_info contains:
|
|
||||||
|
|
||||||
Compilation Unit @ .*:
|
|
||||||
Length: .*
|
|
||||||
Version: 2
|
|
||||||
Abbrev Offset: 0
|
|
||||||
Pointer Size: .
|
|
||||||
<.><.*>: Abbrev Number: .* \(DW_TAG_compile_unit\)
|
|
||||||
DW_AT_stmt_list : 0
|
|
||||||
DW_AT_high_pc : .*
|
|
||||||
DW_AT_low_pc : 0.*
|
|
||||||
DW_AT_producer :.*
|
|
||||||
DW_AT_language : 1 \(ANSI C\)
|
|
||||||
DW_AT_name : .*
|
|
||||||
<.><.*>: Abbrev Number: .* \(DW_TAG_subprogram\)
|
|
||||||
DW_AT_external : 1
|
|
||||||
DW_AT_name : fn
|
|
||||||
DW_AT_decl_file : 1
|
|
||||||
DW_AT_decl_line : 12
|
|
||||||
DW_AT_type : .*
|
|
||||||
DW_AT_low_pc : 0.*
|
|
||||||
DW_AT_high_pc : .*
|
|
||||||
DW_AT_frame_base : .*
|
|
||||||
<.><.*>: Abbrev Number: .* \(DW_TAG_base_type\)
|
|
||||||
DW_AT_name : int
|
|
||||||
DW_AT_byte_size : .*
|
|
||||||
DW_AT_encoding : .* \(signed\)
|
|
||||||
<.><.*>: Abbrev Number: .* \(DW_TAG_subprogram\)
|
|
||||||
#pass
|
|
||||||
Reference in New Issue
Block a user