Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host
@ 2025-12-11 15:42 Tom de Vries
  2025-12-18 18:58 ` Tom Tromey
  2026-01-03 15:11 ` Tom de Vries
  0 siblings, 2 replies; 4+ messages in thread
From: Tom de Vries @ 2025-12-11 15:42 UTC (permalink / raw)
  To: gdb-patches

With host/target board local-remote-host-native.exp and other remote host
configurations, and test-case gdb.base/local-env.exp I get:
...
(gdb) show environment^M
  ...
(gdb) FAIL: $exp: show environment displayed variable
...

The test attempt to detect variable GDB_TEST_ENV_VAR in the environment, which
has been set with setenv.

This doesn't work with remote host, so declare the test unsupported.  Likewise
in gdb.base/environ.exp.

Tested on x86_64-linux with make-check-all.sh.
---
 gdb/testsuite/gdb.base/environ.exp   | 7 ++++++-
 gdb/testsuite/gdb.base/local-env.exp | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index 091010acfda..d95a6f7d03c 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -46,7 +46,12 @@ gdb_test_multiple "show environment" "show environment works" -lbl {
     }
 }
 
-gdb_assert {$saw_env == 1} "show environment displayed variable"
+set test "show environment displayed variable"
+if {[is_remote host]} {
+    unsupported $test
+} else {
+    gdb_assert {$saw_env == 1} $test
+}
 
 # Verify that we can unset a specific environment variable.
 gdb_test_no_output "unset environment EDITOR" "unset environment variable"
diff --git a/gdb/testsuite/gdb.base/local-env.exp b/gdb/testsuite/gdb.base/local-env.exp
index c62ea746635..394504cd79b 100644
--- a/gdb/testsuite/gdb.base/local-env.exp
+++ b/gdb/testsuite/gdb.base/local-env.exp
@@ -48,7 +48,12 @@ gdb_test_multiple "show environment" "show environment works" -lbl {
     }
 }
 
-gdb_assert {$saw_env == 1} "show environment displayed variable"
+set test "show environment displayed variable"
+if {[is_remote host]} {
+    unsupported $test
+} else {
+    gdb_assert {$saw_env == 1} $test
+}
 
 # Verify that we can unset a specific environment variable.
 gdb_test_no_output "unset local-environment EDITOR" \

base-commit: 4f9b9eaa24383d920f37fbeb0592113252e37bbc
-- 
2.51.0


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

