On 2020/1/6 11:25 PM, Maciej W. Rozycki wrote:
  Overall if libgomp-test-support.exp is considered appropriate for
standalone testing, then I think two solutions are possible here:

1. An option is added to libgomp's $CC such that the compiler is able to
    make builds involving the offload compiler where requested, and this
    then propagates to GCC_UNDER_TEST as it stands.

2. The definition of GCC_UNDER_TEST in libgomp-test-support.exp is only
    made if inexistent, and then you can predefine the variable in site.exp
    however you find appropriate.

Hi Maciej,
I understand your situation with --with-build-sysroot/--without-sysroot, but the
way you set GCC_UNDER_TEST in libgomp-test-support.exp appears to override too
much of the machinery in libgomp/testsuite/lib/libgomp.exp that sets 
GCC_UNDER_TEST
using DejaGNU find_gcc, etc.

Can you test if the attached patch works for you? The patch exports the build 
sysroot
setting from the toplevel to target library subdirs, and adds the --sysroot= 
option
when doing build-tree testing (I assume that blddir != "" test is sufficient 
from the
surrounding comments)

I can only verify that it no longer "interferes" with our installed-mode 
testing.
Also, if this does work, then other library testsuites (e.g. libatomic.exp) 
might
also need considering updating, I think.

Thanks,
Chung-Lin

2020-01-14  Chung-Lin Tang  <clt...@codesourcery.com>

        * Makefile.tpl  (NORMAL_TARGET_EXPORTS): Add export of
        SYSROOT_CFLAGS_FOR_TARGET variable.
        * Makefile.in:  Regenerate.

        libgomp/
        * testsuite/lib/libgomp.exp (ALWAYS_CFLAGS): Add
        --sysroot=$SYSROOT_CFLAGS_FOR_TARGET option when doing build-tree 
testing.
        Fix comment typo.
        * testsuite/libgomp-test-support.exp.in (GCC_UNDER_TEST): Delete 
definition.
Index: libgomp/testsuite/lib/libgomp.exp
===================================================================
--- libgomp/testsuite/lib/libgomp.exp   (revision 279954)
+++ libgomp/testsuite/lib/libgomp.exp   (working copy)
@@ -171,9 +171,16 @@ proc libgomp_init { args } {
     lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/../../include"
     lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
 
-    # For build-tree testing, also consider the library paths used for builing.
+    # For build-tree testing, also consider the library paths used for 
building.
     # For installed testing, we assume all that to be provided in the sysroot.
     if { $blddir != "" } {
+
+       # If --with-build-sysroot= was specified, we assume it will be needed
+       # for build-tree testing.
+       if [info exists SYSROOT_CFLAGS_FOR_TARGET] {
+           lappend ALWAYS_CFLAGS 
"additional_flags=--sysroot=$SYSROOT_CFLAGS_FOR_TARGET"
+       }
+       
        # The `-fopenacc' and `-fopenmp' options imply `-pthread', and
        # that implies `-latomic' on some hosts, so wire in libatomic
        # build directories.
Index: libgomp/testsuite/libgomp-test-support.exp.in
===================================================================
--- libgomp/testsuite/libgomp-test-support.exp.in       (revision 279954)
+++ libgomp/testsuite/libgomp-test-support.exp.in       (working copy)
@@ -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@"
Index: Makefile.in
===================================================================
--- Makefile.in (revision 279954)
+++ Makefile.in (working copy)
@@ -319,6 +319,7 @@ RAW_CXX_TARGET_EXPORTS = \
 
 NORMAL_TARGET_EXPORTS = \
        $(BASE_TARGET_EXPORTS) \
+       SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export 
SYSROOT_CFLAGS_FOR_TARGET; \
        CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
 
 # Where to find GMP
Index: Makefile.tpl
===================================================================
--- Makefile.tpl        (revision 279954)
+++ Makefile.tpl        (working copy)
@@ -322,6 +322,7 @@ RAW_CXX_TARGET_EXPORTS = \
 
 NORMAL_TARGET_EXPORTS = \
        $(BASE_TARGET_EXPORTS) \
+       SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export 
SYSROOT_CFLAGS_FOR_TARGET; \
        CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
 
 # Where to find GMP

Reply via email to