public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: testsuite: push $arch out to targets
@ 2021-01-17 16:09 Mike Frysinger
  2021-01-18  9:52 ` Andrew Burgess
  2021-01-18 17:54 ` [PATCH 1/2] sim: switch top level to automake Mike Frysinger
  0 siblings, 2 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-17 16:09 UTC (permalink / raw)
  To: gdb-patches

This is needed to move to automake & its dejagnu-provided logic,
and eventually by the unified sim logic.
---
 sim/configure                           | 2 --
 sim/configure.tgt                       | 1 -
 sim/testsuite/Makefile.in               | 3 ---
 sim/testsuite/aarch64/allinsn.exp       | 4 ++++
 sim/testsuite/arm/allinsn.exp           | 5 +++--
 sim/testsuite/arm/iwmmxt/iwmmxt.exp     | 5 +++--
 sim/testsuite/arm/misc.exp              | 5 +++--
 sim/testsuite/arm/thumb/allthumb.exp    | 5 +++--
 sim/testsuite/arm/xscale/xscale.exp     | 5 +++--
 sim/testsuite/avr/allinsn.exp           | 4 ++++
 sim/testsuite/bfin/allinsn.exp          | 4 ++++
 sim/testsuite/bpf/allinsn.exp           | 4 ++++
 sim/testsuite/cr16/allinsn.exp          | 5 +++--
 sim/testsuite/cr16/misc.exp             | 5 +++--
 sim/testsuite/cris/asm/asm.exp          | 4 ++++
 sim/testsuite/cris/c/c.exp              | 4 ++++
 sim/testsuite/cris/hw/rv-n-cris/rvc.exp | 4 ++++
 sim/testsuite/d10v/allinsn.exp          | 6 ++++--
 sim/testsuite/frv/allinsn.exp           | 6 ++++--
 sim/testsuite/frv/fr400/allinsn.exp     | 6 ++++--
 sim/testsuite/frv/fr500/allinsn.exp     | 6 ++++--
 sim/testsuite/frv/fr550/allinsn.exp     | 6 ++++--
 sim/testsuite/frv/interrupts.exp        | 6 ++++--
 sim/testsuite/frv/misc.exp              | 6 ++++--
 sim/testsuite/frv/parallel.exp          | 6 ++++--
 sim/testsuite/ft32/allinsn.exp          | 4 ++++
 sim/testsuite/h8300/allinsn.exp         | 4 ++++
 sim/testsuite/iq2000/allinsn.exp        | 4 ++++
 sim/testsuite/lm32/allinsn.exp          | 4 ++++
 sim/testsuite/m32c/allinsn.exp          | 4 ++++
 sim/testsuite/m32r/allinsn.exp          | 5 +++--
 sim/testsuite/m32r/misc.exp             | 5 +++--
 sim/testsuite/m68hc11/allinsn.exp       | 4 ++++
 sim/testsuite/mcore/allinsn.exp         | 4 ++++
 sim/testsuite/microblaze/allinsn.exp    | 4 ++++
 sim/testsuite/mips/basic.exp            | 3 +++
 sim/testsuite/mn10300/allinsn.exp       | 4 ++++
 sim/testsuite/moxie/allinsn.exp         | 4 ++++
 sim/testsuite/msp430/allinsn.exp        | 4 ++++
 sim/testsuite/or1k/alltests.exp         | 3 +++
 sim/testsuite/pru/allinsn.exp           | 4 ++++
 sim/testsuite/sh/allinsn.exp            | 4 ++++
 sim/testsuite/v850/allinsns.exp         | 8 ++++----
 43 files changed, 149 insertions(+), 44 deletions(-)

diff --git a/sim/configure b/sim/configure
index 7093cb1f1cf6..92ea56e318a2 100755
--- a/sim/configure
+++ b/sim/configure
@@ -585,7 +585,6 @@ ac_unique_file="Makefile.in"
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-sim_arch
 subdirs
 CFLAGS_FOR_BUILD
 CC_FOR_BUILD
@@ -3904,7 +3903,6 @@ subdirs="$subdirs aarch64"
        ;;
 esac
 
-
   if test "$sim_igen" = yes; then
     subdirs="$subdirs igen"
 
diff --git a/sim/configure.tgt b/sim/configure.tgt
index a48c6966e8ae..800bc3de42f5 100644
--- a/sim/configure.tgt
+++ b/sim/configure.tgt
@@ -108,4 +108,3 @@ case "${target}" in
        sim_igen=yes
        ;;
 esac
-AC_SUBST(sim_arch)
diff --git a/sim/testsuite/Makefile.in b/sim/testsuite/Makefile.in
index 1e4604cea68c..8db77d2d46f2 100644
--- a/sim/testsuite/Makefile.in
+++ b/sim/testsuite/Makefile.in
@@ -29,8 +29,6 @@ target_canonical = @target@
 target_alias = @target_alias@
 program_transform_name = @program_transform_name@
 
-arch = @sim_arch@
-
 SHELL = /bin/sh
 SUBDIRS = @subdirs@
 RPATH_ENVVAR = @RPATH_ENVVAR@
@@ -129,7 +127,6 @@ site.exp: Makefile
 	@echo '# edit the last section' >> $@-t
 	@echo 'set srcdir $(srcdir)' >> $@-t
 	@echo 'set objdir' `pwd` >> $@-t
-	@echo 'set arch $(arch)' >> $@-t
 	@echo 'set build_alias $(build_alias)' >> $@-t
 	@echo 'set build_triplet $(build_canonical)' >> $@-t
 	@echo 'set host_alias $(host_alias)' >> $@-t
