[PATCH] ld/testsuite: correct aarch64 uses of load_lib

Jan Beulich jbeulich@suse.com
Mon Dec 16 07:24:02 GMT 2024


On 13.12.2024 14:50, Matthieu Longo wrote:
> On 2024-12-13 10:11, Jan Beulich wrote:
>> Using $srcdir/$subdir directly doesn't work, at least not with expect
>> 5.45, dejagnu 1.6, and an out-of-tree build (I assume it's the latter
>> aspect which is crucial here). Make use of $libdirs instead.
>>
> 
> That is what I did in the original version of this patch, and Richard 
> Sandiford suggested to change it to load_file 
> $srcdir/$subdir/lib/aarch64-elf-lib.exp.

Right, except that this doesn't work:

Running /home/jbeulich/cpp/binutils/master-git/2024-12-13/ld/testsuite/ld-aarch64/aarch64-elf.exp ...
ERROR: tcl error sourcing library file ../lib//home/jbeulich/cpp/binutils/master-git/2024-12-13/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp.
couldn't read file "../lib//home/jbeulich/cpp/binutils/master-git/2024-12-13/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp": no such file or directory
couldn't read file "../lib//home/jbeulich/cpp/binutils/master-git/2024-12-13/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp": no such file or directory
    while executing
"source ../lib//home/jbeulich/cpp/binutils/master-git/2024-12-13/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source ../lib//home/jbeulich/cpp/binutils/master-git/2024-12-13/ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp"
    invoked from within
"catch "uplevel #0 source ${dir}/${initfile}" error"
Makefile:2394: recipe for target 'check-DEJAGNU' failed

> The reason is that the change to libdirs (a global variable in my 
> understanding) would probably carry over to other test directories when 
> we run the whole testsuite.
> The environment seen by those others directories would have some AArch64 
> target-dependent definitions in it. This would be a change in behavior 
> compared to before, and would potentially cause some issues. It would 
> also mean that the test environment of those tests would be different 
> when run individually, or run *after* the AArch64 tests have run.

In which case libdirs may need saving / restoring around the Arm64 tests,
yet iirc there's internal tracking that might also get in the way. I don't
think that's a problem though, as the scripts becoming accessible are all
named such that they'd not be unintentionally included from elsewhere
(aarch64-*.exp).

> My environment: $runtest --version
> DejaGnu version 1.6.3
> Expect version  5.45.4
> Tcl version     8.6
> 
> The only difference with the versions you mentioned and my environment 
> is probably the minor numbers. What is the full version of your tools ?
> Also, please can you give more information about this "out-of-tree 
> build" that you mentioned ?

It is what the name says, and what I would expect most developers to
default to: A build tree entirely separate from the source tree. This imo
is the most reasonable way to easily deal with the frequent need to have
multiple builds (covering different targets) all from the same sources.
Aiui $srcdir expands to . in an in-tree build, but to an absolute path in
an out-of-tree one. Hence the breakage quoted above.

An alternative to playing with $libdirs that I can see is to place the
file in ld/testsuite/lib/.

Jan


More information about the Binutils mailing list