public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/5] sim: testsuite: setup per-port toolchain settings for multitarget build
@ 2021-11-27  8:23 Mike Frysinger
  2021-11-27  8:23 ` [PATCH 2/5] sim: testsuite: expand arch specific toolchain settings Mike Frysinger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mike Frysinger @ 2021-11-27  8:23 UTC (permalink / raw)
  To: gdb-patches

Gas does not support multitarget builds -- it still only supports
a single input & output format.  ld is a bit better, but requires
manual flags to select the right output.  This makes it impossible
to run the complete testsuite in a multitarget build.

To address this limitation, create a suite of FOR_TARGET variables
so these can be set to precompiled as & ld programs.  It requires
a bit of setup ahead of time, but it's a one-time cost, and makes
running the full testsuite at once much easier.
---
 sim/Makefile.in            |  98 +++++
 sim/configure              | 834 ++++++++++++++++++++++++++++++++++++-
 sim/configure.ac           |   2 +
 sim/m4/sim_ac_toolchain.m4 |  25 ++
 sim/testsuite/local.mk     |   1 +
 5 files changed, 957 insertions(+), 3 deletions(-)

diff --git a/sim/Makefile.in b/sim/Makefile.in
index 1dae0a482fb9..ed7566cfb1e2 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -1071,6 +1071,38 @@ AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AR_FOR_BUILD = @AR_FOR_BUILD@
+AS_FOR_TARGET_AARCH64 = @AS_FOR_TARGET_AARCH64@
+AS_FOR_TARGET_ARM = @AS_FOR_TARGET_ARM@
+AS_FOR_TARGET_AVR = @AS_FOR_TARGET_AVR@
+AS_FOR_TARGET_BFIN = @AS_FOR_TARGET_BFIN@
+AS_FOR_TARGET_BPF = @AS_FOR_TARGET_BPF@
+AS_FOR_TARGET_CR16 = @AS_FOR_TARGET_CR16@
+AS_FOR_TARGET_CRIS = @AS_FOR_TARGET_CRIS@
+AS_FOR_TARGET_D10V = @AS_FOR_TARGET_D10V@
+AS_FOR_TARGET_ERC32 = @AS_FOR_TARGET_ERC32@
+AS_FOR_TARGET_EXAMPLE_SYNACOR = @AS_FOR_TARGET_EXAMPLE_SYNACOR@
+AS_FOR_TARGET_FRV = @AS_FOR_TARGET_FRV@
+AS_FOR_TARGET_FT32 = @AS_FOR_TARGET_FT32@
+AS_FOR_TARGET_H8300 = @AS_FOR_TARGET_H8300@
+AS_FOR_TARGET_IQ2000 = @AS_FOR_TARGET_IQ2000@
+AS_FOR_TARGET_LM32 = @AS_FOR_TARGET_LM32@
+AS_FOR_TARGET_M32C = @AS_FOR_TARGET_M32C@
+AS_FOR_TARGET_M32R = @AS_FOR_TARGET_M32R@
+AS_FOR_TARGET_M68HC11 = @AS_FOR_TARGET_M68HC11@
+AS_FOR_TARGET_MCORE = @AS_FOR_TARGET_MCORE@
+AS_FOR_TARGET_MICROBLAZE = @AS_FOR_TARGET_MICROBLAZE@
+AS_FOR_TARGET_MIPS = @AS_FOR_TARGET_MIPS@
+AS_FOR_TARGET_MN10300 = @AS_FOR_TARGET_MN10300@
+AS_FOR_TARGET_MOXIE = @AS_FOR_TARGET_MOXIE@
+AS_FOR_TARGET_MSP430 = @AS_FOR_TARGET_MSP430@
+AS_FOR_TARGET_OR1K = @AS_FOR_TARGET_OR1K@
+AS_FOR_TARGET_PPC = @AS_FOR_TARGET_PPC@
+AS_FOR_TARGET_PRU = @AS_FOR_TARGET_PRU@
+AS_FOR_TARGET_RISCV = @AS_FOR_TARGET_RISCV@
+AS_FOR_TARGET_RL78 = @AS_FOR_TARGET_RL78@
+AS_FOR_TARGET_RX = @AS_FOR_TARGET_RX@
+AS_FOR_TARGET_SH = @AS_FOR_TARGET_SH@
+AS_FOR_TARGET_V850 = @AS_FOR_TARGET_V850@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -1080,6 +1112,38 @@ CATOBJEXT = @CATOBJEXT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CC_FOR_BUILD = @CC_FOR_BUILD@
+CC_FOR_TARGET_AARCH64 = @CC_FOR_TARGET_AARCH64@
+CC_FOR_TARGET_ARM = @CC_FOR_TARGET_ARM@
+CC_FOR_TARGET_AVR = @CC_FOR_TARGET_AVR@
+CC_FOR_TARGET_BFIN = @CC_FOR_TARGET_BFIN@
+CC_FOR_TARGET_BPF = @CC_FOR_TARGET_BPF@
+CC_FOR_TARGET_CR16 = @CC_FOR_TARGET_CR16@
+CC_FOR_TARGET_CRIS = @CC_FOR_TARGET_CRIS@
+CC_FOR_TARGET_D10V = @CC_FOR_TARGET_D10V@
+CC_FOR_TARGET_ERC32 = @CC_FOR_TARGET_ERC32@
+CC_FOR_TARGET_EXAMPLE_SYNACOR = @CC_FOR_TARGET_EXAMPLE_SYNACOR@
+CC_FOR_TARGET_FRV = @CC_FOR_TARGET_FRV@
+CC_FOR_TARGET_FT32 = @CC_FOR_TARGET_FT32@
+CC_FOR_TARGET_H8300 = @CC_FOR_TARGET_H8300@
+CC_FOR_TARGET_IQ2000 = @CC_FOR_TARGET_IQ2000@
+CC_FOR_TARGET_LM32 = @CC_FOR_TARGET_LM32@
+CC_FOR_TARGET_M32C = @CC_FOR_TARGET_M32C@
+CC_FOR_TARGET_M32R = @CC_FOR_TARGET_M32R@
+CC_FOR_TARGET_M68HC11 = @CC_FOR_TARGET_M68HC11@
+CC_FOR_TARGET_MCORE = @CC_FOR_TARGET_MCORE@
+CC_FOR_TARGET_MICROBLAZE = @CC_FOR_TARGET_MICROBLAZE@
+CC_FOR_TARGET_MIPS = @CC_FOR_TARGET_MIPS@
+CC_FOR_TARGET_MN10300 = @CC_FOR_TARGET_MN10300@
+CC_FOR_TARGET_MOXIE = @CC_FOR_TARGET_MOXIE@
+CC_FOR_TARGET_MSP430 = @CC_FOR_TARGET_MSP430@
+CC_FOR_TARGET_OR1K = @CC_FOR_TARGET_OR1K@
+CC_FOR_TARGET_PPC = @CC_FOR_TARGET_PPC@
+CC_FOR_TARGET_PRU = @CC_FOR_TARGET_PRU@
+CC_FOR_TARGET_RISCV = @CC_FOR_TARGET_RISCV@
+CC_FOR_TARGET_RL78 = @CC_FOR_TARGET_RL78@
+CC_FOR_TARGET_RX = @CC_FOR_TARGET_RX@
+CC_FOR_TARGET_SH = @CC_FOR_TARGET_SH@
+CC_FOR_TARGET_V850 = @CC_FOR_TARGET_V850@
 CFLAGS = @CFLAGS@
 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
 CGEN_MAINT = @CGEN_MAINT@
@@ -1112,6 +1176,38 @@ INSTOBJEXT = @INSTOBJEXT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LD_FOR_TARGET_AARCH64 = @LD_FOR_TARGET_AARCH64@
+LD_FOR_TARGET_ARM = @LD_FOR_TARGET_ARM@
+LD_FOR_TARGET_AVR = @LD_FOR_TARGET_AVR@
+LD_FOR_TARGET_BFIN = @LD_FOR_TARGET_BFIN@
+LD_FOR_TARGET_BPF = @LD_FOR_TARGET_BPF@
+LD_FOR_TARGET_CR16 = @LD_FOR_TARGET_CR16@
+LD_FOR_TARGET_CRIS = @LD_FOR_TARGET_CRIS@
+LD_FOR_TARGET_D10V = @LD_FOR_TARGET_D10V@
+LD_FOR_TARGET_ERC32 = @LD_FOR_TARGET_ERC32@
+LD_FOR_TARGET_EXAMPLE_SYNACOR = @LD_FOR_TARGET_EXAMPLE_SYNACOR@
+LD_FOR_TARGET_FRV = @LD_FOR_TARGET_FRV@
+LD_FOR_TARGET_FT32 = @LD_FOR_TARGET_FT32@
+LD_FOR_TARGET_H8300 = @LD_FOR_TARGET_H8300@
+LD_FOR_TARGET_IQ2000 = @LD_FOR_TARGET_IQ2000@
+LD_FOR_TARGET_LM32 = @LD_FOR_TARGET_LM32@
+LD_FOR_TARGET_M32C = @LD_FOR_TARGET_M32C@
+LD_FOR_TARGET_M32R = @LD_FOR_TARGET_M32R@
+LD_FOR_TARGET_M68HC11 = @LD_FOR_TARGET_M68HC11@
+LD_FOR_TARGET_MCORE = @LD_FOR_TARGET_MCORE@
+LD_FOR_TARGET_MICROBLAZE = @LD_FOR_TARGET_MICROBLAZE@
+LD_FOR_TARGET_MIPS = @LD_FOR_TARGET_MIPS@
+LD_FOR_TARGET_MN10300 = @LD_FOR_TARGET_MN10300@
+LD_FOR_TARGET_MOXIE = @LD_FOR_TARGET_MOXIE@
+LD_FOR_TARGET_MSP430 = @LD_FOR_TARGET_MSP430@
+LD_FOR_TARGET_OR1K = @LD_FOR_TARGET_OR1K@
+LD_FOR_TARGET_PPC = @LD_FOR_TARGET_PPC@
+LD_FOR_TARGET_PRU = @LD_FOR_TARGET_PRU@
+LD_FOR_TARGET_RISCV = @LD_FOR_TARGET_RISCV@
+LD_FOR_TARGET_RL78 = @LD_FOR_TARGET_RL78@
+LD_FOR_TARGET_RX = @LD_FOR_TARGET_RX@
+LD_FOR_TARGET_SH = @LD_FOR_TARGET_SH@
+LD_FOR_TARGET_V850 = @LD_FOR_TARGET_V850@
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
 LIBOBJS = @LIBOBJS@
@@ -1160,6 +1256,7 @@ SIM_INLINE = @SIM_INLINE@
 SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
 SIM_RX_CYCLE_ACCURATE_FLAGS = @SIM_RX_CYCLE_ACCURATE_FLAGS@
 SIM_SUBDIRS = @SIM_SUBDIRS@
+SIM_TOOLCHAIN_VARS = @SIM_TOOLCHAIN_VARS@
 STRIP = @STRIP@
 TERMCAP_LIB = @TERMCAP_LIB@
 USE_NLS = @USE_NLS@
@@ -2666,6 +2763,7 @@ site-sim-config.exp: Makefile
 	$(AM_V_GEN)( \
 	echo "set builddir \"$(builddir)\""; \
 	echo "set srcdir \"$(srcdir)/testsuite\""; \
+	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
 	) > $@
 
 check-DEJAGNU: site.exp
diff --git a/sim/configure.ac b/sim/configure.ac
index 86a800b6d6b1..0c14b1da79e2 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -103,6 +103,7 @@ m4_define([SIM_TARGET], [dnl
       $4
       ;;
   esac
+  SIM_AC_TOOLCHAIN_FOR_TARGET($2)
   AM_CONDITIONAL([SIM_ENABLE_ARCH_$2], [${sim_enable_arch_$2}])
 ])
 
@@ -151,6 +152,7 @@ if test "${enable_sim}" != no; then
   done
 
   if test "x${enable_example_sims}" = xyes; then
+    SIM_AC_TOOLCHAIN_FOR_TARGET(example-synacor)
     SIM_BUILD_TARGET([example-synacor])
   fi
 fi
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4
index fdd540606072..c02134e131e0 100644
--- a/sim/m4/sim_ac_toolchain.m4
+++ b/sim/m4/sim_ac_toolchain.m4
@@ -77,3 +77,28 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 ], [AC_MSG_ERROR([C11 is required])])])
 AC_SUBST(C_DIALECT)
 ])
+dnl
+SIM_TOOLCHAIN_VARS=
+AC_SUBST(SIM_TOOLCHAIN_VARS)
+AC_DEFUN([_SIM_AC_TOOLCHAIN_FOR_TARGET],
+[dnl
+AC_ARG_VAR(AS_FOR_TARGET_$2, [Assembler for $1 tests])
+AC_ARG_VAR(LD_FOR_TARGET_$2, [Linker for $1 tests])
+AC_ARG_VAR(CC_FOR_TARGET_$2, [C compiler for $1 tests])
+m4_bmatch($1, [example-], [dnl
+  : "${AS_FOR_TARGET_$2:=\$(abs_builddir)/../gas/as-new}"
+  : "${LD_FOR_TARGET_$2:=\$(abs_builddir)/../ld/ld-new}"
+  : "${CC_FOR_TARGET_$2:=\$(CC)}"
+], [dnl
+  AS_IF([test "$SIM_PRIMARY_TARGET" = "$1"], [dnl
+    : "${AS_FOR_TARGET_$2:=\$(abs_builddir)/../gas/as-new}"
+    : "${LD_FOR_TARGET_$2:=\$(abs_builddir)/../ld/ld-new}"
+    if ${target_alias}-gcc --version >/dev/null 2>&1; then
+      : "${CC_FOR_TARGET_$2:=${target_alias}-gcc}"
+    fi
+  ])
+])
+AS_VAR_APPEND([SIM_TOOLCHAIN_VARS], [" AS_FOR_TARGET_$2 LD_FOR_TARGET_$2 CC_FOR_TARGET_$2"])
+])
+AC_DEFUN([SIM_AC_TOOLCHAIN_FOR_TARGET],
+[_SIM_AC_TOOLCHAIN_FOR_TARGET($1, m4_toupper(m4_translit($1, [-], [_])))])
diff --git a/sim/testsuite/local.mk b/sim/testsuite/local.mk
index 5ffa9eca745c..378aab1d8821 100644
--- a/sim/testsuite/local.mk
+++ b/sim/testsuite/local.mk
@@ -28,6 +28,7 @@ site-sim-config.exp: Makefile
 	$(AM_V_GEN)( \
 	echo "set builddir \"$(builddir)\""; \
 	echo "set srcdir \"$(srcdir)/testsuite\""; \
+	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
 	) > $@
 
 check-DEJAGNU: site.exp
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/5] sim: testsuite: expand arch specific toolchain settings
  2021-11-27  8:23 [PATCH 1/5] sim: testsuite: setup per-port toolchain settings for multitarget build Mike Frysinger
@ 2021-11-27  8:23 ` Mike Frysinger
  2021-11-27  8:23 ` [PATCH 3/5] sim: testsuite: support parallel execution Mike Frysinger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2021-11-27  8:23 UTC (permalink / raw)
  To: gdb-patches

Leverage the new per-port toolchain settings to initialize the env
for eeach set of tests.  This allows us to run all the tests in a
multitarget build if the user sets up the vars.  If they don't, we
can still skip all the tests.
---
 sim/Makefile.in                |  1 +
 sim/testsuite/lib/sim-defs.exp | 68 ++++++++++++++++++++++++++++++----
 sim/testsuite/local.mk         |  1 +
 3 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/sim/Makefile.in b/sim/Makefile.in
index ed7566cfb1e2..990779bfc00c 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -2761,6 +2761,7 @@ common/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(src
 
 site-sim-config.exp: Makefile
 	$(AM_V_GEN)( \
+	echo "set SIM_PRIMARY_TARGET \"$(SIM_PRIMARY_TARGET)\""; \
 	echo "set builddir \"$(builddir)\""; \
 	echo "set srcdir \"$(srcdir)/testsuite\""; \
 	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp
index cd16bbb13b96..2cf739b3e32e 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -6,6 +6,17 @@
 # [Presumubly because the target has been "popped" by then.  Odd though.]
 set sim_path "unknown-run"
 
+# Find the simulator arch.
+
+proc sim_arch {} {
+    global subdir
+    set arch "$subdir"
+    while { [file dirname $arch] != "." } {
+	set arch [file dirname $arch]
+    }
+    return "$arch"
+}
+
 # Initialize the testrun.
 #
 # Normally dejagnu will execute ${tool}_init automatically, but since we set
@@ -18,11 +29,7 @@ proc sim_init { args } {
     global sim_path
 
     # Find the path to the simulator for executing.
-    set arch "$subdir"
-    while { [file dirname $arch] != "." } {
-	set arch [file dirname $arch]
-    }
-    set sim_path "$builddir/$arch/run"
+    set sim_path "$builddir/[sim_arch]/run"
 
     # As gross as it is, we unset the linker script specified by the target
     # board.  The simulator board file mips-sim.exp, sets ldscript to the
@@ -52,6 +59,7 @@ proc sim_init_toolchain {} {
     global CFLAGS_FOR_TARGET
     global LDFLAGS_FOR_TARGET
     global SIMFLAGS_FOR_TARGET
+    global global_as_works
     global global_cpp_works
     global global_cc_works
     global global_cc_os
@@ -65,6 +73,42 @@ proc sim_init_toolchain {} {
     set SIMFLAGS_FOR_TARGET ""
     unset -nocomplain cpu_option cpu_option_sep
 
+    # The configure script created XXX_FOR_TARGET_$ARCH for us, so merge those
+    # into plain XXX_FOR_TARGET for this particular arch run.
+    global SIM_PRIMARY_TARGET
+    set arch [sim_arch]
+    set ARCH [string map {- _} [string toupper $arch]]
+    foreach var {AS LD CC} {
+	set var_for_target "${var}_FOR_TARGET"
+	global $var_for_target
+	set var_for_target_arch "${var_for_target}_${ARCH}"
+	global $var_for_target_arch
+
+	if [info exists $var_for_target_arch] {
+	    set $var_for_target [set $var_for_target_arch]
+	} else {
+	    set $var_for_target ""
+	}
+
+	if { [set $var_for_target] == "" } {
+	    # If building for the primary target, use the default settings.
+	    if { $arch == $SIM_PRIMARY_TARGET } {
+		unset -nocomplain $var_for_target
+	    } {
+		set $var_for_target false
+	    }
+	}
+    }
+
+    # See if an assembler is available.
+    if { $arch != $SIM_PRIMARY_TARGET && $AS_FOR_TARGET == "false" } {
+	verbose -log "Can't find a compatible assembler"
+	set global_as_works 0
+    } {
+	verbose -log "Found a compatible assembler"
+	set global_as_works 1
+    }
+
     # Merge per-test settings if available.
     if ![info exists CFLAGS_FOR_TARGET_init] {
 	set CFLAGS_FOR_TARGET_init ""
@@ -77,8 +121,11 @@ proc sim_init_toolchain {} {
     set global_cpp_works [string equal "" "$result"]
 
     # See if we have a compiler available, and which environment it's targeting.
-    if { [target_compile $srcdir/lib/newlibcheck.c \
-	  $objdir/compilercheck.x "executable" $cc_options] == "" } {
+    if { $arch != $SIM_PRIMARY_TARGET && $CC_FOR_TARGET == "false" } {
+	verbose -log "Can't find a compatible C compiler"
+	set global_cc_works 0
+    } elseif { [target_compile $srcdir/lib/newlibcheck.c \
+		$objdir/compilercheck.x "executable" $cc_options] == "" } {
 	verbose -log "Found newlib C compiler"
 	set global_cc_works 1
 	set global_cc_os "newlib"
@@ -250,6 +297,7 @@ proc run_sim_test { name requested_machs } {
     global cpu_option
     global cpu_option_sep
     global SIMFLAGS_FOR_TARGET
+    global global_as_works
     global global_cpp_works
     global global_cc_works
     global global_cc_os
@@ -411,6 +459,12 @@ proc run_sim_test { name requested_machs } {
 		[list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options $c_ld_options $opts(cc,$mach)"]]
 	    set method "compiling/linking"
 	} else {
+	    # If we don't have an assembler available, skip tests :(.
+	    if { $global_as_works == 0 } {
+		untested $subdir/$name
+		return
+	    }
+
 	    if [string match "*.S" $sourcefile] {
 		# If we don't have a preprocessor available, skip tests :(.
 		if { $global_cpp_works == 0 } {
diff --git a/sim/testsuite/local.mk b/sim/testsuite/local.mk
index 378aab1d8821..977d12f5d282 100644
--- a/sim/testsuite/local.mk
+++ b/sim/testsuite/local.mk
@@ -26,6 +26,7 @@ AM_V_RUNTEST_1 =
 
 site-sim-config.exp: Makefile
 	$(AM_V_GEN)( \
+	echo "set SIM_PRIMARY_TARGET \"$(SIM_PRIMARY_TARGET)\""; \
 	echo "set builddir \"$(builddir)\""; \
 	echo "set srcdir \"$(srcdir)/testsuite\""; \
 	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/5] sim: testsuite: support parallel execution
  2021-11-27  8:23 [PATCH 1/5] sim: testsuite: setup per-port toolchain settings for multitarget build Mike Frysinger
  2021-11-27  8:23 ` [PATCH 2/5] sim: testsuite: expand arch specific toolchain settings Mike Frysinger