diff --git a/sim/testsuite/aarch64/allinsn.exp b/sim/testsuite/aarch64/allinsn.exp
index 54d64784c230..04a234f53577 100644
--- a/sim/testsuite/aarch64/allinsn.exp
+++ b/sim/testsuite/aarch64/allinsn.exp
@@ -1,6 +1,10 @@
 # AArch64 simulator testsuite
 
 if [istarget aarch64*-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "aarch64"
+
     # all machines
     set all_machs "aarch64"
 
diff --git a/sim/testsuite/arm/allinsn.exp b/sim/testsuite/arm/allinsn.exp
index 9752da615ac3..89ff96594793 100644
--- a/sim/testsuite/arm/allinsn.exp
+++ b/sim/testsuite/arm/allinsn.exp
@@ -1,8 +1,9 @@
 # ARM simulator testsuite.
 
 if { [istarget arm*-*-*] } {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "arm"
 
     # all machines
     set all_machs "xscale"
diff --git a/sim/testsuite/arm/iwmmxt/iwmmxt.exp b/sim/testsuite/arm/iwmmxt/iwmmxt.exp
index 4def69031a90..9710f3670ba7 100644
--- a/sim/testsuite/arm/iwmmxt/iwmmxt.exp
+++ b/sim/testsuite/arm/iwmmxt/iwmmxt.exp
@@ -1,8 +1,9 @@
 # Intel(r) Wireless MMX(tm) technology simulator testsuite.
 
 if { [istarget arm*-*-*] } {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "arm"
 
     # all machines
     set all_machs "xscale"
diff --git a/sim/testsuite/arm/misc.exp b/sim/testsuite/arm/misc.exp
index bc36ca87368b..ea6fd3c3c9a0 100644
--- a/sim/testsuite/arm/misc.exp
+++ b/sim/testsuite/arm/misc.exp
@@ -1,8 +1,9 @@
 # Miscellaneous ARM simulator testcases
 
 if { [istarget arm*-*-*] } {
-    # load support procs
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "arm"
 
     # all machines
     set all_machs "arm7tdmi"
diff --git a/sim/testsuite/arm/thumb/allthumb.exp b/sim/testsuite/arm/thumb/allthumb.exp
index 4298663fd813..eca5fa18c719 100644
--- a/sim/testsuite/arm/thumb/allthumb.exp
+++ b/sim/testsuite/arm/thumb/allthumb.exp
@@ -1,8 +1,9 @@
 # ARM simulator testsuite.
 
 if { [istarget arm*-*-*] } {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "arm"
 
     # all machines
     set all_machs "arm7tdmi"
diff --git a/sim/testsuite/arm/xscale/xscale.exp b/sim/testsuite/arm/xscale/xscale.exp
index 7c08f11d10d6..20c9df80351c 100644
--- a/sim/testsuite/arm/xscale/xscale.exp
+++ b/sim/testsuite/arm/xscale/xscale.exp
@@ -1,8 +1,9 @@
 # XSCALE simulator testsuite.
 
 if { [istarget arm*-*-*] } {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "arm"
 
     # all machines
     set all_machs "xscale"
diff --git a/sim/testsuite/avr/allinsn.exp b/sim/testsuite/avr/allinsn.exp
index 584a93da9305..a5c16b629b76 100644
--- a/sim/testsuite/avr/allinsn.exp
+++ b/sim/testsuite/avr/allinsn.exp
@@ -1,6 +1,10 @@
 # avr simulator testsuite
 
 if [istarget avr-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "avr"
+
     # all machines
     set all_machs "avr"
 
diff --git a/sim/testsuite/bfin/allinsn.exp b/sim/testsuite/bfin/allinsn.exp
index aa304eaa9b4a..3d3378171c6d 100644
--- a/sim/testsuite/bfin/allinsn.exp
+++ b/sim/testsuite/bfin/allinsn.exp
@@ -1,6 +1,10 @@
 # Analog Devices Blackfin simulator testsuite
 
 if [istarget bfin-*-elf] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "bfin"
+
     # all machines
     set all_machs "bfin"
 
diff --git a/sim/testsuite/bpf/allinsn.exp b/sim/testsuite/bpf/allinsn.exp
index 2cca77021afe..ffffd8a68928 100644
--- a/sim/testsuite/bpf/allinsn.exp
+++ b/sim/testsuite/bpf/allinsn.exp
@@ -1,6 +1,10 @@
 # eBPF simulator testsuite
 
 if [istarget bpf-unknown-none] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "bpf"
+
     # all machines
     set all_machs "bpf"
 
diff --git a/sim/testsuite/cr16/allinsn.exp b/sim/testsuite/cr16/allinsn.exp
index 852a673c3601..1b6847c78150 100644
--- a/sim/testsuite/cr16/allinsn.exp
+++ b/sim/testsuite/cr16/allinsn.exp
@@ -1,8 +1,9 @@
 # CR16 simulator testsuite.
 
 if [istarget cr16*-*-*] {
-    # load support procs
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "cr16"
 
     # all machines
     set all_machs "cr16"
diff --git a/sim/testsuite/cr16/misc.exp b/sim/testsuite/cr16/misc.exp
index 39dd3a4caa3c..67fa4c2d7d38 100644
--- a/sim/testsuite/cr16/misc.exp
+++ b/sim/testsuite/cr16/misc.exp
@@ -1,8 +1,9 @@
 # Miscellaneous CR16 simulator testcases
 
 if [istarget cr16*-*-*] {
-    # load support procs
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "cr16"
 
     # all machines
     set all_machs "cr16"
diff --git a/sim/testsuite/cris/asm/asm.exp b/sim/testsuite/cris/asm/asm.exp
index 415bbf1082a9..b8c14c8d05cb 100644
--- a/sim/testsuite/cris/asm/asm.exp
+++ b/sim/testsuite/cris/asm/asm.exp
@@ -16,6 +16,10 @@
 # Miscellaneous CRIS simulator testcases in assembly code.
 
 if [istarget cris*-*-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "cris"
+
     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 08ea18812ec5..3d493b7c1449 100644
--- a/sim/testsuite/cris/c/c.exp
+++ b/sim/testsuite/cris/c/c.exp
@@ -19,6 +19,10 @@ if ![istarget cris*-*-*] {
     return
 }
 
+# Used to locate the `run` program.
+global arch
+set arch "cris"
+
 set CFLAGS_FOR_TARGET "-O2"
 if [istarget cris-*-*] {
     set mach "crisv10"
diff --git a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
index 0f9ecec32a26..0a018fa4b881 100644
--- a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
+++ b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
@@ -112,6 +112,10 @@ proc slurp_rv { file } {
 # The main test loop.
 
 if [istarget cris*-*-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "cris"
+
     global ASFLAGS_FOR_TARGET
     set has_rv_and_cris [sim_has_rv_and_cris]
     global global_as_options
diff --git a/sim/testsuite/d10v/allinsn.exp b/sim/testsuite/d10v/allinsn.exp
index 123509a3b990..e2e44a290920 100644
--- a/sim/testsuite/d10v/allinsn.exp
+++ b/sim/testsuite/d10v/allinsn.exp
@@ -1,8 +1,10 @@
 # d10v simulator testsuite.
 
 if [istarget d10v*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "d10v"
+
     # all machines
     set all_machs "d10v"
 
diff --git a/sim/testsuite/frv/allinsn.exp b/sim/testsuite/frv/allinsn.exp
index b7f9fe2ad06c..2633f30df567 100644
--- a/sim/testsuite/frv/allinsn.exp
+++ b/sim/testsuite/frv/allinsn.exp
@@ -1,8 +1,10 @@
 # FRV simulator testsuite.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # all machines
     set all_machs "frv fr500 fr550 fr400 fr405 fr450"
     set cpu_option -mcpu
diff --git a/sim/testsuite/frv/fr400/allinsn.exp b/sim/testsuite/frv/fr400/allinsn.exp
index b1697610403c..ea5846f8fa42 100644
--- a/sim/testsuite/frv/fr400/allinsn.exp
+++ b/sim/testsuite/frv/fr400/allinsn.exp
@@ -1,8 +1,10 @@
 # FRV simulator testsuite.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # 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 7d192593efb5..40caa6307060 100644
--- a/sim/testsuite/frv/fr500/allinsn.exp
+++ b/sim/testsuite/frv/fr500/allinsn.exp
@@ -1,8 +1,10 @@
 # FRV simulator testsuite.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # 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 1fe17952de1a..8768a6719946 100644
--- a/sim/testsuite/frv/fr550/allinsn.exp
+++ b/sim/testsuite/frv/fr550/allinsn.exp
@@ -1,8 +1,10 @@
 # FRV simulator testsuite.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # 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 e31533e10533..d1f7628d962d 100644
--- a/sim/testsuite/frv/interrupts.exp
+++ b/sim/testsuite/frv/interrupts.exp
@@ -1,8 +1,10 @@
 # FRV simulator testsuite.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # 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 4245a81cb60a..d9c80a546000 100644
--- a/sim/testsuite/frv/misc.exp
+++ b/sim/testsuite/frv/misc.exp
@@ -1,8 +1,10 @@
 # Miscellaneous FRV simulator testcases.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # 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 8101a67afb59..a883b9891d5d 100644
--- a/sim/testsuite/frv/parallel.exp
+++ b/sim/testsuite/frv/parallel.exp
@@ -1,8 +1,10 @@
 # FRV simulator testsuite.
 
 if [istarget frv*-*] {
-    # load support procs (none yet)
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "frv"
+
     # 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 730b4223632d..50827a592473 100644
--- a/sim/testsuite/ft32/allinsn.exp
+++ b/sim/testsuite/ft32/allinsn.exp
@@ -1,6 +1,10 @@
 # ft32 simulator testsuite
 
 if [istarget ft32-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "ft32"
+
     # all machines
     set all_machs "ft32"
 
diff --git a/sim/testsuite/h8300/allinsn.exp b/sim/testsuite/h8300/allinsn.exp
index 68468f6bb106..5355bf58a69d 100644
--- a/sim/testsuite/h8300/allinsn.exp
+++ b/sim/testsuite/h8300/allinsn.exp
@@ -1,6 +1,10 @@
 # Hitachi H8/300 (h, s, sx) simulator testsuite
 
 if {[istarget h8300*-*-*] || [istarget h8sx*-*-*]} then {
+    # Used to locate the `run` program.
+    global arch
+    set arch "h8300"
+
     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 38eee9b277f1..96d58435fb45 100644
--- a/sim/testsuite/iq2000/allinsn.exp
+++ b/sim/testsuite/iq2000/allinsn.exp
@@ -1,6 +1,10 @@
 # iq2000 simulator testsuite
 
 if [istarget iq2000-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "iq2000"
+
     # all machines
     set all_machs "iq2000"
 
diff --git a/sim/testsuite/lm32/allinsn.exp b/sim/testsuite/lm32/allinsn.exp
index 61744985f6c8..ae7c141bd643 100644
--- a/sim/testsuite/lm32/allinsn.exp
+++ b/sim/testsuite/lm32/allinsn.exp
@@ -1,6 +1,10 @@
 # lm32 simulator testsuite
 
 if [istarget lm32-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "lm32"
+
     # all machines
     set all_machs "lm32"
 
diff --git a/sim/testsuite/m32c/allinsn.exp b/sim/testsuite/m32c/allinsn.exp
index fb5ccca282e1..b09b505972a3 100644
--- a/sim/testsuite/m32c/allinsn.exp
+++ b/sim/testsuite/m32c/allinsn.exp
@@ -2,6 +2,10 @@
 # TODO: Add support for .c tests.
 
 if [istarget m32c*-*-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "m32c"
+
     # all machines
     set all_machs "m32c"
 
diff --git a/sim/testsuite/m32r/allinsn.exp b/sim/testsuite/m32r/allinsn.exp
index 8eed80f91d67..a800e78b1b46 100644
--- a/sim/testsuite/m32r/allinsn.exp
+++ b/sim/testsuite/m32r/allinsn.exp
@@ -1,8 +1,9 @@
 # M32R simulator testsuite.
 
 if [istarget m32r*-*-*] {
-    # load support procs
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "m32r"
 
     # all machines
     set all_machs "m32r"
diff --git a/sim/testsuite/m32r/misc.exp b/sim/testsuite/m32r/misc.exp
index 6ed5638ab29b..e571c2eeb69d 100644
--- a/sim/testsuite/m32r/misc.exp
+++ b/sim/testsuite/m32r/misc.exp
@@ -1,8 +1,9 @@
 # Miscellaneous M32R simulator testcases
 
 if [istarget m32r*-*-*] {
-    # load support procs
-    # load_lib cgen.exp
+    # Used to locate the `run` program.
+    global arch
+    set arch "m32r"
 
     # all machines
     set all_machs "m32r"
diff --git a/sim/testsuite/m68hc11/allinsn.exp b/sim/testsuite/m68hc11/allinsn.exp
index db0cbd5d4670..0e9b51ec5934 100644
--- a/sim/testsuite/m68hc11/allinsn.exp
+++ b/sim/testsuite/m68hc11/allinsn.exp
@@ -1,6 +1,10 @@
 # m68hc11 simulator testsuite
 
 if [istarget m68hc11-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "m68hc11"
+
     # all machines
     set all_machs "m68hc11"
 
diff --git a/sim/testsuite/mcore/allinsn.exp b/sim/testsuite/mcore/allinsn.exp
index 5921cfc26431..ecc934b20146 100644
--- a/sim/testsuite/mcore/allinsn.exp
+++ b/sim/testsuite/mcore/allinsn.exp
@@ -1,6 +1,10 @@
 # mcore simulator testsuite
 
 if [istarget mcore-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "mcore"
+
     # all machines
     set all_machs "mcore"
 
diff --git a/sim/testsuite/microblaze/allinsn.exp b/sim/testsuite/microblaze/allinsn.exp
index f756914292c4..5f5a4475eed4 100644
--- a/sim/testsuite/microblaze/allinsn.exp
+++ b/sim/testsuite/microblaze/allinsn.exp
@@ -1,6 +1,10 @@
 # microblaze simulator testsuite
 
 if [istarget microblaze-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "microblaze"
+
     # all machines
     set all_machs "microblaze"
 
diff --git a/sim/testsuite/mips/basic.exp b/sim/testsuite/mips/basic.exp
index f810741dbb74..2eff923c0fc7 100644
--- a/sim/testsuite/mips/basic.exp
+++ b/sim/testsuite/mips/basic.exp
@@ -42,6 +42,9 @@ proc run_sim_tests { name requested_machs { requested_micromips_machs "" } } {
 
 # Only test mips*-*-elf (e.g., no mips*-*-linux)
 if {[istarget mips*-*-elf]} {
+    # Used to locate the `run` program.
+    global arch
+    set arch "mips"
 
     set dspmodels ""
     set mdmxmodels ""
diff --git a/sim/testsuite/mn10300/allinsn.exp b/sim/testsuite/mn10300/allinsn.exp
index f8431e7222ea..7166aefddf30 100644
--- a/sim/testsuite/mn10300/allinsn.exp
+++ b/sim/testsuite/mn10300/allinsn.exp
@@ -1,6 +1,10 @@
 # mn10300 simulator testsuite
 
 if [istarget mn10300-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "mn10300"
+
     # all machines
     set all_machs "mn10300"
 
diff --git a/sim/testsuite/moxie/allinsn.exp b/sim/testsuite/moxie/allinsn.exp
index 1a6af8b37d45..241e67576253 100644
--- a/sim/testsuite/moxie/allinsn.exp
+++ b/sim/testsuite/moxie/allinsn.exp
@@ -1,6 +1,10 @@
 # moxie simulator testsuite
 
 if [istarget moxie-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "moxie"
+
     # all machines
     set all_machs "moxie"
 
diff --git a/sim/testsuite/msp430/allinsn.exp b/sim/testsuite/msp430/allinsn.exp
index affa8aedc2ad..83030290cce2 100644
--- a/sim/testsuite/msp430/allinsn.exp
+++ b/sim/testsuite/msp430/allinsn.exp
@@ -1,6 +1,10 @@
 # msp430 simulator testsuite
 
 if [istarget msp430-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "msp430"
+
     # all machines
     set all_machs "msp430"
 
diff --git a/sim/testsuite/or1k/alltests.exp b/sim/testsuite/or1k/alltests.exp
index dd08fbcf99b4..98c1345d0be5 100644
--- a/sim/testsuite/or1k/alltests.exp
+++ b/sim/testsuite/or1k/alltests.exp
@@ -16,6 +16,9 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if [istarget or1k*-*-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "or1k"
 
     set all_machs "or1k"
 
diff --git a/sim/testsuite/pru/allinsn.exp b/sim/testsuite/pru/allinsn.exp
index d147f731c913..c0d5ce936894 100644
--- a/sim/testsuite/pru/allinsn.exp
+++ b/sim/testsuite/pru/allinsn.exp
@@ -19,6 +19,10 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if [istarget pru-*] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "pru"
+
     # all machines
     set all_machs "pru"
 
diff --git a/sim/testsuite/sh/allinsn.exp b/sim/testsuite/sh/allinsn.exp
index 40d139299426..235a40c692ab 100644
--- a/sim/testsuite/sh/allinsn.exp
+++ b/sim/testsuite/sh/allinsn.exp
@@ -13,6 +13,10 @@ foreach opt $board_variant_list {
 }
 
 if [istarget sh-*elf] {
+    # Used to locate the `run` program.
+    global arch
+    set arch "sh"
+
     run_sim_test add.s    $all
     run_sim_test and.s    $all
     run_sim_test bandor.s sh
diff --git a/sim/testsuite/v850/allinsns.exp b/sim/testsuite/v850/allinsns.exp
index f60c3d66aa46..4c3bc088ff6b 100644
--- a/sim/testsuite/v850/allinsns.exp
+++ b/sim/testsuite/v850/allinsns.exp
@@ -3,10 +3,11 @@
 if [istarget v850*-*] {
     global opt
 
-    # load support procs (none yet)
-    # load_lib cgen.exp
-    # all machines
+    # Used to locate the `run` program.
+    global arch
+    set arch "v850"
 
+    # all machines
     switch -regexp -- $opt {
 	.*v850e.* {
 	    set all_machs "v850e"
@@ -36,4 +37,3 @@ if [istarget v850*-*] {
 #    }
 #    puts [format "%-30s %s" $var "[set ::$var]"]
 #}
-	
\ No newline at end of file
-- 
2.28.0


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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-17 16:09 [PATCH] sim: testsuite: push $arch out to targets Mike Frysinger
@ 2021-01-18  9:52 ` Andrew Burgess
  2021-01-18 18:01   ` Mike Frysinger
  2021-01-18 17:54 ` [PATCH 1/2] sim: switch top level to automake Mike Frysinger
  1 sibling, 1 reply; 19+ messages in thread
From: Andrew Burgess @ 2021-01-18  9:52 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

* Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> [2021-01-17 11:09:45 -0500]:

> This is needed to move to automake & its dejagnu-provided logic,
> and eventually by the unified sim logic.

I looked through this patch and I didn't understand what's going on
here.

Why do you need to set the global arch in some, but not all tests?  If
this needs doing at all, could it not be done in some global location?

Thanks,
Andrew



> ---
>  sim/configure                           | 2 --
>  sim/configure.tgt                       | 1 -
>  sim/testsuite/Makefile.in               | 3 ---
>  sim/testsuite/aarch64/allinsn.exp       | 4 ++++
>  sim/testsuite/arm/allinsn.exp           | 5 +++--
>  sim/testsuite/arm/iwmmxt/iwmmxt.exp     | 5 +++--
>  sim/testsuite/arm/misc.exp              | 5 +++--
>  sim/testsuite/arm/thumb/allthumb.exp    | 5 +++--
>  sim/testsuite/arm/xscale/xscale.exp     | 5 +++--
>  sim/testsuite/avr/allinsn.exp           | 4 ++++
>  sim/testsuite/bfin/allinsn.exp          | 4 ++++
>  sim/testsuite/bpf/allinsn.exp           | 4 ++++
>  sim/testsuite/cr16/allinsn.exp          | 5 +++--
>  sim/testsuite/cr16/misc.exp             | 5 +++--
>  sim/testsuite/cris/asm/asm.exp          | 4 ++++
>  sim/testsuite/cris/c/c.exp              | 4 ++++
>  sim/testsuite/cris/hw/rv-n-cris/rvc.exp | 4 ++++
>  sim/testsuite/d10v/allinsn.exp          | 6 ++++--
>  sim/testsuite/frv/allinsn.exp           | 6 ++++--
>  sim/testsuite/frv/fr400/allinsn.exp     | 6 ++++--
>  sim/testsuite/frv/fr500/allinsn.exp     | 6 ++++--
>  sim/testsuite/frv/fr550/allinsn.exp     | 6 ++++--
>  sim/testsuite/frv/interrupts.exp        | 6 ++++--
>  sim/testsuite/frv/misc.exp              | 6 ++++--
>  sim/testsuite/frv/parallel.exp          | 6 ++++--
>  sim/testsuite/ft32/allinsn.exp          | 4 ++++
>  sim/testsuite/h8300/allinsn.exp         | 4 ++++
>  sim/testsuite/iq2000/allinsn.exp        | 4 ++++
>  sim/testsuite/lm32/allinsn.exp          | 4 ++++
>  sim/testsuite/m32c/allinsn.exp          | 4 ++++
>  sim/testsuite/m32r/allinsn.exp          | 5 +++--
>  sim/testsuite/m32r/misc.exp             | 5 +++--
>  sim/testsuite/m68hc11/allinsn.exp       | 4 ++++
>  sim/testsuite/mcore/allinsn.exp         | 4 ++++
>  sim/testsuite/microblaze/allinsn.exp    | 4 ++++
>  sim/testsuite/mips/basic.exp            | 3 +++
>  sim/testsuite/mn10300/allinsn.exp       | 4 ++++
>  sim/testsuite/moxie/allinsn.exp         | 4 ++++
>  sim/testsuite/msp430/allinsn.exp        | 4 ++++
>  sim/testsuite/or1k/alltests.exp         | 3 +++
>  sim/testsuite/pru/allinsn.exp           | 4 ++++
>  sim/testsuite/sh/allinsn.exp            | 4 ++++
>  sim/testsuite/v850/allinsns.exp         | 8 ++++----
>  43 files changed, 149 insertions(+), 44 deletions(-)
> 
> diff --git a/sim/configure b/sim/configure
> index 7093cb1f1cf6..92ea56e318a2 100755
> --- a/sim/configure
> +++ b/sim/configure
> @@ -585,7 +585,6 @@ ac_unique_file="Makefile.in"
>  enable_option_checking=no
>  ac_subst_vars='LTLIBOBJS
>  LIBOBJS
> -sim_arch
>  subdirs
>  CFLAGS_FOR_BUILD
>  CC_FOR_BUILD
> @@ -3904,7 +3903,6 @@ subdirs="$subdirs aarch64"
>         ;;
>  esac
>  
> -
>    if test "$sim_igen" = yes; then
>      subdirs="$subdirs igen"
>  
> diff --git a/sim/configure.tgt b/sim/configure.tgt
> index a48c6966e8ae..800bc3de42f5 100644
> --- a/sim/configure.tgt
> +++ b/sim/configure.tgt
> @@ -108,4 +108,3 @@ case "${target}" in
>         sim_igen=yes
>         ;;
>  esac
> -AC_SUBST(sim_arch)
> diff --git a/sim/testsuite/Makefile.in b/sim/testsuite/Makefile.in
> index 1e4604cea68c..8db77d2d46f2 100644
> --- a/sim/testsuite/Makefile.in
> +++ b/sim/testsuite/Makefile.in
> @@ -29,8 +29,6 @@ target_canonical = @target@
>  target_alias = @target_alias@
>  program_transform_name = @program_transform_name@
>  
> -arch = @sim_arch@
> -
>  SHELL = /bin/sh
>  SUBDIRS = @subdirs@
>  RPATH_ENVVAR = @RPATH_ENVVAR@
> @@ -129,7 +127,6 @@ site.exp: Makefile
>  	@echo '# edit the last section' >> $@-t
>  	@echo 'set srcdir $(srcdir)' >> $@-t
>  	@echo 'set objdir' `pwd` >> $@-t
> -	@echo 'set arch $(arch)' >> $@-t
>  	@echo 'set build_alias $(build_alias)' >> $@-t
>  	@echo 'set build_triplet $(build_canonical)' >> $@-t
>  	@echo 'set host_alias $(host_alias)' >> $@-t
> diff --git a/sim/testsuite/aarch64/allinsn.exp b/sim/testsuite/aarch64/allinsn.exp
> index 54d64784c230..04a234f53577 100644
> --- a/sim/testsuite/aarch64/allinsn.exp
> +++ b/sim/testsuite/aarch64/allinsn.exp
> @@ -1,6 +1,10 @@
>  # AArch64 simulator testsuite
>  
>  if [istarget aarch64*-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "aarch64"
> +
>      # all machines
>      set all_machs "aarch64"
>  
> diff --git a/sim/testsuite/arm/allinsn.exp b/sim/testsuite/arm/allinsn.exp
> index 9752da615ac3..89ff96594793 100644
> --- a/sim/testsuite/arm/allinsn.exp
> +++ b/sim/testsuite/arm/allinsn.exp
> @@ -1,8 +1,9 @@
>  # ARM simulator testsuite.
>  
>  if { [istarget arm*-*-*] } {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "arm"
>  
>      # all machines
>      set all_machs "xscale"
> diff --git a/sim/testsuite/arm/iwmmxt/iwmmxt.exp b/sim/testsuite/arm/iwmmxt/iwmmxt.exp
> index 4def69031a90..9710f3670ba7 100644
> --- a/sim/testsuite/arm/iwmmxt/iwmmxt.exp
> +++ b/sim/testsuite/arm/iwmmxt/iwmmxt.exp
> @@ -1,8 +1,9 @@
>  # Intel(r) Wireless MMX(tm) technology simulator testsuite.
>  
>  if { [istarget arm*-*-*] } {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "arm"
>  
>      # all machines
>      set all_machs "xscale"
> diff --git a/sim/testsuite/arm/misc.exp b/sim/testsuite/arm/misc.exp
> index bc36ca87368b..ea6fd3c3c9a0 100644
> --- a/sim/testsuite/arm/misc.exp
> +++ b/sim/testsuite/arm/misc.exp
> @@ -1,8 +1,9 @@
>  # Miscellaneous ARM simulator testcases
>  
>  if { [istarget arm*-*-*] } {
> -    # load support procs
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "arm"
>  
>      # all machines
>      set all_machs "arm7tdmi"
> diff --git a/sim/testsuite/arm/thumb/allthumb.exp b/sim/testsuite/arm/thumb/allthumb.exp
> index 4298663fd813..eca5fa18c719 100644
> --- a/sim/testsuite/arm/thumb/allthumb.exp
> +++ b/sim/testsuite/arm/thumb/allthumb.exp
> @@ -1,8 +1,9 @@
>  # ARM simulator testsuite.
>  
>  if { [istarget arm*-*-*] } {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "arm"
>  
>      # all machines
>      set all_machs "arm7tdmi"
> diff --git a/sim/testsuite/arm/xscale/xscale.exp b/sim/testsuite/arm/xscale/xscale.exp
> index 7c08f11d10d6..20c9df80351c 100644
> --- a/sim/testsuite/arm/xscale/xscale.exp
> +++ b/sim/testsuite/arm/xscale/xscale.exp
> @@ -1,8 +1,9 @@
>  # XSCALE simulator testsuite.
>  
>  if { [istarget arm*-*-*] } {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "arm"
>  
>      # all machines
>      set all_machs "xscale"
> diff --git a/sim/testsuite/avr/allinsn.exp b/sim/testsuite/avr/allinsn.exp
> index 584a93da9305..a5c16b629b76 100644
> --- a/sim/testsuite/avr/allinsn.exp
> +++ b/sim/testsuite/avr/allinsn.exp
> @@ -1,6 +1,10 @@
>  # avr simulator testsuite
>  
>  if [istarget avr-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "avr"
> +
>      # all machines
>      set all_machs "avr"
>  
> diff --git a/sim/testsuite/bfin/allinsn.exp b/sim/testsuite/bfin/allinsn.exp
> index aa304eaa9b4a..3d3378171c6d 100644
> --- a/sim/testsuite/bfin/allinsn.exp
> +++ b/sim/testsuite/bfin/allinsn.exp
> @@ -1,6 +1,10 @@
>  # Analog Devices Blackfin simulator testsuite
>  
>  if [istarget bfin-*-elf] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "bfin"
> +
>      # all machines
>      set all_machs "bfin"
>  
> diff --git a/sim/testsuite/bpf/allinsn.exp b/sim/testsuite/bpf/allinsn.exp
> index 2cca77021afe..ffffd8a68928 100644
> --- a/sim/testsuite/bpf/allinsn.exp
> +++ b/sim/testsuite/bpf/allinsn.exp
> @@ -1,6 +1,10 @@
>  # eBPF simulator testsuite
>  
>  if [istarget bpf-unknown-none] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "bpf"
> +
>      # all machines
>      set all_machs "bpf"
>  
> diff --git a/sim/testsuite/cr16/allinsn.exp b/sim/testsuite/cr16/allinsn.exp
> index 852a673c3601..1b6847c78150 100644
> --- a/sim/testsuite/cr16/allinsn.exp
> +++ b/sim/testsuite/cr16/allinsn.exp
> @@ -1,8 +1,9 @@
>  # CR16 simulator testsuite.
>  
>  if [istarget cr16*-*-*] {
> -    # load support procs
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "cr16"
>  
>      # all machines
>      set all_machs "cr16"
> diff --git a/sim/testsuite/cr16/misc.exp b/sim/testsuite/cr16/misc.exp
> index 39dd3a4caa3c..67fa4c2d7d38 100644
> --- a/sim/testsuite/cr16/misc.exp
> +++ b/sim/testsuite/cr16/misc.exp
> @@ -1,8 +1,9 @@
>  # Miscellaneous CR16 simulator testcases
>  
>  if [istarget cr16*-*-*] {
> -    # load support procs
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "cr16"
>  
>      # all machines
>      set all_machs "cr16"
> diff --git a/sim/testsuite/cris/asm/asm.exp b/sim/testsuite/cris/asm/asm.exp
> index 415bbf1082a9..b8c14c8d05cb 100644
> --- a/sim/testsuite/cris/asm/asm.exp
> +++ b/sim/testsuite/cris/asm/asm.exp
> @@ -16,6 +16,10 @@
>  # Miscellaneous CRIS simulator testcases in assembly code.
>  
>  if [istarget cris*-*-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "cris"
> +
>      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 08ea18812ec5..3d493b7c1449 100644
> --- a/sim/testsuite/cris/c/c.exp
> +++ b/sim/testsuite/cris/c/c.exp
> @@ -19,6 +19,10 @@ if ![istarget cris*-*-*] {
>      return
>  }
>  
> +# Used to locate the `run` program.
> +global arch
> +set arch "cris"
> +
>  set CFLAGS_FOR_TARGET "-O2"
>  if [istarget cris-*-*] {
>      set mach "crisv10"
> diff --git a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
> index 0f9ecec32a26..0a018fa4b881 100644
> --- a/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
> +++ b/sim/testsuite/cris/hw/rv-n-cris/rvc.exp
> @@ -112,6 +112,10 @@ proc slurp_rv { file } {
>  # The main test loop.
>  
>  if [istarget cris*-*-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "cris"
> +
>      global ASFLAGS_FOR_TARGET
>      set has_rv_and_cris [sim_has_rv_and_cris]
>      global global_as_options
> diff --git a/sim/testsuite/d10v/allinsn.exp b/sim/testsuite/d10v/allinsn.exp
> index 123509a3b990..e2e44a290920 100644
> --- a/sim/testsuite/d10v/allinsn.exp
> +++ b/sim/testsuite/d10v/allinsn.exp
> @@ -1,8 +1,10 @@
>  # d10v simulator testsuite.
>  
>  if [istarget d10v*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "d10v"
> +
>      # all machines
>      set all_machs "d10v"
>  
> diff --git a/sim/testsuite/frv/allinsn.exp b/sim/testsuite/frv/allinsn.exp
> index b7f9fe2ad06c..2633f30df567 100644
> --- a/sim/testsuite/frv/allinsn.exp
> +++ b/sim/testsuite/frv/allinsn.exp
> @@ -1,8 +1,10 @@
>  # FRV simulator testsuite.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # all machines
>      set all_machs "frv fr500 fr550 fr400 fr405 fr450"
>      set cpu_option -mcpu
> diff --git a/sim/testsuite/frv/fr400/allinsn.exp b/sim/testsuite/frv/fr400/allinsn.exp
> index b1697610403c..ea5846f8fa42 100644
> --- a/sim/testsuite/frv/fr400/allinsn.exp
> +++ b/sim/testsuite/frv/fr400/allinsn.exp
> @@ -1,8 +1,10 @@
>  # FRV simulator testsuite.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # 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 7d192593efb5..40caa6307060 100644
> --- a/sim/testsuite/frv/fr500/allinsn.exp
> +++ b/sim/testsuite/frv/fr500/allinsn.exp
> @@ -1,8 +1,10 @@
>  # FRV simulator testsuite.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # 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 1fe17952de1a..8768a6719946 100644
> --- a/sim/testsuite/frv/fr550/allinsn.exp
> +++ b/sim/testsuite/frv/fr550/allinsn.exp
> @@ -1,8 +1,10 @@
>  # FRV simulator testsuite.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # 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 e31533e10533..d1f7628d962d 100644
> --- a/sim/testsuite/frv/interrupts.exp
> +++ b/sim/testsuite/frv/interrupts.exp
> @@ -1,8 +1,10 @@
>  # FRV simulator testsuite.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # 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 4245a81cb60a..d9c80a546000 100644
> --- a/sim/testsuite/frv/misc.exp
> +++ b/sim/testsuite/frv/misc.exp
> @@ -1,8 +1,10 @@
>  # Miscellaneous FRV simulator testcases.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # 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 8101a67afb59..a883b9891d5d 100644
> --- a/sim/testsuite/frv/parallel.exp
> +++ b/sim/testsuite/frv/parallel.exp
> @@ -1,8 +1,10 @@
>  # FRV simulator testsuite.
>  
>  if [istarget frv*-*] {
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "frv"
> +
>      # 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 730b4223632d..50827a592473 100644
> --- a/sim/testsuite/ft32/allinsn.exp
> +++ b/sim/testsuite/ft32/allinsn.exp
> @@ -1,6 +1,10 @@
>  # ft32 simulator testsuite
>  
>  if [istarget ft32-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "ft32"
> +
>      # all machines
>      set all_machs "ft32"
>  
> diff --git a/sim/testsuite/h8300/allinsn.exp b/sim/testsuite/h8300/allinsn.exp
> index 68468f6bb106..5355bf58a69d 100644
> --- a/sim/testsuite/h8300/allinsn.exp
> +++ b/sim/testsuite/h8300/allinsn.exp
> @@ -1,6 +1,10 @@
>  # Hitachi H8/300 (h, s, sx) simulator testsuite
>  
>  if {[istarget h8300*-*-*] || [istarget h8sx*-*-*]} then {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "h8300"
> +
>      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 38eee9b277f1..96d58435fb45 100644
> --- a/sim/testsuite/iq2000/allinsn.exp
> +++ b/sim/testsuite/iq2000/allinsn.exp
> @@ -1,6 +1,10 @@
>  # iq2000 simulator testsuite
>  
>  if [istarget iq2000-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "iq2000"
> +
>      # all machines
>      set all_machs "iq2000"
>  
> diff --git a/sim/testsuite/lm32/allinsn.exp b/sim/testsuite/lm32/allinsn.exp
> index 61744985f6c8..ae7c141bd643 100644
> --- a/sim/testsuite/lm32/allinsn.exp
> +++ b/sim/testsuite/lm32/allinsn.exp
> @@ -1,6 +1,10 @@
>  # lm32 simulator testsuite
>  
>  if [istarget lm32-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "lm32"
> +
>      # all machines
>      set all_machs "lm32"
>  
> diff --git a/sim/testsuite/m32c/allinsn.exp b/sim/testsuite/m32c/allinsn.exp
> index fb5ccca282e1..b09b505972a3 100644
> --- a/sim/testsuite/m32c/allinsn.exp
> +++ b/sim/testsuite/m32c/allinsn.exp
> @@ -2,6 +2,10 @@
>  # TODO: Add support for .c tests.
>  
>  if [istarget m32c*-*-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "m32c"
> +
>      # all machines
>      set all_machs "m32c"
>  
> diff --git a/sim/testsuite/m32r/allinsn.exp b/sim/testsuite/m32r/allinsn.exp
> index 8eed80f91d67..a800e78b1b46 100644
> --- a/sim/testsuite/m32r/allinsn.exp
> +++ b/sim/testsuite/m32r/allinsn.exp
> @@ -1,8 +1,9 @@
>  # M32R simulator testsuite.
>  
>  if [istarget m32r*-*-*] {
> -    # load support procs
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "m32r"
>  
>      # all machines
>      set all_machs "m32r"
> diff --git a/sim/testsuite/m32r/misc.exp b/sim/testsuite/m32r/misc.exp
> index 6ed5638ab29b..e571c2eeb69d 100644
> --- a/sim/testsuite/m32r/misc.exp
> +++ b/sim/testsuite/m32r/misc.exp
> @@ -1,8 +1,9 @@
>  # Miscellaneous M32R simulator testcases
>  
>  if [istarget m32r*-*-*] {
> -    # load support procs
> -    # load_lib cgen.exp
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "m32r"
>  
>      # all machines
>      set all_machs "m32r"
> diff --git a/sim/testsuite/m68hc11/allinsn.exp b/sim/testsuite/m68hc11/allinsn.exp
> index db0cbd5d4670..0e9b51ec5934 100644
> --- a/sim/testsuite/m68hc11/allinsn.exp
> +++ b/sim/testsuite/m68hc11/allinsn.exp
> @@ -1,6 +1,10 @@
>  # m68hc11 simulator testsuite
>  
>  if [istarget m68hc11-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "m68hc11"
> +
>      # all machines
>      set all_machs "m68hc11"
>  
> diff --git a/sim/testsuite/mcore/allinsn.exp b/sim/testsuite/mcore/allinsn.exp
> index 5921cfc26431..ecc934b20146 100644
> --- a/sim/testsuite/mcore/allinsn.exp
> +++ b/sim/testsuite/mcore/allinsn.exp
> @@ -1,6 +1,10 @@
>  # mcore simulator testsuite
>  
>  if [istarget mcore-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "mcore"
> +
>      # all machines
>      set all_machs "mcore"
>  
> diff --git a/sim/testsuite/microblaze/allinsn.exp b/sim/testsuite/microblaze/allinsn.exp
> index f756914292c4..5f5a4475eed4 100644
> --- a/sim/testsuite/microblaze/allinsn.exp
> +++ b/sim/testsuite/microblaze/allinsn.exp
> @@ -1,6 +1,10 @@
>  # microblaze simulator testsuite
>  
>  if [istarget microblaze-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "microblaze"
> +
>      # all machines
>      set all_machs "microblaze"
>  
> diff --git a/sim/testsuite/mips/basic.exp b/sim/testsuite/mips/basic.exp
> index f810741dbb74..2eff923c0fc7 100644
> --- a/sim/testsuite/mips/basic.exp
> +++ b/sim/testsuite/mips/basic.exp
> @@ -42,6 +42,9 @@ proc run_sim_tests { name requested_machs { requested_micromips_machs "" } } {
>  
>  # Only test mips*-*-elf (e.g., no mips*-*-linux)
>  if {[istarget mips*-*-elf]} {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "mips"
>  
>      set dspmodels ""
>      set mdmxmodels ""
> diff --git a/sim/testsuite/mn10300/allinsn.exp b/sim/testsuite/mn10300/allinsn.exp
> index f8431e7222ea..7166aefddf30 100644
> --- a/sim/testsuite/mn10300/allinsn.exp
> +++ b/sim/testsuite/mn10300/allinsn.exp
> @@ -1,6 +1,10 @@
>  # mn10300 simulator testsuite
>  
>  if [istarget mn10300-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "mn10300"
> +
>      # all machines
>      set all_machs "mn10300"
>  
> diff --git a/sim/testsuite/moxie/allinsn.exp b/sim/testsuite/moxie/allinsn.exp
> index 1a6af8b37d45..241e67576253 100644
> --- a/sim/testsuite/moxie/allinsn.exp
> +++ b/sim/testsuite/moxie/allinsn.exp
> @@ -1,6 +1,10 @@
>  # moxie simulator testsuite
>  
>  if [istarget moxie-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "moxie"
> +
>      # all machines
>      set all_machs "moxie"
>  
> diff --git a/sim/testsuite/msp430/allinsn.exp b/sim/testsuite/msp430/allinsn.exp
> index affa8aedc2ad..83030290cce2 100644
> --- a/sim/testsuite/msp430/allinsn.exp
> +++ b/sim/testsuite/msp430/allinsn.exp
> @@ -1,6 +1,10 @@
>  # msp430 simulator testsuite
>  
>  if [istarget msp430-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "msp430"
> +
>      # all machines
>      set all_machs "msp430"
>  
> diff --git a/sim/testsuite/or1k/alltests.exp b/sim/testsuite/or1k/alltests.exp
> index dd08fbcf99b4..98c1345d0be5 100644
> --- a/sim/testsuite/or1k/alltests.exp
> +++ b/sim/testsuite/or1k/alltests.exp
> @@ -16,6 +16,9 @@
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  
>  if [istarget or1k*-*-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "or1k"
>  
>      set all_machs "or1k"
>  
> diff --git a/sim/testsuite/pru/allinsn.exp b/sim/testsuite/pru/allinsn.exp
> index d147f731c913..c0d5ce936894 100644
> --- a/sim/testsuite/pru/allinsn.exp
> +++ b/sim/testsuite/pru/allinsn.exp
> @@ -19,6 +19,10 @@
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  
>  if [istarget pru-*] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "pru"
> +
>      # all machines
>      set all_machs "pru"
>  
> diff --git a/sim/testsuite/sh/allinsn.exp b/sim/testsuite/sh/allinsn.exp
> index 40d139299426..235a40c692ab 100644
> --- a/sim/testsuite/sh/allinsn.exp
> +++ b/sim/testsuite/sh/allinsn.exp
> @@ -13,6 +13,10 @@ foreach opt $board_variant_list {
>  }
>  
>  if [istarget sh-*elf] {
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "sh"
> +
>      run_sim_test add.s    $all
>      run_sim_test and.s    $all
>      run_sim_test bandor.s sh
> diff --git a/sim/testsuite/v850/allinsns.exp b/sim/testsuite/v850/allinsns.exp
> index f60c3d66aa46..4c3bc088ff6b 100644
> --- a/sim/testsuite/v850/allinsns.exp
> +++ b/sim/testsuite/v850/allinsns.exp
> @@ -3,10 +3,11 @@
>  if [istarget v850*-*] {
>      global opt
>  
> -    # load support procs (none yet)
> -    # load_lib cgen.exp
> -    # all machines
> +    # Used to locate the `run` program.
> +    global arch
> +    set arch "v850"
>  
> +    # all machines
>      switch -regexp -- $opt {
>  	.*v850e.* {
>  	    set all_machs "v850e"
> @@ -36,4 +37,3 @@ if [istarget v850*-*] {
>  #    }
>  #    puts [format "%-30s %s" $var "[set ::$var]"]
>  #}
> -	
> \ No newline at end of file
> -- 
> 2.28.0
> 

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

* [PATCH 1/2] sim: switch top level to automake
  2021-01-17 16:09 [PATCH] sim: testsuite: push $arch out to targets Mike Frysinger
  2021-01-18  9:52 ` Andrew Burgess
@ 2021-01-18 17:54 ` Mike Frysinger
  2021-01-18 17:54   ` [PATCH 2/2] sim: testsuite: merge into toplevel automake Mike Frysinger
  1 sibling, 1 reply; 19+ messages in thread
From: Mike Frysinger @ 2021-01-18 17:54 UTC (permalink / raw)
  To: gdb-patches

This doesn't gain us much by itself, but it sets us up for using more
features as we try to unify ports.

	* Makefile.am: New file.
	* configure.ac: Update AC_INIT call.  Move AC_CANONICAL_SYSTEM after
	it.  Call AM_INIT_AUTOMAKE.
	* aclocal.m4, configure, Makefile.in: Regenerated.
---
 sim/Makefile.am  |   36 +
 sim/Makefile.in  |  807 +++++++++++++------
 sim/aclocal.m4   | 1152 +++++++++++++++++++++++++++
 sim/configure    | 1926 ++++++++++++++++++++++++++++++++++++----------
 sim/configure.ac |   11 +-
 5 files changed, 3281 insertions(+), 651 deletions(-)
 create mode 100644 sim/Makefile.am
 create mode 100644 sim/aclocal.m4

diff --git a/sim/Makefile.am b/sim/Makefile.am
new file mode 100644
index 000000000000..150209c565c8
--- /dev/null
+++ b/sim/Makefile.am
@@ -0,0 +1,36 @@
+## Process this file with automake to generate Makefile.in
+#
+#   Copyright (C) 1993-2021 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
+ACLOCAL_AMFLAGS = -I.. -I../config
+
+srcroot = $(srcdir)/..
+
+SUBDIRS = @subdirs@
+
+MOSTLYCLEANFILES = core
+
+# Generate nltvals.def for newlib/libgloss using devo and build tree.
+# This file is shipped with distributions so we build in the source dir.
+# Use `make nltvals' to rebuild.
+# Note: If gdb releases begin to contain target header files (not a good idea,
+# but if they did ...), nltvals.def coud be generated at build time.
+# An alternative is to slurp in the tables at runtime.
+.PHONY: nltvals
+nltvals:
+	$(SHELL) $(abs_srcdir)/common/gennltvals.sh --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot)
+	$(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def
diff --git a/sim/aclocal.m4 b/sim/aclocal.m4
new file mode 100644
index 000000000000..df8ff837794b
diff --git a/sim/configure.ac b/sim/configure.ac
index 99364cac7f4e..178abf41827e 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -1,13 +1,20 @@
 dnl Process this file with autoconf to produce a configure script.
 m4_include([../config/override.m4])
-AC_INIT(Makefile.in)
+dnl NB: The version here is not used.  If gdb ever changes from generating its
+dnl version at build time to autoconf time (like bfd et al do), we can switch.
+AC_INIT([sim], [0],
+  [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
+  [], [https://sourceware.org/gdb/wiki/Sim/])
+
+AC_CANONICAL_SYSTEM
+
+AM_INIT_AUTOMAKE
 
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 
-AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
 AC_PROG_CC
 AC_PROG_CPP
-- 
2.28.0


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

* [PATCH 2/2] sim: testsuite: merge into toplevel automake
  2021-01-18 17:54 ` [PATCH 1/2] sim: switch top level to automake Mike Frysinger
@ 2021-01-18 17:54   ` Mike Frysinger
  0 siblings, 0 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-18 17:54 UTC (permalink / raw)
  To: gdb-patches

This allows us to delete all our custom test logic.

sim/:
	* configure.ac (AC_CONFIG_FILES): Delete testsuite/Makefile.
	* Makefile.am: Include testsuite/local.mk.
	* aclocal.m4, configure, Makefile.in: Regenerated.

sim/common/:
	* Make-common.in (check): Delete body.

sim/testsuite/:
	* Makefile.in: Delete.
	* lib/sim-defs.exp (sim): Update default path.
	* local.mk: New file based on Makefile.in.
---
 sim/Makefile.am                |   2 +
 sim/Makefile.in                |  72 +++++++++----
 sim/aclocal.m4                 |  21 +---
 sim/common/Make-common.in      |   1 -
 sim/configure                  |   3 +-
 sim/configure.ac               |   2 +-
 sim/testsuite/Makefile.in      | 181 ---------------------------------
 sim/testsuite/lib/sim-defs.exp |   2 +-
 sim/testsuite/local.mk         |  46 +++++++++
 9 files changed, 104 insertions(+), 226 deletions(-)
 delete mode 100644 sim/testsuite/Makefile.in
 create mode 100644 sim/testsuite/local.mk

diff --git a/sim/Makefile.am b/sim/Makefile.am
index 150209c565c8..5e4b0a3df88c 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -34,3 +34,5 @@ MOSTLYCLEANFILES = core
 nltvals:
 	$(SHELL) $(abs_srcdir)/common/gennltvals.sh --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot)
 	$(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def
+
+include testsuite/local.mk
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 8740a4a079e7..11330357491a 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -480,7 +480,6 @@ installdirs:
 	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir)
 
 check:
-	cd ../testsuite && $(MAKE) check RUNTESTFLAGS="$(RUNTESTFLAGS)"
 
 info:
 clean-info:
diff --git a/sim/configure.ac b/sim/configure.ac
index 178abf41827e..c447dc02cb54 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -56,5 +56,5 @@ if test "${enable_sim}" != no; then
   fi
 fi
 
-AC_CONFIG_FILES([Makefile testsuite/Makefile])
+AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp
index 43a07050f508..0157f9bb2834 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -106,7 +106,7 @@ proc sim_run { prog sim_opts prog_opts redir options } {
 	# These global variables come from generated site.exp.
 	global objdir
 	global arch
-	set sim "$objdir/../$arch/run"
+	set sim "$objdir/$arch/run"
     }
 
     if [is_remote host] {
diff --git a/sim/testsuite/local.mk b/sim/testsuite/local.mk
new file mode 100644
index 000000000000..f27581ba2db6
--- /dev/null
+++ b/sim/testsuite/local.mk
@@ -0,0 +1,46 @@
+## See sim/Makefile.am.
+#
+# Copyright (C) 1997-2021 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# We don't need dejagnu's tool-filtering logic as all tests under testsuite/
+# are for the sim.
+DEJATOOL = ""
+EXPECT = expect
+RUNTEST = runtest
+RUNTESTFLAGS =
+
+check-DEJAGNU: site.exp
+	if [ -d testsuite ]; then \
+	  true; \
+	else \
+	  mkdir testsuite; \
+	fi
+	rm -f testsuite/site.exp
+	cp site.exp testsuite/site.exp
+	rootme=`pwd`; export rootme; \
+	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+	LC_ALL=C; export LC_ALL; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	runtest=$(RUNTEST); \
+	cd testsuite; \
+	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+	  $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
+		$(RUNTESTFLAGS); \
+	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+	fi
+
+MOSTLYCLEANFILES += \
+	site.exp site.bak %D%/site.exp %D%/testrun.log %D%/testrun.sum
-- 
2.28.0


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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-18  9:52 ` Andrew Burgess
@ 2021-01-18 18:01   ` Mike Frysinger
  2021-01-20 19:53     ` Tom Tromey
  2021-01-21  9:22     ` Andrew Burgess
  0 siblings, 2 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-18 18:01 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

On 18 Jan 2021 09:52, Andrew Burgess wrote:
> * Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> [2021-01-17 11:09:45 -0500]:
> > This is needed to move to automake & its dejagnu-provided logic,
> > and eventually by the unified sim logic.
> 
> I looked through this patch and I didn't understand what's going on
> here.
> 
> Why do you need to set the global arch in some, but not all tests?

it is being done in all tests.  which ones do you think i skipped ?

> If this needs doing at all, could it not be done in some global location?

the sim ports use a unique subdir for their `run` program.  the tests
need to find that path.  this $arch value is what binds the specific
subdir to the test.

as we do multibuilds, we'll have multiple ports active, so a single
variable won't cut it.  moving it here and out of autotols enables
that.  as we do multitarget, this will help smooth the transition as
we won't have to juggle each arch as it migrates.
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-18 18:01   ` Mike Frysinger
@ 2021-01-20 19:53     ` Tom Tromey
  2021-01-21  0:37       ` Mike Frysinger
  2021-01-21  9:22     ` Andrew Burgess
  1 sibling, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2021-01-20 19:53 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

Mike> as we do multibuilds, we'll have multiple ports active, so a single
Mike> variable won't cut it.  moving it here and out of autotols enables
Mike> that.  as we do multitarget, this will help smooth the transition as
Mike> we won't have to juggle each arch as it migrates.

I'm curious to hear about the plan here, specifically if you plan to
tackle the "gdb can only include one sim" problem.

Tom

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-20 19:53     ` Tom Tromey
@ 2021-01-21  0:37       ` Mike Frysinger
  2021-01-22 16:29         ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Mike Frysinger @ 2021-01-21  0:37 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andrew Burgess, gdb-patches

On 20 Jan 2021 12:53, Tom Tromey wrote:
> Mike> as we do multibuilds, we'll have multiple ports active, so a single
> Mike> variable won't cut it.  moving it here and out of autotols enables
> Mike> that.  as we do multitarget, this will help smooth the transition as
> Mike> we won't have to juggle each arch as it migrates.
> 
> I'm curious to hear about the plan here, specifically if you plan to
> tackle the "gdb can only include one sim" problem.

i've been slowly reworking the sim core to flip it from "the port owns the
central data structure" to "the core owns everything, and ports are just
given a pointer to their data structure".  that would allow for the core to
pick the backend instead of the backend picking the core.

there's other settings that make this difficult in the sim as it binds a
lot of configure-time settings into the build (like register & addresss
sizes & endianness).  so i'd expect at first we'd be able to do compatible
ports in a single build (e.g. all 32bit little endian).  where to go from
there will require experimentation.  i'm thinking the core compiles all
variants (32/64 le/be) and then the ports use defines to pick the right
ones for their subdir.

part of this work has been removing the ability for ports to deviate at
all: just make a single decision in the core, and everyone uses that.
we've given ports way too much leeway for too long.

at the very least, i have it working now where each subdir can be built
and installed in a single build.  this is helpful for doing quick tests
that changes at least compile.  obviously can't link a single gdb from
this, but gotta start somewhere.  i'm trying to do this incrementally
rather than flip a switch and have everyone migrate in a single commit.
especially because not all ports support even the common/ code atm.

sim $ ls
aarch64  config.cache   d10v   h8300   m32r        mips     ppc   testsuite
arm      config.log     erc32  igen    m68hc11     mn10300  pru   v850
avr      config.status  foo    iq2000  Makefile    moxie    rl78
bfin     cr16           frv    lm32    mcore       msp430   rx
bpf      cris           ft32   m32c    microblaze  or1k     sh
sim $ ls */run */libsim.a
aarch64/libsim.a  d10v/run         m32r/libsim.a        msp430/run
aarch64/run       erc32/libsim.a   m32r/run             or1k/libsim.a
arm/libsim.a      erc32/run        m68hc11/libsim.a     or1k/run
arm/run           frv/libsim.a     m68hc11/run          ppc/libsim.a
avr/libsim.a      frv/run          mcore/libsim.a       ppc/run
avr/run           ft32/libsim.a    mcore/run            pru/libsim.a
bfin/libsim.a     ft32/run         microblaze/libsim.a  pru/run
bfin/run          h8300/libsim.a   microblaze/run       rl78/libsim.a
bpf/libsim.a      h8300/run        mips/libsim.a        rl78/run
bpf/run           iq2000/libsim.a  mips/run             rx/libsim.a
cr16/libsim.a     iq2000/run       mn10300/libsim.a     rx/run
cr16/run          lm32/libsim.a    mn10300/run          sh/libsim.a
cris/libsim.a     lm32/run         moxie/libsim.a       sh/run
cris/run          m32c/libsim.a    moxie/run            v850/libsim.a
d10v/libsim.a     m32c/run         msp430/libsim.a      v850/run
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-18 18:01   ` Mike Frysinger
  2021-01-20 19:53     ` Tom Tromey
@ 2021-01-21  9:22     ` Andrew Burgess
  2021-01-22  6:36       ` Mike Frysinger
  1 sibling, 1 reply; 19+ messages in thread
From: Andrew Burgess @ 2021-01-21  9:22 UTC (permalink / raw)
  To: gdb-patches

* Mike Frysinger <vapier@gentoo.org> [2021-01-18 13:01:53 -0500]:

> On 18 Jan 2021 09:52, Andrew Burgess wrote:
> > * Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> [2021-01-17 11:09:45 -0500]:
> > > This is needed to move to automake & its dejagnu-provided logic,
> > > and eventually by the unified sim logic.
> > 
> > I looked through this patch and I didn't understand what's going on
> > here.
> > 
> > Why do you need to set the global arch in some, but not all tests?
> 
> it is being done in all tests.  which ones do you think i skipped ?

That's my bad, I hadn't realised just how few *.exp files there are in
the sim testsuite tree.

> 
> > If this needs doing at all, could it not be done in some global location?
> 
> the sim ports use a unique subdir for their `run` program.  the tests
> need to find that path.  this $arch value is what binds the specific
> subdir to the test.

I don't understand that paragraph I'm afraid.

I guess my question is each *.exp file gets invoked by dejagnu, but
there are other hooks that dejagnu calls, like the ${tool}_init proc.
Could we not use that to set these things instead?  It seems like
there's a 1:1 mapping between [istarget ????] patterns and the values
pushed into both arch and all_machs.

> 
> as we do multibuilds, we'll have multiple ports active, so a single
> variable won't cut it.  moving it here and out of autotols enables
> that.  as we do multitarget, this will help smooth the transition as
> we won't have to juggle each arch as it migrates.

Again, I don't understand this, or how it relates to this discussion.
Sorry.

Thanks,
Andrew

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-21  9:22     ` Andrew Burgess
@ 2021-01-22  6:36       ` Mike Frysinger
  2021-01-31  1:27         ` Mike Frysinger
  2021-01-31 10:54         ` Andrew Burgess
  0 siblings, 2 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-22  6:36 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

On 21 Jan 2021 09:22, Andrew Burgess wrote:
> * Mike Frysinger <vapier@gentoo.org> [2021-01-18 13:01:53 -0500]:
> > On 18 Jan 2021 09:52, Andrew Burgess wrote:
> > > * Mike Frysinger [2021-01-17 11:09:45 -0500]:
> > > > This is needed to move to automake & its dejagnu-provided logic,
> > > > and eventually by the unified sim logic.
> > > 
> > > I looked through this patch and I didn't understand what's going on
> > > here.
> > > 
> > > If this needs doing at all, could it not be done in some global location?
> > 
> > the sim ports use a unique subdir for their `run` program.  the tests
> > need to find that path.  this $arch value is what binds the specific
> > subdir to the test.
> 
> I don't understand that paragraph I'm afraid.
> 
> I guess my question is each *.exp file gets invoked by dejagnu, but
> there are other hooks that dejagnu calls, like the ${tool}_init proc.
> Could we not use that to set these things instead?  It seems like
> there's a 1:1 mapping between [istarget ????] patterns and the values
> pushed into both arch and all_machs.

i'm not seeing how any hooks would help.  the targets need to know where
their sim program lives.  let me brain dump on you :p.

lets look at a bfin & frv build tree.
build-bfin-elf/
`-- sim/
    `-- bfin/
        `-- run
build-frv-elf/
`-- sim/
    `-- frv/
        `-- run

sim/testsuite/frv/*.exp files need to know to look for $(builddir)/frv/run
while sim/testsuite/bfin/*.exp files need $(builddir)/bfin/run.

i know the variable is called $arch and that can be confusing.  i could
rename it if it helps.  just keep in mind that this is used for exactly
one thing: where to find `run` under $(builddir)/.

when we invoke dejagnu, it was with --tool=sim.  if we had combined trees
with other tools (gas/gdb/etc...), this would make sense, but it doesn't,
so we changed it to --tool="".  now when you run `runtest`, it will find
all *.exp files under sim/testsuite/ and attempt to execute them.

today, for any given target, there is at most one sim port available to
them.  the opposite obviously cannot be said:
* bfin-*-* will match the bare-metal, the Linux FLAT, and the Linux FDPIC
  toolchains, not to mention every infinite variation of the vendor field
* arm*-*-* will match every ARM CPU variant out there, plus every other
  OS & vendor variant

if we focus on [istarget ????] to $arch mappings, they would only map to
one $arch value, but more than one ???? can map to the same $arch.  i
don't mean this in terms of the infinite tuples i mentioned above, but
in a more real world sense:
* mips/*.exp has many variations
* h8300/*.exp has a few variations
* cris/**.exp has a few variations

this is why stuffing the $arch from configure.tgt has worked OK up to
now: it controls whether the sim port is enabled (e.g. bfin-*-*), and
then the tests will run only for a subset (e.g. [istarget bfin-*-elf]).

but the [istarget] check is a relic of the past.  we should not care
what we're targetting, we should care whether the sim port is enabled.
so for most arches, i could flip the check like:
	-if [istarget bfin-*-elf] {
	+set arch "bfin"
	+set sim "$objdir/../$arch/run"
	+if [file exists $sim] {

but some ports have assumptions built into their testsuites that i
don't want to untangle today.  and assumptions in the toolchain like
gas not supporting multitarget well.

so getting back to why i'm pushing $arch out: as an incremental step
to multibuild & eventually multitarget.  in multibuild, i have now:
build/
`-- sim/
    |-- arm/
    |   `-- run
    |-- bfin/
    |   `-- run
    |-- frv/
    |   `-- run
    ...

with multitarget, we'd start with the multibuild layout above, but
slowly migrate ports one-by-one to:
build/
`-- sim/
    |-- run     <-- supports multiple arches in one binary e.g. bfin
    |-- arm/    <-- arm hasn't migrated yet
    |           <-- no bfin because it's in the multione above
    |-- frv/    <-- frv hasn't migrated yet
    ...
even in a non-multitarget scenario, we'd still use the flat layout:
build-bfin/
`-- sim/
    `-- run

as the arch cuts over to multitarget, we'd also update its corresponding
*.exp settings so that it'd use sim/run instead of sim/$arch/run.  but
all the ones that haven't migrated would still need $arch set.

one might argue this change is a little premature when i don't have a
working multitarget build working now, but i found it helpful as i've
been migrating things to automake & a centralized build to do this now,
and i know we'll need to eventually kick the value out of configure.
so might as well do it now and be done.
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-21  0:37       ` Mike Frysinger
@ 2021-01-22 16:29         ` Tom Tromey
  2021-01-23  4:35           ` Mike Frysinger
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2021-01-22 16:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andrew Burgess, gdb-patches

Mike> at the very least, i have it working now where each subdir can be built
Mike> and installed in a single build.

Nice.

Mike> this is helpful for doing quick tests
Mike> that changes at least compile.  obviously can't link a single gdb from
Mike> this, but gotta start somewhere.

One thing that I think would be nice is if we removed remote-sim.c and
instead had the sim act as a gdbserver.  This could be done either by
reusing gdbserver (writing a new sim-based back end) or by reusing one
of the tiny gdbserver stubs from gdb/stubs/.

This would support my long-term goal of making gdb always target-async.
Not all the targets are async-ready, but remote-sim is one that really
cannot be made async at all...

One problem with this idea is that the sim can renumber registers.
So I guess the sims would have to send over an XML register description.
Maybe there are gotchas here, I'm not sure.

Another problem is that this would lose CLI completion for sim commands.
However I suppose we could add a remote protocol request for this if we
really cared.

Curious to hear what you think of this.

Tom

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-22 16:29         ` Tom Tromey
@ 2021-01-23  4:35           ` Mike Frysinger
  2021-01-23 17:33             ` Tom Tromey
  0 siblings, 1 reply; 19+ messages in thread
From: Mike Frysinger @ 2021-01-23  4:35 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 22 Jan 2021 09:29, Tom Tromey wrote:
> One thing that I think would be nice is if we removed remote-sim.c and
> instead had the sim act as a gdbserver.  This could be done either by
> reusing gdbserver (writing a new sim-based back end)

it's an interesting idea i hadn't thought of before.  i think it could be
bolted into gdbserver in parallel with its existing "low" concept so that
things don't get too messy with the existing host/target logic that it
uses.

it is kind of nice that you can connect/use the sim today with only gdb
and not have to juggle another program (especially its lifecycle).  tbh,
i've never found gdbserver to be super user friendly, and i think having
supported customers trying to use it, many would agree.  though to be
fair, i don't think the current gdb sim cli is super friendly either ...
it's just robust in creating/killing/restarting.

> or by reusing one of the tiny gdbserver stubs from gdb/stubs/.

i looked at the existing gdb/stubs/ and i don't think any of them would
really be useful.  if we can't use gdbserver, then we'd prob implement
our own in the run program itself.

> This would support my long-term goal of making gdb always target-async.
> Not all the targets are async-ready, but remote-sim is one that really
> cannot be made async at all...

couldn't it create the sim in a thread ?  the sim should be maintaining
all its own state by itself and not go smashing global state.  or fork
it as a background process and have gdb maintain a control pipe.

> One problem with this idea is that the sim can renumber registers.
> So I guess the sims would have to send over an XML register description.
> Maybe there are gotchas here, I'm not sure.

i'm not sure what you mean by the sim renumbering registers.  there are
headers in include/gdb/sim-* for exporting the register numbers that the
sim uses, and they're pretty much frozen from the start of the sim port.
in many cases, the regnum series is exactly the same as gdb's own list.
for example, sim-bfin.h:sim_bfin_regnum & bfin-tdep.h:gdb_regnum are the
same so we don't need two sep codepaths.  but i agree that, if possible,
we should support exporting an XML register description to avoid having
to maintain hardcoded list on either side of the world.

> Another problem is that this would lose CLI completion for sim commands.
> However I suppose we could add a remote protocol request for this if we
> really cared.

i'm not familiar with the full range of the remote protocol.  ignoring
command completion, how would it even send custom commands ?  i flipped
through the manual but nothing caught my eye.
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-23  4:35           ` Mike Frysinger
@ 2021-01-23 17:33             ` Tom Tromey
  2021-01-25  5:34               ` Mike Frysinger
  0 siblings, 1 reply; 19+ messages in thread
From: Tom Tromey @ 2021-01-23 17:33 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Mike> it is kind of nice that you can connect/use the sim today with only gdb
Mike> and not have to juggle another program (especially its lifecycle).

We could keep "target sim" around as a simple wrapper for "target
remote", and it could launch the sim for you.

It's not quite as ideal as having the sim linked in -- the external sim
could be misinstalled somehow -- but it seems like it would be good
enough.

>> This would support my long-term goal of making gdb always target-async.
>> Not all the targets are async-ready, but remote-sim is one that really
>> cannot be made async at all...

Mike> couldn't it create the sim in a thread ?  the sim should be maintaining
Mike> all its own state by itself and not go smashing global state.  or fork
Mike> it as a background process and have gdb maintain a control pipe.

I think the control pipe basically winds up as gdbserver.  It would need
some subset of the existing gdbserver commands -- fetch/store
registers/memory, breakpoints, etc.  It seems better not to invent
another way to do this.

A secondary goal for me is for all the targets in gdb to be
multi-target-capable.  If a sim needs globals, then that wouldn't work.

If the sims are well-behaved about global state, then yes, threads would
be ok.  It was my impression, though, that they are not.  Is that true?

>> One problem with this idea is that the sim can renumber registers.
>> So I guess the sims would have to send over an XML register description.
>> Maybe there are gotchas here, I'm not sure.

Mike> i'm not sure what you mean by the sim renumbering registers.

I stumbled across this in gdbarch.sh:

  # MAP a GDB RAW register number onto a simulator register number.  See
  # also include/...-sim.h.
  m;int;register_sim_regno;int reg_nr;reg_nr;;legacy_register_sim_regno;;0

This seems to be implemented by a number of architectures, though some
of them seem to be unnecessary and/or copy-paste.

I didn't really know how to tackle this and after poking at it a bit I
got discouraged.  I guess figuring out the XML stuff and hacking up the
sim seemed like too much for a random side project.

Also I don't really know how to run even the simplest thing in the sim.
Is there a simple way to get started?

>> Another problem is that this would lose CLI completion for sim commands.
>> However I suppose we could add a remote protocol request for this if we
>> really cared.

Mike> i'm not familiar with the full range of the remote protocol.  ignoring
Mike> command completion, how would it even send custom commands ?  i flipped
Mike> through the manual but nothing caught my eye.

The gdb "monitor" command sends a string to the remote for
interpretation.  I guess in this approach we could make the "sim"
command an alias for "monitor".

I see a few benefits from all this, including the multi-build stuff you
are working on.  We sometimes break remote-sim.c, because right now you
have to specially request it for a particular target.  If remote-sim
were not linked to the sim itself, this would never be a problem.  And,
if the sim handled --enable-target=all, maintainers could simply build
it all the time.

thanks,
Tom

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-23 17:33             ` Tom Tromey
@ 2021-01-25  5:34               ` Mike Frysinger
  0 siblings, 0 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-25  5:34 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 23 Jan 2021 10:33, Tom Tromey wrote:
> Mike> it is kind of nice that you can connect/use the sim today with only gdb
> Mike> and not have to juggle another program (especially its lifecycle).
> 
> We could keep "target sim" around as a simple wrapper for "target
> remote", and it could launch the sim for you.
> 
> It's not quite as ideal as having the sim linked in -- the external sim
> could be misinstalled somehow -- but it seems like it would be good
> enough.

that would be a nice concession as it'd maintain UX

> >> This would support my long-term goal of making gdb always target-async.
> >> Not all the targets are async-ready, but remote-sim is one that really
> >> cannot be made async at all...
> 
> Mike> couldn't it create the sim in a thread ?  the sim should be maintaining
> Mike> all its own state by itself and not go smashing global state.  or fork
> Mike> it as a background process and have gdb maintain a control pipe.
> 
> I think the control pipe basically winds up as gdbserver.  It would need
> some subset of the existing gdbserver commands -- fetch/store
> registers/memory, breakpoints, etc.  It seems better not to invent
> another way to do this.

completely fair

> A secondary goal for me is for all the targets in gdb to be
> multi-target-capable.  If a sim needs globals, then that wouldn't work.

you mean gdb has more than one target active at a time ?  or that gdb
has the capability to support more than one architecture in a single
build, but only ever has one active target ?

> If the sims are well-behaved about global state, then yes, threads would
> be ok.  It was my impression, though, that they are not.  Is that true?

my goal has been to move everything into the SIM_DESC structure.  the
common/ code is pretty good in this regard.  it's not 100%, but i think
it's like 95% of the way there, and wouldn't be terribly difficult to
finish it up.

arch ports are all of the place.  some are much better than others.
usually you can get a sense of how good it is by how much of the common
code it utilizes.

so i would say they would all work fine today if you only had one sim
active, and the work to make the sim support multi-targets would have
the side-effect of being thread safe (e.g. support multiple simultaneous
active sims in a single process).

> >> One problem with this idea is that the sim can renumber registers.
> >> So I guess the sims would have to send over an XML register description.
> >> Maybe there are gotchas here, I'm not sure.
> 
> Mike> i'm not sure what you mean by the sim renumbering registers.
> 
> I stumbled across this in gdbarch.sh:
> 
>   # MAP a GDB RAW register number onto a simulator register number.  See
>   # also include/...-sim.h.
>   m;int;register_sim_regno;int reg_nr;reg_nr;;legacy_register_sim_regno;;0
> 
> This seems to be implemented by a number of architectures, though some
> of them seem to be unnecessary and/or copy-paste.
> 
> I didn't really know how to tackle this and after poking at it a bit I
> got discouraged.  I guess figuring out the XML stuff and hacking up the
> sim seemed like too much for a random side project.

oof, i had missed that in my travels.  i'm fairly Blackfin-focused and we
never did anything like that.  that explains some weirdness i'd noticed
though with some ports and their register definitions that i couldn't
explain.

since gdb<->sim are statically linked together, and only ever in a single
build, i'd be inclined to take a one-time hit and break this ABI if only
for the sake of simplifying the gdb side of the world.  it would affect
anyone linking -lsim into their own projects and using the API, but tbh,
i think that's a pretty small userbase, if one exists at all.  we don't
install any headers for it (even though we have some), so people have to
be very dedicated to pull it off.

this would be predicated on the gdb reg nums never changing since their
internal enum values would be coupled with the sim side.  do you think
that's reasonable ?  it's because those internal gdb reg nums are *not*
currently exported is why we have this whole sim reg num remapping ...

my concerns about going all-in on the gdb target description format:
* GDB itself makes XML optional, and i don't think the remote protocol
  supports any other serialized format than XML, so now sim-integration
  would require GDB have XML enabled
* not all of the sim ports that have gdb ports support the format, so
  someone would have to define that core logic first, and i'm certainly
  not an expert in most of these arches to feel confident in doing that.
  i.e. gdb/features/ is missing at least avr, bfin, bpf, cris, frv, ft32,
  and more.

> Also I don't really know how to run even the simplest thing in the sim.
> Is there a simple way to get started?

the biggest pet peeve of mine is that the gdb/sim has always required you
to load something into it (i.e. an ELF) before you can start to experiment,
and even then, you really need to have it start executing.  if you try to
do anything before that, it just complains nothing is available.

so i hand create a small ELF using gas+ld first (should work everywhere):
$ printf ".global _start\n_start:\n.byte 0\n" > test.s
$ ./gas/as-new test.s -o test.o && ./ld/ld-new test.o -o test

then you can utilize the sim:
$ ./gdb/gdb -q ./test
Reading symbols from ./test...
(No debugging symbols found in ./test)
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0x4 lma 0x0
Start address 0x0
Transfer rate: 32 bits in <1 sec.
(gdb) b *0
Breakpoint 1 at 0x0
(gdb) r
Starting program: .../test

0x00000000 in start ()
(gdb) 

now you should be able to explore the sim (regs/mem/etc...).

i'm not sure how much of this behavior is due to gdb and how much is due
to the sim.  i assume it's mostly the sim as you can connect to a remote
target and then immediately start exploring the runtime.

> >> Another problem is that this would lose CLI completion for sim commands.
> >> However I suppose we could add a remote protocol request for this if we
> >> really cared.
> 
> Mike> i'm not familiar with the full range of the remote protocol.  ignoring
> Mike> command completion, how would it even send custom commands ?  i flipped
> Mike> through the manual but nothing caught my eye.
> 
> The gdb "monitor" command sends a string to the remote for
> interpretation.  I guess in this approach we could make the "sim"
> command an alias for "monitor".

ah right, i used to use that when i maintained a gdb stub on top of a usb
jtag device.  that should work fine.

> I see a few benefits from all this, including the multi-build stuff you
> are working on.  We sometimes break remote-sim.c, because right now you
> have to specially request it for a particular target.  If remote-sim
> were not linked to the sim itself, this would never be a problem.  And,
> if the sim handled --enable-target=all, maintainers could simply build
> it all the time.

i've put together an example sim that works on all targets for people to
use when writing a new port.  maybe that would help here too in the mean
time ?
https://sourceware.org/pipermail/gdb-patches/2021-January/175204.html
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-22  6:36       ` Mike Frysinger
@ 2021-01-31  1:27         ` Mike Frysinger
  2021-01-31 10:54         ` Andrew Burgess
  1 sibling, 0 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-31  1:27 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

did this make things more clear ?  or just muddle it further ?
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-22  6:36       ` Mike Frysinger
  2021-01-31  1:27         ` Mike Frysinger
@ 2021-01-31 10:54         ` Andrew Burgess
  2021-01-31 19:41           ` Mike Frysinger
  1 sibling, 1 reply; 19+ messages in thread
From: Andrew Burgess @ 2021-01-31 10:54 UTC (permalink / raw)
  To: gdb-patches

* Mike Frysinger <vapier@gentoo.org> [2021-01-22 01:36:05 -0500]:

> On 21 Jan 2021 09:22, Andrew Burgess wrote:
> > * Mike Frysinger <vapier@gentoo.org> [2021-01-18 13:01:53 -0500]:
> > > On 18 Jan 2021 09:52, Andrew Burgess wrote:
> > > > * Mike Frysinger [2021-01-17 11:09:45 -0500]:
> > > > > This is needed to move to automake & its dejagnu-provided logic,
> > > > > and eventually by the unified sim logic.
> > > > 
> > > > I looked through this patch and I didn't understand what's going on
> > > > here.
> > > > 
> > > > If this needs doing at all, could it not be done in some global location?
> > > 
> > > the sim ports use a unique subdir for their `run` program.  the tests
> > > need to find that path.  this $arch value is what binds the specific
> > > subdir to the test.
> > 
> > I don't understand that paragraph I'm afraid.
> > 
> > I guess my question is each *.exp file gets invoked by dejagnu, but
> > there are other hooks that dejagnu calls, like the ${tool}_init proc.
> > Could we not use that to set these things instead?  It seems like
> > there's a 1:1 mapping between [istarget ????] patterns and the values
> > pushed into both arch and all_machs.
> 
> i'm not seeing how any hooks would help.  the targets need to know where
> their sim program lives.  let me brain dump on you :p.
> 
> lets look at a bfin & frv build tree.
> build-bfin-elf/
> `-- sim/
>     `-- bfin/
>         `-- run
> build-frv-elf/
> `-- sim/
>     `-- frv/
>         `-- run
> 
> sim/testsuite/frv/*.exp files need to know to look for $(builddir)/frv/run
> while sim/testsuite/bfin/*.exp files need $(builddir)/bfin/run.
> 
> i know the variable is called $arch and that can be confusing.  i could
> rename it if it helps.  just keep in mind that this is used for exactly
> one thing: where to find `run` under $(builddir)/.
> 
> when we invoke dejagnu, it was with --tool=sim.  if we had combined trees
> with other tools (gas/gdb/etc...), this would make sense, but it doesn't,
> so we changed it to --tool="".  now when you run `runtest`, it will find
> all *.exp files under sim/testsuite/ and attempt to execute them.

OK.  I don't understand why changing tool from "sim" to "" is either
necessary, or a good thing, but, whatever....

For gdb we have a 'gdb_init' proc, which is called based on
'${tool}_init' from within GDB.  Now that we have no tool set does
this prevent us having an 'init' proc?

Lets assume for one moment that we _did_ have an init proc.  Could
that proc not just have one huge [istarget ???] { set arch ... } tree
that handled all known istarget patterns?

If we can't have an init proc because we no longer have a tool set,
then lets revisit that decision.

My understanding is that we can't have a tool name set because our
testsuite is organised like this:

  sim/testsuite/TESTSET/*.exp

In contrast, GDB's tests are named like:

  gdb/testsuite/gdb.TESTSET/*.exp

Could we not just rename our test directories along a similar pattern,
reset the tool name, then use the init function that gets called to
figure out all of the boiler plate stuff that needs setting.

I think you say that right now we have pretty much one test script for
each arch, but there's no reason which this has to be the case
forever, right?

It just seems weird to me to say that each test is required to start
with a highly predictable bit of boiler plate...

Thanks for indulging me,

Andrew



> 
> today, for any given target, there is at most one sim port available to
> them.  the opposite obviously cannot be said:
> * bfin-*-* will match the bare-metal, the Linux FLAT, and the Linux FDPIC
>   toolchains, not to mention every infinite variation of the vendor field
> * arm*-*-* will match every ARM CPU variant out there, plus every other
>   OS & vendor variant
> 
> if we focus on [istarget ????] to $arch mappings, they would only map to
> one $arch value, but more than one ???? can map to the same $arch.  i
> don't mean this in terms of the infinite tuples i mentioned above, but
> in a more real world sense:
> * mips/*.exp has many variations
> * h8300/*.exp has a few variations
> * cris/**.exp has a few variations
> 
> this is why stuffing the $arch from configure.tgt has worked OK up to
> now: it controls whether the sim port is enabled (e.g. bfin-*-*), and
> then the tests will run only for a subset (e.g. [istarget bfin-*-elf]).
> 
> but the [istarget] check is a relic of the past.  we should not care
> what we're targetting, we should care whether the sim port is enabled.
> so for most arches, i could flip the check like:
> 	-if [istarget bfin-*-elf] {
> 	+set arch "bfin"
> 	+set sim "$objdir/../$arch/run"
> 	+if [file exists $sim] {
> 
> but some ports have assumptions built into their testsuites that i
> don't want to untangle today.  and assumptions in the toolchain like
> gas not supporting multitarget well.
> 
> so getting back to why i'm pushing $arch out: as an incremental step
> to multibuild & eventually multitarget.  in multibuild, i have now:
> build/
> `-- sim/
>     |-- arm/
>     |   `-- run
>     |-- bfin/
>     |   `-- run
>     |-- frv/
>     |   `-- run
>     ...
> 
> with multitarget, we'd start with the multibuild layout above, but
> slowly migrate ports one-by-one to:
> build/
> `-- sim/
>     |-- run     <-- supports multiple arches in one binary e.g. bfin
>     |-- arm/    <-- arm hasn't migrated yet
>     |           <-- no bfin because it's in the multione above
>     |-- frv/    <-- frv hasn't migrated yet
>     ...
> even in a non-multitarget scenario, we'd still use the flat layout:
> build-bfin/
> `-- sim/
>     `-- run
> 
> as the arch cuts over to multitarget, we'd also update its corresponding
> *.exp settings so that it'd use sim/run instead of sim/$arch/run.  but
> all the ones that haven't migrated would still need $arch set.
> 
> one might argue this change is a little premature when i don't have a
> working multitarget build working now, but i found it helpful as i've
> been migrating things to automake & a centralized build to do this now,
> and i know we'll need to eventually kick the value out of configure.
> so might as well do it now and be done.
> -mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-31 10:54         ` Andrew Burgess
@ 2021-01-31 19:41           ` Mike Frysinger
  2021-02-06 17:16             ` Mike Frysinger
  2021-02-08 12:12             ` Andrew Burgess
  0 siblings, 2 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-01-31 19:41 UTC (permalink / raw)
  To: gdb-patches

On 31 Jan 2021 10:54, Andrew Burgess wrote:
> * Mike Frysinger <vapier@gentoo.org> [2021-01-22 01:36:05 -0500]:
> > On 21 Jan 2021 09:22, Andrew Burgess wrote:
> > > * Mike Frysinger <vapier@gentoo.org> [2021-01-18 13:01:53 -0500]:
> > > > On 18 Jan 2021 09:52, Andrew Burgess wrote:
> > > > > * Mike Frysinger [2021-01-17 11:09:45 -0500]:
> > > > > > This is needed to move to automake & its dejagnu-provided logic,
> > > > > > and eventually by the unified sim logic.
> > > > > 
> > > > > I looked through this patch and I didn't understand what's going on
> > > > > here.
> > > > > 
> > > > > If this needs doing at all, could it not be done in some global location?
> > > > 
> > > > the sim ports use a unique subdir for their `run` program.  the tests
> > > > need to find that path.  this $arch value is what binds the specific
> > > > subdir to the test.
> > > 
> > > I don't understand that paragraph I'm afraid.
> > > 
> > > I guess my question is each *.exp file gets invoked by dejagnu, but
> > > there are other hooks that dejagnu calls, like the ${tool}_init proc.
> > > Could we not use that to set these things instead?  It seems like
> > > there's a 1:1 mapping between [istarget ????] patterns and the values
> > > pushed into both arch and all_machs.
> > 
> > i'm not seeing how any hooks would help.  the targets need to know where
> > their sim program lives.  let me brain dump on you :p.
> > 
> > lets look at a bfin & frv build tree.
> > build-bfin-elf/
> > `-- sim/
> >     `-- bfin/
> >         `-- run
> > build-frv-elf/
> > `-- sim/
> >     `-- frv/
> >         `-- run
> > 
> > sim/testsuite/frv/*.exp files need to know to look for $(builddir)/frv/run
> > while sim/testsuite/bfin/*.exp files need $(builddir)/bfin/run.
> > 
> > i know the variable is called $arch and that can be confusing.  i could
> > rename it if it helps.  just keep in mind that this is used for exactly
> > one thing: where to find `run` under $(builddir)/.
> > 
> > when we invoke dejagnu, it was with --tool=sim.  if we had combined trees
> > with other tools (gas/gdb/etc...), this would make sense, but it doesn't,
> > so we changed it to --tool="".  now when you run `runtest`, it will find
> > all *.exp files under sim/testsuite/ and attempt to execute them.
> 
> OK.  I don't understand why changing tool from "sim" to "" is either
> necessary, or a good thing, but, whatever....

i covered that here:
https://sourceware.org/pipermail/gdb/2021-January/049098.html
https://sourceware.org/pipermail/gdb-patches/2021-January/175115.html

> For gdb we have a 'gdb_init' proc, which is called based on
> '${tool}_init' from within GDB.  Now that we have no tool set does
> this prevent us having an 'init' proc?

it does not mean that.  we have `sim_init` in lib/sim-defs.exp and it is
still called via config/default.exp.

(i'll delete the part of your email below that talks about not having it)

> Lets assume for one moment that we _did_ have an init proc.  Could
> that proc not just have one huge [istarget ???] { set arch ... } tree
> that handled all known istarget patterns?

we could do that.  i don't think that's better than what i'm proposing
with setting the arch in the <arch>/ subdirs.  it seems slightly worse
because the [istarget ???] patterns that we use in the <arch>/ subdirs
need to be replicated -- some have a 1-to-many map of arch-to-targets.
although we can prob have the centralized logic use target mappings that
capture more than necessary as long as it's still unique between each
other.  e.g. we can glob cris* even though the cris port itself uses
cris-*-* & crisv32-*-*.

imo, this is the wrong direction: anytime we have a centralized place
where we have arch-specific logic, we're doing it wrong.  we already
have a centralized list today that i want to move away from.  the
sim/configure.tgt is setting up $arch based on the target.  but it
doesn't work when doing multi-target (--enable-targets=all) because
there isn't a single port testsuite to bind to, hence it needs a new
home.

> I think you say that right now we have pretty much one test script for
> each arch, but there's no reason which this has to be the case
> forever, right?

correct.  but i don't see how that's necessarily relevant to this thread.
even if we were to fragment the arch .exp files (somewhat akin to what
gdb does with some of its testsuites), we would still be able to have
each port share a common file (e.g. testsuite/bfin/common.exp) where we
could put the arch-specific settings.

on a related note, imo, dejagnu is a dead end.  Ian wrote a good post:
https://www.airs.com/blog/archives/499

but dejagnu is even more unnecessary for the sim as we have no need for
any of the target hooks.  e.g. the ability for people to say "in order
to execute this program, copy the file to this remote system, then ssh
over to it, and run it like so".  those are useful to gas, gdb, etc...
but would never be used by the sim.  so really we should be looking at
throwing out dejagnu entirely from the sim and switching to something
like automake's builtin test runners.  we use this in some projects in
the tree already when the test does not require any target execution.

> It just seems weird to me to say that each test is required to start
> with a highly predictable bit of boiler plate...

i don't disagree.  but to be clear, i don't see any of this as the end
state long term.  this is all intermediate steps for a better future.
sometimes that process means taking on a little tech debt to unblock
the next step, and then slowly collapsing that back as the common code
improves.  so here we're taking a configure-time constant that locks
the testsuite to a single specific target and moving it to the tests.
then as we unify the sim ports into a single build, we'd delete the
setting from their testsuites in the process.
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-31 19:41           ` Mike Frysinger
@ 2021-02-06 17:16             ` Mike Frysinger
  2021-02-08 12:12             ` Andrew Burgess
  1 sibling, 0 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-02-06 17:16 UTC (permalink / raw)
  To: andrew.burgess; +Cc: gdb-patches

this make sense ?
-mike

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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-01-31 19:41           ` Mike Frysinger
  2021-02-06 17:16             ` Mike Frysinger
@ 2021-02-08 12:12             ` Andrew Burgess
  2021-02-09  5:25               ` Mike Frysinger
  1 sibling, 1 reply; 19+ messages in thread
From: Andrew Burgess @ 2021-02-08 12:12 UTC (permalink / raw)
  To: gdb-patches

* Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> [2021-01-31 14:41:17 -0500]:

> On 31 Jan 2021 10:54, Andrew Burgess wrote:
> > * Mike Frysinger <vapier@gentoo.org> [2021-01-22 01:36:05 -0500]:
> > > On 21 Jan 2021 09:22, Andrew Burgess wrote:
> > > > * Mike Frysinger <vapier@gentoo.org> [2021-01-18 13:01:53 -0500]:
> > > > > On 18 Jan 2021 09:52, Andrew Burgess wrote:
> > > > > > * Mike Frysinger [2021-01-17 11:09:45 -0500]:
> > > > > > > This is needed to move to automake & its dejagnu-provided logic,
> > > > > > > and eventually by the unified sim logic.
> > > > > > 
> > > > > > I looked through this patch and I didn't understand what's going on
> > > > > > here.
> > > > > > 
> > > > > > If this needs doing at all, could it not be done in some global location?
> > > > > 
> > > > > the sim ports use a unique subdir for their `run` program.  the tests
> > > > > need to find that path.  this $arch value is what binds the specific
> > > > > subdir to the test.
> > > > 
> > > > I don't understand that paragraph I'm afraid.
> > > > 
> > > > I guess my question is each *.exp file gets invoked by dejagnu, but
> > > > there are other hooks that dejagnu calls, like the ${tool}_init proc.
> > > > Could we not use that to set these things instead?  It seems like
> > > > there's a 1:1 mapping between [istarget ????] patterns and the values
> > > > pushed into both arch and all_machs.
> > > 
> > > i'm not seeing how any hooks would help.  the targets need to know where
> > > their sim program lives.  let me brain dump on you :p.
> > > 
> > > lets look at a bfin & frv build tree.
> > > build-bfin-elf/
> > > `-- sim/
> > >     `-- bfin/
> > >         `-- run
> > > build-frv-elf/
> > > `-- sim/
> > >     `-- frv/
> > >         `-- run
> > > 
> > > sim/testsuite/frv/*.exp files need to know to look for $(builddir)/frv/run
> > > while sim/testsuite/bfin/*.exp files need $(builddir)/bfin/run.
> > > 
> > > i know the variable is called $arch and that can be confusing.  i could
> > > rename it if it helps.  just keep in mind that this is used for exactly
> > > one thing: where to find `run` under $(builddir)/.
> > > 
> > > when we invoke dejagnu, it was with --tool=sim.  if we had combined trees
> > > with other tools (gas/gdb/etc...), this would make sense, but it doesn't,
> > > so we changed it to --tool="".  now when you run `runtest`, it will find
> > > all *.exp files under sim/testsuite/ and attempt to execute them.
> > 
> > OK.  I don't understand why changing tool from "sim" to "" is either
> > necessary, or a good thing, but, whatever....
> 
> i covered that here:
> https://sourceware.org/pipermail/gdb/2021-January/049098.html
> https://sourceware.org/pipermail/gdb-patches/2021-January/175115.html
> 
> > For gdb we have a 'gdb_init' proc, which is called based on
> > '${tool}_init' from within GDB.  Now that we have no tool set does
> > this prevent us having an 'init' proc?
> 
> it does not mean that.  we have `sim_init` in lib/sim-defs.exp and it is
> still called via config/default.exp.
> 
> (i'll delete the part of your email below that talks about not having it)
> 
> > Lets assume for one moment that we _did_ have an init proc.  Could
> > that proc not just have one huge [istarget ???] { set arch ... } tree
> > that handled all known istarget patterns?
> 
> we could do that.  i don't think that's better than what i'm proposing
> with setting the arch in the <arch>/ subdirs.  it seems slightly worse
> because the [istarget ???] patterns that we use in the <arch>/ subdirs
> need to be replicated -- some have a 1-to-many map of arch-to-targets.
> although we can prob have the centralized logic use target mappings that
> capture more than necessary as long as it's still unique between each
> other.  e.g. we can glob cris* even though the cris port itself uses
> cris-*-* & crisv32-*-*.
> 
> imo, this is the wrong direction: anytime we have a centralized place
> where we have arch-specific logic, we're doing it wrong.  we already
> have a centralized list today that i want to move away from.  the
> sim/configure.tgt is setting up $arch based on the target.  but it
> doesn't work when doing multi-target (--enable-targets=all) because
> there isn't a single port testsuite to bind to, hence it needs a new
> home.
> 
> > I think you say that right now we have pretty much one test script for
> > each arch, but there's no reason which this has to be the case
> > forever, right?
> 
> correct.  but i don't see how that's necessarily relevant to this thread.
> even if we were to fragment the arch .exp files (somewhat akin to what
> gdb does with some of its testsuites), we would still be able to have
> each port share a common file (e.g. testsuite/bfin/common.exp) where we
> could put the arch-specific settings.
> 
> on a related note, imo, dejagnu is a dead end.  Ian wrote a good post:
> https://www.airs.com/blog/archives/499
> 
> but dejagnu is even more unnecessary for the sim as we have no need for
> any of the target hooks.  e.g. the ability for people to say "in order
> to execute this program, copy the file to this remote system, then ssh
> over to it, and run it like so".  those are useful to gas, gdb, etc...
> but would never be used by the sim.  so really we should be looking at
> throwing out dejagnu entirely from the sim and switching to something
> like automake's builtin test runners.  we use this in some projects in
> the tree already when the test does not require any target execution.
> 
> > It just seems weird to me to say that each test is required to start
> > with a highly predictable bit of boiler plate...
> 
> i don't disagree.  but to be clear, i don't see any of this as the end
> state long term.  this is all intermediate steps for a better future.
> sometimes that process means taking on a little tech debt to unblock
> the next step, and then slowly collapsing that back as the common code
> improves.  so here we're taking a configure-time constant that locks
> the testsuite to a single specific target and moving it to the tests.
> then as we unify the sim ports into a single build, we'd delete the
> setting from their testsuites in the process.

Thanks for the explanation.

I don't really understand what your end vision is.

I don't agree that this is the right intermediate state to move to.
Sure, sometimes things have to get worse before they can get better,
but this feels like an even stronger argument for putting all of the
"worse" into a single central location, rather than replicating it all
over the place.

** BUT **

Given you clearly have more time for sim/ right now I think you should
just commit this and move on, I suspect we're never going to agree on
this one, and as its just an opinion thing I don't see the point in
arguing it any further.

If this ever causes problems in the future we just revisit this
conversation at that point :)

Thanks for taking to time to explain your position, I do appreciate
it.

Thanks,
Andrew


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

* Re: [PATCH] sim: testsuite: push $arch out to targets
  2021-02-08 12:12             ` Andrew Burgess
@ 2021-02-09  5:25               ` Mike Frysinger
  0 siblings, 0 replies; 19+ messages in thread
From: Mike Frysinger @ 2021-02-09  5:25 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

On 08 Feb 2021 12:12, Andrew Burgess wrote:
> I don't really understand what your end vision is.

my ultimate end point has a number of features:
* one sim/configure script (no subdir configures)
* no recursive make (e.g. sim/Makefile.am includes sim/<port>/*.mk)
* a single `run` program that optionally supports all arches
* removal of all target tuple checking everywhere (other than the
  sim/configure.ac for selecting which ports to enable)
* a parallel testsuite
  * no dejagnu
  * uses automake's test harness
* all ports using common/ modules for functionality instead of their
  own ad-hoc implementations (e.g. memory from sim-core instead of
  the port doing its own malloc)

the benefits of this:
* faster build & test for all configurations
* support for --enable-targets=all like gdb and other projects already
  support so they can do a single binary build for different targets
* easier build tests for us as we don't need 30+ separate build dirs
  when we want to change common sim code, just a single build dir
* reduction in duplication & effort so we don't have to maintain all
  the various ad-hoc implementations of the same (functional) models
* easier for end users as they only need one `run` and not multiple
  ones to support every target
* reduction of hand curated build files -- automake's Makefile.am is
  much smaller than our hand-written Makefile.in's today

but i can't do this all at once, and tbh i don't have an exact road
map written out.  i have these high level goals in mind and that's
what i'm meandering towards piece by piece.  i try to always move
forward, but at worse, only move a bit laterally.

> I don't agree that this is the right intermediate state to move to.
> Sure, sometimes things have to get worse before they can get better,
> but this feels like an even stronger argument for putting all of the
> "worse" into a single central location, rather than replicating it all
> over the place.

in my final vision, neither of these things would exist which is why i'm
not super enthused about moving around the centralized logic.  i would
still want to throw it away eventually (given my end states above), so
doing it this way in the meantime seems fine to me.  the code is frozen
either way until it's deleted.

> Given you clearly have more time for sim/ right now I think you should
> just commit this and move on, I suspect we're never going to agree on
> this one, and as its just an opinion thing I don't see the point in
> arguing it any further.

hopefully the follow up improvements make it easier to live with some
of this tech debt in the interim.

> If this ever causes problems in the future we just revisit this
> conversation at that point :)

sure, life is fluid, and we should always adapt as makes sense
-mike

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

end of thread, other threads:[~2021-02-09  5:25 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 16:09 [PATCH] sim: testsuite: push $arch out to targets Mike Frysinger
2021-01-18  9:52 ` Andrew Burgess
2021-01-18 18:01   ` Mike Frysinger
2021-01-20 19:53     ` Tom Tromey
2021-01-21  0:37       ` Mike Frysinger
2021-01-22 16:29         ` Tom Tromey
2021-01-23  4:35           ` Mike Frysinger
2021-01-23 17:33             ` Tom Tromey
2021-01-25  5:34               ` Mike Frysinger
2021-01-21  9:22     ` Andrew Burgess
2021-01-22  6:36       ` Mike Frysinger
2021-01-31  1:27         ` Mike Frysinger
2021-01-31 10:54         ` Andrew Burgess
2021-01-31 19:41           ` Mike Frysinger
2021-02-06 17:16             ` Mike Frysinger
2021-02-08 12:12             ` Andrew Burgess
2021-02-09  5:25               ` Mike Frysinger
2021-01-18 17:54 ` [PATCH 1/2] sim: switch top level to automake Mike Frysinger
2021-01-18 17:54   ` [PATCH 2/2] sim: testsuite: merge into toplevel automake 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).