[PATCH] binutils: testsuite: convert binary symbol tests to run_dump_test
Jan Beulich
jbeulich@suse.com
Fri Nov 7 10:16:15 GMT 2025
On 07.11.2025 10:31, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
> ---
> .../binutils-all/binary-symbol-explicit.d | 11 ++++++
> .../binutils-all/binary-symbol-implicit.d | 11 ++++++
> binutils/testsuite/binutils-all/objcopy.exp | 34 +++----------------
> 3 files changed, 27 insertions(+), 29 deletions(-)
> create mode 100644 binutils/testsuite/binutils-all/binary-symbol-explicit.d
> create mode 100644 binutils/testsuite/binutils-all/binary-symbol-implicit.d
First, please send new patches as individual new mails (or threads if it's
a series), not as replies to earlier mails.
> --- /dev/null
> +++ b/binutils/testsuite/binutils-all/binary-symbol-implicit.d
> @@ -0,0 +1,11 @@
> +#name: binary symbols
> +#PROG: objcopy
> +#objcopy: -I binary
> +#source: version.s
> +#nm: -a
> +
> +#...
> +[0-9a-fA-F]+?[ ]+[TtDdA] .*_version_o_end
> +[0-9a-fA-F]+?[ ]+[TtDdA] .*_version_o_size
> +[0-9a-fA-F]+?[ ]+[TtDdA] .*_version_o_start
This is stripping a little too much for my taste; I'd expect at least one
directory component to also be part of the expectations. Or else please have
a non-empty description justifying your choice.
Is A actually necessary to have in the expectations of symbol type?
> --- a/binutils/testsuite/binutils-all/objcopy.exp
> +++ b/binutils/testsuite/binutils-all/objcopy.exp
> @@ -1605,39 +1605,15 @@ objcopy_tek2bin
>
> # Test objcopy -I binary and --binary-symbol-prefix
>
> -proc binary_symbol {name file args symbol} {
> +proc binary_symbol {} {
> global OBJCOPY
> - global NM
> - global NMFLAGS
>
> - set test "binary symbol ($name)"
> -
> - # detect a valid target, take the first supported
> set inf [split [binutils_run $OBJCOPY "--info"] \n]
> set target [lindex $inf 1]
> set arch [string trim [lindex $inf 3]]
> -
> - set out tmpdir/binary_${name}.o
> - set got [binutils_run $OBJCOPY "-I binary -B $arch -O $target $args $file $out"]
> -
> - set expected [list "${symbol}_end" "${symbol}_size" "${symbol}_start"]
> -
> - set exec_output [binutils_run $NM "-a $NMFLAGS $out"]
> - set exec_output [prune_warnings $exec_output]
> - set actual {}
> - while {[regexp {^[0-9a-fA-F]+?[ ]+[TtDdA] ([0-9a-zA-Z_]+)[\r\n]+(.*)$} ${exec_output} all s rest]} {
> - set actual [concat $actual $s]
> - set exec_output $rest
> - }
> -
> - if {[lsort $expected] ne [lsort $actual]} {
> - send_log "expected: $expected, actual: $actual\n"
> - fail $test
> - return
> - }
> -
> - pass $test
> + # as always runs, not critical as we do not check the content
> + run_dump_test "binary-symbol-explicit" [list [list objcopy "-B $arch -O $target" ] ]
> + run_dump_test "binary-symbol-implicit" [list [list objcopy "-B $arch -O $target" ] ]
> }
>
> -binary_symbol implicit $srcdir/$subdir/version.s "" _binary_[regsub -all {[^0-9a-zA-Z]} $srcdir/$subdir/version.s _]
> -binary_symbol explicit $srcdir/$subdir/version.s "--binary-symbol-prefix symbol1" symbol1
> +binary_symbol
Personally I'd prefer if we kept two parameterized invocations of binary_symbol
here. It would be just one parameter now, the testcase name "tag".
Jan
More information about the Binutils
mailing list