@ 2021-11-27  8:23 ` Mike Frysinger
  2021-11-27  8:23 ` [PATCH 4/5] sim: testsuite: drop most specific istarget checks Mike Frysinger
  2021-11-27  8:23 ` [PATCH 5/5] sim: frv: split up testsuite a bit Mike Frysinger
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2021-11-27  8:23 UTC (permalink / raw)
  To: gdb-patches

Break up the dejagnu logic so that we can parallelize the testsuite.
This takes a page from gcc & gdb where each .exp is run in isolation
instead of in serial.

For most targets, this doesn't make much of a difference as they only
have a single .exp.  A few (like cris & frv) have multiple .exp though
and will see a bit of a speed up.

The real gain is when testing a multitarget build.  This way we can
run all the targets in parallel and cut the execution time a bit.
On my system, it goes from ~155sec to ~100sec.

We can gain further speedups by splitting up some of the larger .exp
files into smaller groups.  We'll do that in a followup though.
---
 sim/Makefile.in        | 45 +++++++++++++++++++++++++++++++++++++-----
 sim/testsuite/local.mk | 45 +++++++++++++++++++++++++++++++++++++-----
 2 files changed, 80 insertions(+), 10 deletions(-)

diff --git a/sim/Makefile.in b/sim/Makefile.in
index 990779bfc00c..61de021f53c0 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -1438,8 +1438,14 @@ EXTRA_DEJAGNU_SITE_CONFIG = site-sim-config.exp
 # Custom verbose test variables that automake doesn't provide (yet?).
 AM_V_RUNTEST = $(AM_V_RUNTEST_@AM_V@)
 AM_V_RUNTEST_ = $(AM_V_RUNTEST_@AM_DEFAULT_V@)
-AM_V_RUNTEST_0 = @echo "  RUNTEST  $(RUNTESTFLAGS)";
+AM_V_RUNTEST_0 = @echo "  RUNTEST  $(RUNTESTFLAGS) $*";
 AM_V_RUNTEST_1 = 
+DO_RUNTEST = \
+	LC_ALL=C; export LC_ALL; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	runtest=$(RUNTEST); \
+	$$runtest $(RUNTESTFLAGS)
+
 testsuite_common_CPPFLAGS = \
 	-I$(srcdir)/common \
 	-I$(srcroot)/include \
@@ -2767,14 +2773,43 @@ site-sim-config.exp: Makefile
 	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
 	) > $@
 
+# Ignore dirs that only contain configuration settings.
+check/./config/%.exp: ; @true
+check/./lib/%.exp: ; @true
+
+check/%.exp:
+	$(AM_V_at)mkdir -p testsuite/$*
+	$(AM_V_RUNTEST)$(DO_RUNTEST) --objdir testsuite/$* --outdir testsuite/$* $*.exp
+
+check-DEJAGNU-parallel:
+	$(AM_V_at)( \
+	$(MAKE) -k \
+	  `cd $(srcdir)/testsuite && find . -name '*.exp' -printf 'check/%p '`; \
+	ret=$$?; \
+	$(SHELL) $(srcroot)/contrib/dg-extract-results.sh \
+	  `find testsuite/ -maxdepth 4 -name testrun.sum | sort` > testrun.sum; \
+	$(SHELL) $(srcroot)/contrib/dg-extract-results.sh -L \
+	  `find testsuite/ -maxdepth 4 -name testrun.log | sort` > testrun.log; \
+	echo; \
+	$(SED) -n '/^.*===.*Summary.*===/,$$p' testrun.sum; \
+	exit $$ret)
+
+check-DEJAGNU-single:
+	$(AM_V_RUNTEST)$(DO_RUNTEST)
+
+# If running a single job, invoking runtest once is faster & has nicer output.
 check-DEJAGNU: site.exp
-	$(AM_V_RUNTEST)LC_ALL=C; export LC_ALL; \
+	$(AM_V_at)(set -e; \
 	EXPECT=${EXPECT} ; export EXPECT ; \
 	runtest=$(RUNTEST); \
 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
-	  $$runtest $(RUNTESTFLAGS); \
-	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
-	fi
+	  case "$(MAKEFLAGS)" in \
+	  *-j*) $(MAKE) check-DEJAGNU-parallel;; \
+	  *)    $(MAKE) check-DEJAGNU-single;; \
+	  esac; \
+	else \
+	  echo "WARNING: could not find \`runtest'" 1>&2; :;\
+	fi)
 
 # These tests are build-time only tools.  Override the default rules for them.
 testsuite/common/%.o: testsuite/common/%.c
diff --git a/sim/testsuite/local.mk b/sim/testsuite/local.mk
index 977d12f5d282..5061a677e323 100644
--- a/sim/testsuite/local.mk
+++ b/sim/testsuite/local.mk
@@ -21,7 +21,7 @@ EXTRA_DEJAGNU_SITE_CONFIG = site-sim-config.exp
 # Custom verbose test variables that automake doesn't provide (yet?).
 AM_V_RUNTEST = $(AM_V_RUNTEST_@AM_V@)
 AM_V_RUNTEST_ = $(AM_V_RUNTEST_@AM_DEFAULT_V@)
-AM_V_RUNTEST_0 =  @echo "  RUNTEST  $(RUNTESTFLAGS)";
+AM_V_RUNTEST_0 =  @echo "  RUNTEST  $(RUNTESTFLAGS) $*";
 AM_V_RUNTEST_1 =
 
 site-sim-config.exp: Makefile
@@ -32,14 +32,49 @@ site-sim-config.exp: Makefile
 	$(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
 	) > $@
 
+DO_RUNTEST = \
+	LC_ALL=C; export LC_ALL; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	runtest=$(RUNTEST); \
+	$$runtest $(RUNTESTFLAGS)
+
+# Ignore dirs that only contain configuration settings.
+check/./config/%.exp: ; @true
+check/./lib/%.exp: ; @true
+
+check/%.exp:
+	$(AM_V_at)mkdir -p testsuite/$*
+	$(AM_V_RUNTEST)$(DO_RUNTEST) --objdir testsuite/$* --outdir testsuite/$* $*.exp
+
+check-DEJAGNU-parallel:
+	$(AM_V_at)( \
+	$(MAKE) -k \
+	  `cd $(srcdir)/testsuite && find . -name '*.exp' -printf 'check/%p '`; \
+	ret=$$?; \
+	$(SHELL) $(srcroot)/contrib/dg-extract-results.sh \
+	  `find testsuite/ -maxdepth 4 -name testrun.sum | sort` > testrun.sum; \
+	$(SHELL) $(srcroot)/contrib/dg-extract-results.sh -L \
+	  `find testsuite/ -maxdepth 4 -name testrun.log | sort` > testrun.log; \
+	echo; \
+	$(SED) -n '/^.*===.*Summary.*===/,$$p' testrun.sum; \
+	exit $$ret)
+
+check-DEJAGNU-single:
+	$(AM_V_RUNTEST)$(DO_RUNTEST)
+
+# If running a single job, invoking runtest once is faster & has nicer output.
 check-DEJAGNU: site.exp
-	$(AM_V_RUNTEST)LC_ALL=C; export LC_ALL; \
+	$(AM_V_at)(set -e; \
 	EXPECT=${EXPECT} ; export EXPECT ; \
 	runtest=$(RUNTEST); \
 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
-	  $$runtest $(RUNTESTFLAGS); \
-	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
-	fi
+	  case "$(MAKEFLAGS)" in \
+	  *-j*) $(MAKE) check-DEJAGNU-parallel;; \
+	  *)    $(MAKE) check-DEJAGNU-single;; \
+	  esac; \
+	else \
+	  echo "WARNING: could not find \`runtest'" 1>&2; :;\
+	fi)
 
 MOSTLYCLEANFILES += \
 	site-sim-config.exp testrun.log testrun.sum
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/5] sim: testsuite: drop most specific istarget checks
  2021-11-27  8:23 [PATCH 1/5] sim: testsuite: setup per-port toolchain settings for multitarget build Mike Frysinger
  2021-11-27  8:23 ` [PATCH 2/5] sim: testsuite: expand arch specific toolchain settings Mike Frysinger
  2021-11-27  8:23 ` [PATCH 3/5] sim: testsuite: support parallel execution Mike Frysinger
@ 2021-11-27  8:23 ` Mike Frysinger
  2021-11-27  8:23 ` [PATCH 5/5] sim: frv: split up testsuite a bit Mike Frysinger
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2021-11-27  8:23 UTC (permalink / raw)
  To: gdb-patches

We'll rely on the toolchain probing to determine whether each arch's
tests can be run rather the current configure target.  This allows
testing all of the ports in a multitarget configuration.

For now, we don't reformat the files entirely to make it easier to
review, and in case we need to make adjustments.  Once this feels
like it's stable, we can flatten the code a bit by removing the if
statement entirely.
---
 sim/testsuite/aarch64/allinsn.exp       | 2 +-
 sim/testsuite/arm/allinsn.exp           | 2 +-
 sim/testsuite/arm/iwmmxt/iwmmxt.exp     | 2 +-
 sim/testsuite/arm/misc.exp              | 2 +-
 sim/testsuite/arm/thumb/allthumb.exp    | 2 +-
 sim/testsuite/arm/xscale/xscale.exp     | 2 +-
 sim/testsuite/avr/allinsn.exp           | 2 +-
 sim/testsuite/bfin/allinsn.exp          | 2 +-
 sim/testsuite/bpf/allinsn.exp           | 2 +-
 sim/testsuite/cr16/allinsn.exp          | 2 +-
 sim/testsuite/cr16/misc.exp             | 2 +-
 sim/testsuite/cris/asm/asm.exp          | 2 +-
 sim/testsuite/cris/c/c.exp              | 6 +-----
 sim/testsuite/cris/hw/rv-n-cris/rvc.exp | 2 +-
 sim/testsuite/d10v/allinsn.exp          | 2 +-
 sim/testsuite/frv/allinsn.exp           | 2 +-
 sim/testsuite/frv/cache.ms              | 2 +-
 sim/testsuite/frv/fr400/allinsn.exp     | 2 +-
 sim/testsuite/frv/fr500/allinsn.exp     | 2 +-
 sim/testsuite/frv/fr550/allinsn.exp     | 2 +-
 sim/testsuite/frv/interrupts.exp        | 2 +-
 sim/testsuite/frv/misc.exp              | 2 +-
 sim/testsuite/frv/parallel.exp          | 2 +-
 sim/testsuite/ft32/allinsn.exp          | 2 +-
 sim/testsuite/h8300/allinsn.exp         | 2 +-
 sim/testsuite/iq2000/allinsn.exp        | 2 +-
 sim/testsuite/lm32/allinsn.exp          | 2 +-
 sim/testsuite/m32c/allinsn.exp          | 2 +-
 sim/testsuite/m32r/allinsn.exp          | 2 +-
 sim/testsuite/m32r/misc.exp             | 2 +-
 sim/testsuite/m68hc11/allinsn.exp       | 2 +-
 sim/testsuite/mcore/allinsn.exp         | 2 +-
 sim/testsuite/microblaze/allinsn.exp    | 2 +-
 sim/testsuite/mips/basic.exp            | 3 +--
 sim/testsuite/mn10300/allinsn.exp       | 2 +-
 sim/testsuite/moxie/allinsn.exp         | 2 +-
 sim/testsuite/msp430/allinsn.exp        | 2 +-
 sim/testsuite/or1k/alltests.exp         | 2 +-
 sim/testsuite/pru/allinsn.exp           | 2 +-
 sim/testsuite/riscv/allinsn.exp         | 2 +-
 sim/testsuite/sh/allinsn.exp            | 2 +-
 sim/testsuite/v850/allinsns.exp         | 2 +-
 42 files changed, 42 insertions(+), 47 deletions(-)

diff --git a/sim/testsuite/aarch64/allinsn.exp b/sim/testsuite/aarch64/allinsn.exp
index 402d7483f4f0..e09d15739b3d 100644
--- a/sim/testsuite/aarch64/allinsn.exp
+++ b/sim/testsuite/aarch64/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget aarch64*-*] {
+if [istarget *] {
     # all machines
     set all_machs "aarch64"
 
diff --git a/sim/testsuite/arm/allinsn.exp b/sim/testsuite/arm/allinsn.exp
index ef41c955a64b..da28b69e51a6 100644
--- a/sim/testsuite/arm/allinsn.exp
+++ b/sim/testsuite/arm/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if { [istarget arm*-*-*] } {
+if { [istarget *] } {
     # all machines
     set all_machs "xscale"
 
diff --git a/sim/testsuite/arm/iwmmxt/iwmmxt.exp b/sim/testsuite/arm/iwmmxt/iwmmxt.exp
index 7283a4246b00..19a78a201ed7 100644
--- a/sim/testsuite/arm/iwmmxt/iwmmxt.exp
+++ b/sim/testsuite/arm/iwmmxt/iwmmxt.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if { [istarget arm*-*-*] } {
+if { [istarget *] } {
     # all machines
     set all_machs "xscale"
 
diff --git a/sim/testsuite/arm/misc.exp b/sim/testsuite/arm/misc.exp
index 0b939a6c56ff..47d714cce2f9 100644
--- a/sim/testsuite/arm/misc.exp
+++ b/sim/testsuite/arm/misc.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if { [istarget arm*-*-*] } {
+if { [istarget *] } {
     # all machines
     set all_machs "arm7tdmi"
 
diff --git a/sim/testsuite/arm/thumb/allthumb.exp b/sim/testsuite/arm/thumb/allthumb.exp
index 76aac9395557..36eb29c08f0f 100644
--- a/sim/testsuite/arm/thumb/allthumb.exp
+++ b/sim/testsuite/arm/thumb/allthumb.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if { [istarget arm*-*-*] } {
+if { [istarget *] } {
     # all machines
     set all_machs "arm7tdmi"
 
diff --git a/sim/testsuite/arm/xscale/xscale.exp b/sim/testsuite/arm/xscale/xscale.exp
index 17e99c3fd027..80faf5c119fd 100644
--- a/sim/testsuite/arm/xscale/xscale.exp
+++ b/sim/testsuite/arm/xscale/xscale.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if { [istarget arm*-*-*] } {
+if { [istarget *] } {
     # all machines
     set all_machs "xscale"
 
diff --git a/sim/testsuite/avr/allinsn.exp b/sim/testsuite/avr/allinsn.exp
index c82610c8e781..56b6e396881d 100644
--- a/sim/testsuite/avr/allinsn.exp
+++ b/sim/testsuite/avr/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget avr-*] {
+if [istarget *] {
     # all machines
     set all_machs "avr"
 
diff --git a/sim/testsuite/bfin/allinsn.exp b/sim/testsuite/bfin/allinsn.exp
index 2be369dc9383..d6a45304e36c 100644
--- a/sim/testsuite/bfin/allinsn.exp
+++ b/sim/testsuite/bfin/allinsn.exp
@@ -6,7 +6,7 @@ global CFLAGS_FOR_TARGET_init
 set CFLAGS_FOR_TARGET_init "-mcpu=bf537"
 sim_init
 
-if [istarget bfin-*-elf] {
+if [istarget *] {
     # all machines
     set all_machs "bfin"
 
diff --git a/sim/testsuite/bpf/allinsn.exp b/sim/testsuite/bpf/allinsn.exp
index 4f81d4cee166..88752b8e568d 100644
--- a/sim/testsuite/bpf/allinsn.exp
+++ b/sim/testsuite/bpf/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget bpf-unknown-none] {
+if [istarget *] {
     # all machines
     set all_machs "bpf"
 
diff --git a/sim/testsuite/cr16/allinsn.exp b/sim/testsuite/cr16/allinsn.exp
index 3f05fb974cf2..39b464a85ffc 100644
--- a/sim/testsuite/cr16/allinsn.exp
+++ b/sim/testsuite/cr16/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget cr16*-*-*] {
+if [istarget *] {
     # all machines
     set all_machs "cr16"
 
diff --git a/sim/testsuite/cr16/misc.exp b/sim/testsuite/cr16/misc.exp
index 136b0e798da2..4d42667b0a43 100644
--- a/sim/testsuite/cr16/misc.exp
+++ b/sim/testsuite/cr16/misc.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget cr16*-*-*] {
+if [istarget *] {
     # all machines
     set all_machs "cr16"
 
diff --git a/sim/testsuite/cris/asm/asm.exp b/sim/testsuite/cris/asm/asm.exp
index d64d3526e4c8..364cf989c283 100644
--- a/sim/testsuite/cris/asm/asm.exp
+++ b/sim/testsuite/cris/asm/asm.exp
@@ -17,7 +17,7 @@
 
 sim_init
 
-if [istarget cris*-*-*] {
+if [istarget *] {
     global ASFLAGS_FOR_TARGET
     # All machines we test and the corresponding assembler option.  Needs
     # update if we build the simulator for crisv0 crisv3 and crisv8 too.
diff --git a/sim/testsuite/cris/c/c.exp b/sim/testsuite/cris/c/c.exp
index e43259434bc3..a6c96057c552 100644
--- a/sim/testsuite/cris/c/c.exp
+++ b/sim/testsuite/cris/c/c.exp
@@ -17,10 +17,6 @@
 
 sim_init
 
-if ![istarget cris*-*-*] {
-    return
-}
-
 set CFLAGS_FOR_TARGET "-O2"
 if [istarget cris-*-*] {
     set mach "crisv10"
@@ -28,7 +24,7 @@ if [istarget cris-*-*] {
     set mach "crisv32"
 }
 
-if [istarget cris*-*-elf] {
+if [istarget *] {
     append CFLAGS_FOR_TARGET " -sim"
 }
 
diff --git a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
index 905a2da92ece..e675c4d2fcdc 100644
--- a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
+++ b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
@@ -116,7 +116,7 @@ proc slurp_rv { file } {
 
 # The main test loop.
 
-if [istarget cris*-*-*] {
+if [istarget *] {
     global ASFLAGS_FOR_TARGET
     global LDFLAGS_FOR_TARGET
     global SIMFLAGS_FOR_TARGET
diff --git a/sim/testsuite/d10v/allinsn.exp b/sim/testsuite/d10v/allinsn.exp
index 6e7619691dca..97265a15db7b 100644
--- a/sim/testsuite/d10v/allinsn.exp
+++ b/sim/testsuite/d10v/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget d10v*-*] {
+if [istarget *] {
     # all machines
     set all_machs "d10v"
 
diff --git a/sim/testsuite/frv/allinsn.exp b/sim/testsuite/frv/allinsn.exp
index dea804109a40..32a87a3a3548 100644
--- a/sim/testsuite/frv/allinsn.exp
+++ b/sim/testsuite/frv/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "frv fr500 fr550 fr400 fr405 fr450"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/cache.ms b/sim/testsuite/frv/cache.ms
index 5b93f0100024..4ed18d0ddc6f 100644
--- a/sim/testsuite/frv/cache.ms
+++ b/sim/testsuite/frv/cache.ms
@@ -1,6 +1,6 @@
 # mach: frv fr500 fr550
 # sim: --memory-region 0xff000000,4 --memory-region 0xfe000000,00404000
-# xfail: "crashes with bad write" frv-*
+# xfail: "crashes with bad write" *-*
 
 ; Exit with return code
 
diff --git a/sim/testsuite/frv/fr400/allinsn.exp b/sim/testsuite/frv/fr400/allinsn.exp
index ed501e5400f2..4f92f227d925 100644
--- a/sim/testsuite/frv/fr400/allinsn.exp
+++ b/sim/testsuite/frv/fr400/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "fr400 fr405 fr450 fr550"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/fr500/allinsn.exp b/sim/testsuite/frv/fr500/allinsn.exp
index 40d81d9e3f26..ec1309a24411 100644
--- a/sim/testsuite/frv/fr500/allinsn.exp
+++ b/sim/testsuite/frv/fr500/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "frv fr500 fr550"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/fr550/allinsn.exp b/sim/testsuite/frv/fr550/allinsn.exp
index 91948beada40..56df37d427dc 100644
--- a/sim/testsuite/frv/fr550/allinsn.exp
+++ b/sim/testsuite/frv/fr550/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "fr550"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/interrupts.exp b/sim/testsuite/frv/interrupts.exp
index 38c2f410c106..ec83de422ea8 100644
--- a/sim/testsuite/frv/interrupts.exp
+++ b/sim/testsuite/frv/interrupts.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "frv fr500 fr550 fr400"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/misc.exp b/sim/testsuite/frv/misc.exp
index 2025935da8ca..21877f963381 100644
--- a/sim/testsuite/frv/misc.exp
+++ b/sim/testsuite/frv/misc.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "frv fr500 fr550 fr400 fr405 fr450"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/parallel.exp b/sim/testsuite/frv/parallel.exp
index 2fcc6529182b..00bcccd66efb 100644
--- a/sim/testsuite/frv/parallel.exp
+++ b/sim/testsuite/frv/parallel.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget frv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "frv fr500 fr550 fr400"
     set cpu_option -mcpu
diff --git a/sim/testsuite/ft32/allinsn.exp b/sim/testsuite/ft32/allinsn.exp
index 6958f0612285..260f13e1cebc 100644
--- a/sim/testsuite/ft32/allinsn.exp
+++ b/sim/testsuite/ft32/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget ft32-*] {
+if [istarget *] {
     # all machines
     set all_machs "ft32"
 
diff --git a/sim/testsuite/h8300/allinsn.exp b/sim/testsuite/h8300/allinsn.exp
index df4d02aad364..f270661f021e 100644
--- a/sim/testsuite/h8300/allinsn.exp
+++ b/sim/testsuite/h8300/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if {[istarget h8300*-*-*] || [istarget h8sx*-*-*]} then {
+if {[istarget *]} {
     set all_machs "h8300 h8300h h8300s h8sx"
 
     foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] {
diff --git a/sim/testsuite/iq2000/allinsn.exp b/sim/testsuite/iq2000/allinsn.exp
index c6a83a0f7541..30a1c94ea61d 100644
--- a/sim/testsuite/iq2000/allinsn.exp
+++ b/sim/testsuite/iq2000/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget iq2000-*] {
+if [istarget *] {
     # all machines
     set all_machs "iq2000"
 
diff --git a/sim/testsuite/lm32/allinsn.exp b/sim/testsuite/lm32/allinsn.exp
index c3e70b223df8..fb5d4d3471e3 100644
--- a/sim/testsuite/lm32/allinsn.exp
+++ b/sim/testsuite/lm32/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget lm32-*] {
+if [istarget *] {
     # all machines
     set all_machs "lm32"
 
diff --git a/sim/testsuite/m32c/allinsn.exp b/sim/testsuite/m32c/allinsn.exp
index 045cc7e6bac3..c979514f5dd8 100644
--- a/sim/testsuite/m32c/allinsn.exp
+++ b/sim/testsuite/m32c/allinsn.exp
@@ -3,7 +3,7 @@
 
 sim_init
 
-if [istarget m32c*-*-*] {
+if [istarget *] {
     # all machines
     set all_machs "m32c"
 
diff --git a/sim/testsuite/m32r/allinsn.exp b/sim/testsuite/m32r/allinsn.exp
index 146113458f35..c20fc86558be 100644
--- a/sim/testsuite/m32r/allinsn.exp
+++ b/sim/testsuite/m32r/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget m32r*-*-*] {
+if [istarget *] {
     # all machines
     set all_machs "m32r"
 
diff --git a/sim/testsuite/m32r/misc.exp b/sim/testsuite/m32r/misc.exp
index d45e119c5096..2ca2c03018ba 100644
--- a/sim/testsuite/m32r/misc.exp
+++ b/sim/testsuite/m32r/misc.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget m32r*-*-*] {
+if [istarget *] {
     # all machines
     set all_machs "m32r"
 
diff --git a/sim/testsuite/m68hc11/allinsn.exp b/sim/testsuite/m68hc11/allinsn.exp
index 710af981064c..09653a00c45f 100644
--- a/sim/testsuite/m68hc11/allinsn.exp
+++ b/sim/testsuite/m68hc11/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget m68hc11-*] {
+if [istarget *] {
     # all machines
     set all_machs "m68hc11"
 
diff --git a/sim/testsuite/mcore/allinsn.exp b/sim/testsuite/mcore/allinsn.exp
index 6463ac2ae859..64747752a8e5 100644
--- a/sim/testsuite/mcore/allinsn.exp
+++ b/sim/testsuite/mcore/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget mcore-*] {
+if [istarget *] {
     # all machines
     set all_machs "mcore"
 
diff --git a/sim/testsuite/microblaze/allinsn.exp b/sim/testsuite/microblaze/allinsn.exp
index f3662c293913..3f582b033d3d 100644
--- a/sim/testsuite/microblaze/allinsn.exp
+++ b/sim/testsuite/microblaze/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget microblaze-*] {
+if [istarget *] {
     # all machines
     set all_machs "microblaze"
 
diff --git a/sim/testsuite/mips/basic.exp b/sim/testsuite/mips/basic.exp
index 150949283b40..81cce85a5b2e 100644
--- a/sim/testsuite/mips/basic.exp
+++ b/sim/testsuite/mips/basic.exp
@@ -41,8 +41,7 @@ proc run_sim_tests { name requested_machs { requested_micromips_machs "" } } {
     run_micromips_test $name $requested_micromips_machs
 }
 
-# Only test mips*-*-elf (e.g., no mips*-*-linux)
-if {[istarget mips*-*-elf]} {
+if {[istarget *]} {
     set dspmodels ""
     set mdmxmodels ""
     set micromipsmodels ""
diff --git a/sim/testsuite/mn10300/allinsn.exp b/sim/testsuite/mn10300/allinsn.exp
index 2eaf249c98f0..3e5903ac7ba0 100644
--- a/sim/testsuite/mn10300/allinsn.exp
+++ b/sim/testsuite/mn10300/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget mn10300-*] {
+if [istarget *] {
     # all machines
     set all_machs "mn10300"
 
diff --git a/sim/testsuite/moxie/allinsn.exp b/sim/testsuite/moxie/allinsn.exp
index d53408592162..3f2f0a7ac3fa 100644
--- a/sim/testsuite/moxie/allinsn.exp
+++ b/sim/testsuite/moxie/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget moxie-*] {
+if [istarget *] {
     # all machines
     set all_machs "moxie"
 
diff --git a/sim/testsuite/msp430/allinsn.exp b/sim/testsuite/msp430/allinsn.exp
index c7da3c587134..888afa918d84 100644
--- a/sim/testsuite/msp430/allinsn.exp
+++ b/sim/testsuite/msp430/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget msp430-*] {
+if [istarget *] {
     # all machines
     set all_machs "msp430"
 
diff --git a/sim/testsuite/or1k/alltests.exp b/sim/testsuite/or1k/alltests.exp
index 6f4238dbe7ec..a3d07692b30c 100644
--- a/sim/testsuite/or1k/alltests.exp
+++ b/sim/testsuite/or1k/alltests.exp
@@ -17,7 +17,7 @@
 
 sim_init
 
-if [istarget or1k*-*-*] {
+if [istarget *] {
     set all_machs "or1k"
 
     global LDFLAGS_FOR_TARGET
diff --git a/sim/testsuite/pru/allinsn.exp b/sim/testsuite/pru/allinsn.exp
index b71a387d7826..3c7b4fd019fa 100644
--- a/sim/testsuite/pru/allinsn.exp
+++ b/sim/testsuite/pru/allinsn.exp
@@ -20,7 +20,7 @@
 
 sim_init
 
-if [istarget pru-*] {
+if [istarget *] {
     # all machines
     set all_machs "pru"
 
diff --git a/sim/testsuite/riscv/allinsn.exp b/sim/testsuite/riscv/allinsn.exp
index bdf92993f058..db310c30ea58 100644
--- a/sim/testsuite/riscv/allinsn.exp
+++ b/sim/testsuite/riscv/allinsn.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget riscv*-*] {
+if [istarget *] {
     # all machines
     set all_machs "riscv"
 
diff --git a/sim/testsuite/sh/allinsn.exp b/sim/testsuite/sh/allinsn.exp
index ceed950490e2..69d324ae91d9 100644
--- a/sim/testsuite/sh/allinsn.exp
+++ b/sim/testsuite/sh/allinsn.exp
@@ -14,7 +14,7 @@ foreach opt $board_variant_list {
     }
 }
 
-if [istarget sh-*elf] {
+if [istarget *] {
     foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] {
 	run_sim_test $src $all_machs
     }
diff --git a/sim/testsuite/v850/allinsns.exp b/sim/testsuite/v850/allinsns.exp
index f2a43cab1d36..1aa80249f9db 100644
--- a/sim/testsuite/v850/allinsns.exp
+++ b/sim/testsuite/v850/allinsns.exp
@@ -2,7 +2,7 @@
 
 sim_init
 
-if [istarget v850*-*] {
+if [istarget *] {
     # All machines.
     # Should add more cpus if the testsuite adds coverage for their insns, but
     # at the core level, there's no deviation beyond these two.
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 5/5] sim: frv: split up testsuite a bit
  2021-11-27  8:23 [PATCH 1/5] sim: testsuite: setup per-port toolchain settings for multitarget build Mike Frysinger
                   ` (2 preceding siblings ...)
  2021-11-27  8:23 ` [PATCH 4/5] sim: testsuite: drop most specific istarget checks Mike Frysinger
@ 2021-11-27  8:23 ` Mike Frysinger
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2021-11-27  8:23 UTC (permalink / raw)
  To: gdb-patches

