[PING^4][PATCH 0/4] Fix library testsuite compilation for build sysroot

Chung-Lin Tang chunglin_tang@mentor.com
Tue Feb 11 08:35:00 GMT 2020


Hi Maciej,
sorry for the late reply.

On 2020/2/1 5:46 AM, Maciej W. Rozycki wrote:
> On Tue, 21 Jan 2020, Maciej W. Rozycki wrote:
> 
>>   I'll give your proposal a shot and I'm lucky enough to have a build
>> configuration where I can have no compiler preinstalled, so at least I can
>> check if testing with your change applied correctly picks the newly built
>> uninstalled compiler in that case.
> 
>   So it does seem to pick the right uninstalled compiler, however without
> the sysroot option and therefore all tests fail either like:
> 
> .../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
> .../bin/riscv64-linux-gnu-ld: cannot find -lm
> collect2: error: ld returned 1 exit status
> compiler exited with status 1
> FAIL: libgomp.c/../libgomp.c-c++-common/depend-iterator-2.c (test for excess errors)
> 
> or like:
> 
> .../libgomp/testsuite/libgomp.c/../libgomp.c-c++-common/cancel-parallel-1.c:4:10: fatal error: stdlib.h: No such file or directory
> compilation terminated.
> compiler exited with status 1
> FAIL: libgomp.c/../libgomp.c-c++-common/cancel-parallel-1.c (test for excess errors)

Weird that the --sysroot option doesn't properly get down there. I'll try to whip up a
similar environment later to really test this myself if I have time. As for your patch...

> I am somewhat wary about picking the compiler options to pass selectively
> anyway.  However the change below does not do that and works for me and I
> think it should be fine for your use case too.  Please confirm.
> 
>   I'm yet verifying the other libraries with corresponding changes and will
> formally submit v2 of this series once that has completed.
> 
>   Apologies for the slightly long RTT with this update.
> 
>    Maciej

The 'AM_RUNTESTFLAGS = --tool_exec "$(CC)"' does work for us, but only because you backed out the change
from libgomp-test-support.exp, and our installed testing doesn't use the libgomp/testsuite/Makefile.* files
(we invoke runtest using another script).

 From the code in libgomp/testsuite/lib/libgomp.exp:libgomp_init():
...
     if ![info exists GCC_UNDER_TEST] then {
         if [info exists TOOL_EXECUTABLE] {
             set GCC_UNDER_TEST $TOOL_EXECUTABLE
         } else {
             set GCC_UNDER_TEST "[find_gcc]"
         }
     }

So essentially this patch is the same as the prior one, and still blocks the usual find_gcc logic from
ever getting control (as long as we use the in-tree 'make check'). I'm not sure that is the right
thing to do...

That said, I don't have anything further against this patch. Okay for me.

(I do still think that actually detecting the right in-tree compiler and giving the correct sysroot
options from the configuration is the more proper approach, maybe later)

Thanks,
Chung-Lin

> ---
>   libgomp/testsuite/Makefile.am                 |    1 +
>   libgomp/testsuite/Makefile.in                 |    1 +
>   libgomp/testsuite/libgomp-test-support.exp.in |    2 --
>   3 files changed, 2 insertions(+), 2 deletions(-)
> 
> gcc-test-libgomp-runtestflags-tool-exec.diff
> Index: gcc/libgomp/testsuite/Makefile.am
> ===================================================================
> --- gcc.orig/libgomp/testsuite/Makefile.am
> +++ gcc/libgomp/testsuite/Makefile.am
> @@ -11,6 +11,7 @@ EXPECT = $(shell if test -f $(top_buildd
>   _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
>   	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
>   RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
> +AM_RUNTESTFLAGS = --tool_exec "$(CC)"
>   
>   # Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
>   # following variables have to be "routed through" this Makefile, for expansion
> Index: gcc/libgomp/testsuite/Makefile.in
> ===================================================================
> --- gcc.orig/libgomp/testsuite/Makefile.in
> +++ gcc/libgomp/testsuite/Makefile.in
> @@ -308,6 +308,7 @@ _RUNTEST = $(shell if test -f $(top_srcd
>   	     echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
>   
>   RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
> +AM_RUNTESTFLAGS = --tool_exec "$(CC)"
>   all: all-am
>   
>   .SUFFIXES:
> Index: gcc/libgomp/testsuite/libgomp-test-support.exp.in
> ===================================================================
> --- gcc.orig/libgomp/testsuite/libgomp-test-support.exp.in
> +++ gcc/libgomp/testsuite/libgomp-test-support.exp.in
> @@ -1,5 +1,3 @@
> -set GCC_UNDER_TEST {@CC@}
> -
>   set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
>   set cuda_driver_lib "@CUDA_DRIVER_LIB@"
>   set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
> 



More information about the Gcc-patches mailing list