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) 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 --- 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@"