[PATCH v3] binutils: testsuite: convert binary symbol tests to run_dump_test

Jan Beulich jbeulich@suse.com
Mon Nov 10 13:58:53 GMT 2025


On 08.11.2025 11:59, Alon Bar-Lev wrote:
> --- 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 {tag} {
>      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-${tag}" [list [list objcopy "-B $arch -O $target" ] ]

Sadly it only now occurred to me what the comment means (last time round iirc I
simply didn't know how to parse the first part, as I took the initial "as" for
a normal word, not a reference to gas). Problem being - "always runs" isn't true.
There are very few targets (amdgcn being one of them iirc) where no gas is being
built, and hence an attempt to use it will cause testcases to fail. IOW you're
effectively introducing two testcase regressions here for every one such target.
Whether we could consider this acceptable (given that for such targets various
other tests also fail) I don't know. Nick, Alan - opinions?

Jan


More information about the Binutils mailing list