Running frv's allinsn in serial is quite slow due to the sheer number
of tests it contains.  By splitting it up and running in parallel, the
execution time on my system goes from ~100sec to ~60sec.
---
 sim/testsuite/frv/allinsn-a-b.exp             | 19 +++++++++++++++++++
 .../frv/{allinsn.exp => allinsn-c.exp}        |  2 +-
 sim/testsuite/frv/allinsn-d-h.exp             | 19 +++++++++++++++++++
 sim/testsuite/frv/allinsn-i-l.exp             | 19 +++++++++++++++++++
 sim/testsuite/frv/allinsn-m.exp               | 19 +++++++++++++++++++
 sim/testsuite/frv/allinsn-n.exp               | 19 +++++++++++++++++++
 sim/testsuite/frv/allinsn-o-s.exp             | 19 +++++++++++++++++++
 sim/testsuite/frv/allinsn-t-z.exp             | 19 +++++++++++++++++++
 8 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 sim/testsuite/frv/allinsn-a-b.exp
 rename sim/testsuite/frv/{allinsn.exp => allinsn-c.exp} (83%)
 create mode 100644 sim/testsuite/frv/allinsn-d-h.exp
 create mode 100644 sim/testsuite/frv/allinsn-i-l.exp
 create mode 100644 sim/testsuite/frv/allinsn-m.exp
 create mode 100644 sim/testsuite/frv/allinsn-n.exp
 create mode 100644 sim/testsuite/frv/allinsn-o-s.exp
 create mode 100644 sim/testsuite/frv/allinsn-t-z.exp