* Re: [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host
  2025-12-11 15:42 [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host Tom de Vries
@ 2025-12-18 18:58 ` Tom Tromey
  2025-12-19  9:40   ` Tom de Vries
  2026-01-03 15:11 ` Tom de Vries
  1 sibling, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2025-12-18 18:58 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> This doesn't work with remote host, so declare the test unsupported.  Likewise
Tom> in gdb.base/environ.exp.

Tom> -gdb_assert {$saw_env == 1} "show environment displayed variable"
Tom> +set test "show environment displayed variable"
Tom> +if {[is_remote host]} {
Tom> +    unsupported $test
Tom> +} else {
Tom> +    gdb_assert {$saw_env == 1} $test

I've been under the impression we usually use unsupported to indicate
that an entire .exp is being skipped, and for individual tests we simply
don't invoke them.

However I guess I don't really know.  Do we have other cases like this?

Tom

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

* Re: [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host
  2025-12-18 18:58 ` Tom Tromey
@ 2025-12-19  9:40   ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2025-12-19  9:40 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 12/18/25 7:58 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> This doesn't work with remote host, so declare the test unsupported.  Likewise
> Tom> in gdb.base/environ.exp.
> 
> Tom> -gdb_assert {$saw_env == 1} "show environment displayed variable"
> Tom> +set test "show environment displayed variable"
> Tom> +if {[is_remote host]} {
> Tom> +    unsupported $test
> Tom> +} else {
> Tom> +    gdb_assert {$saw_env == 1} $test
> 
> I've been under the impression we usually use unsupported to indicate
> that an entire .exp is being skipped, 

Those uses indeed do exist.

> and for individual tests we simply
> don't invoke them.
> 
> However I guess I don't really know.  Do we have other cases like this?

Those uses also exist.

I grepped for unsupported in gdb.base, and the first two hits are like this.

In access-mem-running.exp, a proc test is run with non-stop and 
all-stop, and this code:
...
     # If debugging with target remote, check whether the all-stop 
variant
     # of the RSP is being used.  If so, we can't run the background 
tests.
     if {!$non_stop
         && [target_info exists gdb_protocol]
	&& ([target_info gdb_protocol] == "remote"
             || [target_info gdb_protocol] == "extended-remote")} {

         if {![is_target_non_stop]} {
             unsupported "can't issue commands while target is running"
	    return 0
         }
     }
...
aborts the proc in one of those cases.

Then in annota1.exp we have:
...
if {[target_info exists gdb,nosignals]} {
     unsupported "send SIGUSR1"
     unsupported "backtrace @ signal handler"
} else {
...

This one is from 2004.

Thanks,
- Tom

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

* Re: [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host
  2025-12-11 15:42 [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host Tom de Vries
  2025-12-18 18:58 ` Tom Tromey
@ 2026-01-03 15:11 ` Tom de Vries
  1 sibling, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-01-03 15:11 UTC (permalink / raw)
  To: gdb-patches

On 12/11/25 4:42 PM, Tom de Vries wrote:
> With host/target board local-remote-host-native.exp and other remote host
> configurations, and test-case gdb.base/local-env.exp I get:
> ...
> (gdb) show environment^M
>    ...
> (gdb) FAIL: $exp: show environment displayed variable
> ...
> 
> The test attempt to detect variable GDB_TEST_ENV_VAR in the environment, which
> has been set with setenv.
> 
> This doesn't work with remote host, so declare the test unsupported.  Likewise
> in gdb.base/environ.exp.
> 

I've pushed this.

Thanks,
- Tom

> Tested on x86_64-linux with make-check-all.sh.
> ---
>   gdb/testsuite/gdb.base/environ.exp   | 7 ++++++-
>   gdb/testsuite/gdb.base/local-env.exp | 7 ++++++-
>   2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
> index 091010acfda..d95a6f7d03c 100644
> --- a/gdb/testsuite/gdb.base/environ.exp
> +++ b/gdb/testsuite/gdb.base/environ.exp
> @@ -46,7 +46,12 @@ gdb_test_multiple "show environment" "show environment works" -lbl {
>       }
>   }
>   
> -gdb_assert {$saw_env == 1} "show environment displayed variable"
> +set test "show environment displayed variable"
> +if {[is_remote host]} {
> +    unsupported $test
> +} else {
> +    gdb_assert {$saw_env == 1} $test
> +}
>   
>   # Verify that we can unset a specific environment variable.
>   gdb_test_no_output "unset environment EDITOR" "unset environment variable"
> diff --git a/gdb/testsuite/gdb.base/local-env.exp b/gdb/testsuite/gdb.base/local-env.exp
> index c62ea746635..394504cd79b 100644
> --- a/gdb/testsuite/gdb.base/local-env.exp
> +++ b/gdb/testsuite/gdb.base/local-env.exp
> @@ -48,7 +48,12 @@ gdb_test_multiple "show environment" "show environment works" -lbl {
>       }
>   }
>   
> -gdb_assert {$saw_env == 1} "show environment displayed variable"
> +set test "show environment displayed variable"
> +if {[is_remote host]} {
> +    unsupported $test
> +} else {
> +    gdb_assert {$saw_env == 1} $test
> +}
>   
>   # Verify that we can unset a specific environment variable.
>   gdb_test_no_output "unset local-environment EDITOR" \
> 
> base-commit: 4f9b9eaa24383d920f37fbeb0592113252e37bbc


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

end of thread, other threads:[~2026-01-03 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-11 15:42 [PATCH] [gdb/testsuite] Fix gdb.base/local-env.exp on remote host Tom de Vries
2025-12-18 18:58 ` Tom Tromey
2025-12-19  9:40   ` Tom de Vries
2026-01-03 15:11 ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox