Complement commit b72813a68c94 ("libgo: fix DejaGNU testsuite compiler when using build sysroot") and use the `--tool_exec' option to `runtest' via $(AM_RUNTESTFLAGS) with $(GOC) as the argument rather than the GOC_UNDER_TEST TCL variable to set the compiler to use with the test suite, for consistency with the other top-level GCC target libraries. Update testsuite/lib/libgo.exp to actually handle the option by using the TOOL_EXECUTABLE TCL variable.
libgo/ * configure.ac: Remove testsuite/libgo-test-support.exp from output files. * configure: Regenerate. * testsuite/libgo-test-support.exp.in: Remove file. * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): Remove variable. (AM_RUNTESTFLAGS): Add `--tool_exec' option. * testsuite/Makefile.in: Regenerate. * testsuite/lib/libgo.exp: Handle TOOL_EXECUTABLE. --- Applies on top of v1. --- libgo/configure | 3 +-- libgo/configure.ac | 2 +- libgo/testsuite/Makefile.am | 4 +--- libgo/testsuite/Makefile.in | 7 ++----- libgo/testsuite/lib/libgo.exp | 12 ++++++++---- libgo/testsuite/libgo-test-support.exp.in | 17 ----------------- 6 files changed, 13 insertions(+), 32 deletions(-) gcc-test-libgo-runtestflags-tool-exec.diff Index: gcc/libgo/configure =================================================================== --- gcc.orig/libgo/configure +++ gcc/libgo/configure @@ -15880,7 +15880,7 @@ else multilib_arg= fi -ac_config_files="$ac_config_files Makefile testsuite/Makefile testsuite/libgo-test-support.exp" +ac_config_files="$ac_config_files Makefile testsuite/Makefile" ac_config_commands="$ac_config_commands default" @@ -17061,7 +17061,6 @@ do "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; - "testsuite/libgo-test-support.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libgo-test-support.exp" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; Index: gcc/libgo/configure.ac =================================================================== --- gcc.orig/libgo/configure.ac +++ gcc/libgo/configure.ac @@ -889,7 +889,7 @@ else multilib_arg= fi -AC_CONFIG_FILES(Makefile testsuite/Makefile testsuite/libgo-test-support.exp) +AC_CONFIG_FILES(Makefile testsuite/Makefile) AC_CONFIG_COMMANDS([default], [if test -n "$CONFIG_FILES"; then Index: gcc/libgo/testsuite/Makefile.am =================================================================== --- gcc.orig/libgo/testsuite/Makefile.am +++ gcc/libgo/testsuite/Makefile.am @@ -11,13 +11,11 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` -EXTRA_DEJAGNU_SITE_CONFIG = libgo-test-support.exp - # When running the tests we set GCC_EXEC_PREFIX to the install tree so that # files that have already been installed there will be found. The -B option # overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files # from the install tree. -AM_RUNTESTFLAGS = "TEST_GCC_EXEC_PREFIX=$(libdir)/gcc" +AM_RUNTESTFLAGS = --tool_exec "$(GOC)" "TEST_GCC_EXEC_PREFIX=$(libdir)/gcc" CLEANFILES = *.log *.sum Index: gcc/libgo/testsuite/Makefile.in =================================================================== --- gcc.orig/libgo/testsuite/Makefile.in +++ gcc/libgo/testsuite/Makefile.in @@ -107,7 +107,7 @@ am__configure_deps = $(am__aclocal_m4_de DIST_COMMON = $(srcdir)/Makefile.am mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = libgo-test-support.exp +CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -300,13 +300,12 @@ RUNTEST = `if [ -f $(top_srcdir)/../deja echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` -EXTRA_DEJAGNU_SITE_CONFIG = libgo-test-support.exp # When running the tests we set GCC_EXEC_PREFIX to the install tree so that # files that have already been installed there will be found. The -B option # overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files # from the install tree. -AM_RUNTESTFLAGS = "TEST_GCC_EXEC_PREFIX=$(libdir)/gcc" +AM_RUNTESTFLAGS = --tool_exec "$(GOC)" "TEST_GCC_EXEC_PREFIX=$(libdir)/gcc" CLEANFILES = *.log *.sum all: all-am @@ -340,8 +339,6 @@ $(top_srcdir)/configure: @MAINTAINER_MOD $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -libgo-test-support.exp: $(top_builddir)/config.status $(srcdir)/libgo-test-support.exp.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo Index: gcc/libgo/testsuite/lib/libgo.exp =================================================================== --- gcc.orig/libgo/testsuite/lib/libgo.exp +++ gcc/libgo/testsuite/lib/libgo.exp @@ -17,11 +17,15 @@ set TESTING_IN_BUILD_TREE 1 if ![info exists GOC_UNDER_TEST] then { - set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] - if {$gccdir != ""} { - set gccdir [file dirname $gccdir] + if [info exists TOOL_EXECUTABLE] { + set GOC_UNDER_TEST $TOOL_EXECUTABLE + } else { + set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] + if {$gccdir != ""} { + set gccdir [file dirname $gccdir] + } + set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/" } - set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/" } if [info exists GOTEST_TMPDIR] { Index: gcc/libgo/testsuite/libgo-test-support.exp.in =================================================================== --- gcc.orig/libgo/testsuite/libgo-test-support.exp.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2019 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -set GOC_UNDER_TEST {@GOC@}