diff --git a/sim/testsuite/frv/allinsn-a-b.exp b/sim/testsuite/frv/allinsn-a-b.exp
new file mode 100644
index 000000000000..1451f66a659e
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-a-b.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[a-b\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/frv/allinsn.exp b/sim/testsuite/frv/allinsn-c.exp
similarity index 83%
rename from sim/testsuite/frv/allinsn.exp
rename to sim/testsuite/frv/allinsn-c.exp
index 32a87a3a3548..0c5004dd0bc9 100644
--- a/sim/testsuite/frv/allinsn.exp
+++ b/sim/testsuite/frv/allinsn-c.exp
@@ -8,7 +8,7 @@ if [istarget *] {
     set cpu_option -mcpu
 
     # The .cgs suffix is for "cgen .s".
-    foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[c\]*.cgs]] {
 	# If we're only testing specific files and this isn't one of them,
 	# skip it.
 	if ![runtest_file_p $runtests $src] {
diff --git a/sim/testsuite/frv/allinsn-d-h.exp b/sim/testsuite/frv/allinsn-d-h.exp
new file mode 100644
index 000000000000..18a969e50479
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-d-h.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[d-h\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/frv/allinsn-i-l.exp b/sim/testsuite/frv/allinsn-i-l.exp
new file mode 100644
index 000000000000..7f163457d80c
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-i-l.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[i-l\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/frv/allinsn-m.exp b/sim/testsuite/frv/allinsn-m.exp
new file mode 100644
index 000000000000..d9fbe232876d
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-m.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[m\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/frv/allinsn-n.exp b/sim/testsuite/frv/allinsn-n.exp
new file mode 100644
index 000000000000..7a67d0af7491
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-n.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[n\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/frv/allinsn-o-s.exp b/sim/testsuite/frv/allinsn-o-s.exp
new file mode 100644
index 000000000000..bad66a3efaec
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-o-s.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[o-s\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/frv/allinsn-t-z.exp b/sim/testsuite/frv/allinsn-t-z.exp
new file mode 100644
index 000000000000..0f3caeb65779
--- /dev/null
+++ b/sim/testsuite/frv/allinsn-t-z.exp
@@ -0,0 +1,19 @@
+# FRV simulator testsuite.
+
+sim_init
+
+if [istarget *] {
+    # all machines
+    set all_machs "frv fr500 fr550 fr400 fr405 fr450"
+    set cpu_option -mcpu
+
+    # The .cgs suffix is for "cgen .s".
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/\[t-z\]*.cgs]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-27  8:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27  8:23 [PATCH 1/5] sim: testsuite: setup per-port toolchain settings for multitarget build Mike Frysinger
2021-11-27  8:23 ` [PATCH 2/5] sim: testsuite: expand arch specific toolchain settings Mike Frysinger
2021-11-27  8:23 ` [PATCH 3/5] sim: testsuite: support parallel execution Mike Frysinger
2021-11-27  8:23 ` [PATCH 4/5] sim: testsuite: drop most specific istarget checks Mike Frysinger
2021-11-27  8:23 ` [PATCH 5/5] sim: frv: split up testsuite a bit Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).