https://gcc.gnu.org/g:62c33661c076f739df3923c5a3ecf7d66d648591

commit r16-6985-g62c33661c076f739df3923c5a3ecf7d66d648591
Author: Hans-Peter Nilsson <[email protected]>
Date:   Tue Jan 20 19:20:39 2026 +0100

    testsuite: Fix issues with simulator testing in guality, simulate-thread 
tests
    
    The guality and simulate-thread tests expect a native gdb to
    run.  That's native as in "<simulator-command-name> gdb
    <prog-to-test>", not as in "<cross-name-gdb> <prog-to-test>"
    (or even a cross gdb connecting to a native gdb-stub).  Such
    a beast does not currently exist.
    
    Before r16-6780-g620c85fb709d27, there was an early exit for
    "remote targets" such as simulator targets in gdb-test.  No
    test attempting to run a "native" gdb was applied to a
    simulator target.
    
    There's a wart in dejagnu sim_exec (up to and including
    1.6.3 and unreleased sources as of 2026-01-20) that, instead
    of returning [list -1 "error message"], it (also) calls
    perror and thus a log for a test-run gets spurious lines
    saying "ERROR: Remote execution for simulators not
    implemented." That effectively breaks the useful quality for
    such logs, that lines matching "^ERROR:" are only caused by
    testsuite framework errors, like syntax errors in dg-clauses
    in the test-cases.
    
    Further, trying like gdb-test does, to execute remote_expect
    for a remote_spawn:ed (sim_spawn:ed) "<simulator-command>
    gdb <prog-to-test>", will for unknown reasons, hang each
    test-case until it times out, despite the simulator, as
    expected, immediately exiting with
    e.g. '<simulator-command-name>: can't open "gdb": No such
    file or directory'.
    
    Better exit early for simulators for these parts of the
    testsuite, like before r16-6780-g620c85fb709d27, but with
    the early exit moved nearby those for other early exits for
    specific targets, instead of e.g. inside gdb-test.
    
            * g++.dg/guality/guality.exp, gcc.dg/guality/guality.exp,
            gcc.dg/simulate-thread/simulate-thread.exp,
            g++.dg/simulate-thread/simulate-thread.exp,
            gfortran.dg/guality/guality.exp: Exit early for simulators.

Diff:
---
 gcc/testsuite/g++.dg/guality/guality.exp                 | 4 ++++
 gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp | 4 ++++
 gcc/testsuite/gcc.dg/guality/guality.exp                 | 4 ++++
 gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.exp | 4 ++++
 gcc/testsuite/gfortran.dg/guality/guality.exp            | 4 ++++
 5 files changed, 20 insertions(+)

diff --git a/gcc/testsuite/g++.dg/guality/guality.exp 
b/gcc/testsuite/g++.dg/guality/guality.exp
index 695ed02b89bb..a46f8465a33c 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -8,6 +8,10 @@ if { [istarget *-*-darwin*] } {
     return
 }
 
+if { [check_effective_target_simulator] } {
+    return
+}
+
 if { [istarget hppa*-*-hpux*] } {
     return
 }
diff --git a/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp 
b/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp
index 29d5bfc75d70..2dc5decd5eac 100644
--- a/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp
+++ b/gcc/testsuite/g++.dg/simulate-thread/simulate-thread.exp
@@ -21,6 +21,10 @@ load_lib g++-dg.exp
 load_lib gcc-simulate-thread.exp
 load_lib torture-options.exp
 
+if { [check_effective_target_simulator] } {
+    return
+}
+
 dg-init
 torture-init
 set-torture-options [list \
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp 
b/gcc/testsuite/gcc.dg/guality/guality.exp
index 4d342aa51658..5c892c15479f 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -8,6 +8,10 @@ if { [istarget *-*-darwin*] } {
     return
 }
 
+if { [check_effective_target_simulator] } {
+    return
+}
+
 if { [istarget hppa*-*-hpux*] } {
     return
 }
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.exp 
b/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.exp
index 9090d5d3796a..8664019d88a4 100644
--- a/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.exp
+++ b/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.exp
@@ -20,6 +20,10 @@ load_lib gcc-dg.exp
 load_lib gcc-simulate-thread.exp
 load_lib torture-options.exp
 
+if { [check_effective_target_simulator] } {
+    return
+}
+
 if { [istarget "powerpc-ibm-aix*"] } {
     set torture_execute_xfail "powerpc-ibm-aix*"
     return
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp 
b/gcc/testsuite/gfortran.dg/guality/guality.exp
index 3ee157abf7b3..dddbe8b02f56 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -8,6 +8,10 @@ if { [istarget *-*-darwin*] } {
   return
 }
 
+if { [check_effective_target_simulator] } {
+    return
+}
+
 if { [istarget hppa*-*-hpux*] } {
     return
 }

Reply via email to