public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp
@ 2021-11-15 23:14 Tom de Vries
  2021-11-18 14:54 ` Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-11-15 23:14 UTC (permalink / raw)
  To: gdb-patches

On OBS I ran into:
...
(gdb) shell diff -s outputs/gdb.base/signals-state-child/standalone.txt \
  outputs/gdb.base/signals-state-child/gdb.txt^M
diff: outputs/gdb.base/signals-state-child/standalone.txt: \
  No such file or directory^M
(gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical
...

I managed to reproduce this by adding "sleep (5)" at the start of main in
signals-state-child.c.

Fix this by waiting on the result of the spawned command.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.base/signals-state-child.exp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp
index ce143b1509a..733d7cebd5a 100644
--- a/gdb/testsuite/gdb.base/signals-state-child.exp
+++ b/gdb/testsuite/gdb.base/signals-state-child.exp
@@ -69,9 +69,11 @@ set res [remote_spawn target "$binfile-standalone"]
 if { $res < 0 || $res == "" } {
     untested "spawning $binfile-standalone failed"
     return 1
-} else {
-    pass "collect standalone signals state"
 }
+
+set wait_status [remote_wait target 60]
+set have_standalone [expr [lindex $wait_status 0] == 0]
+gdb_assert { $have_standalone } "collect standalone signals state"
 remote_close target
 
 # Now run the program through gdb, and dump its initial signal actions
@@ -85,6 +87,12 @@ if { ! [ runto_main ] } then {
 
 gdb_continue_to_end "collect signals state under gdb"
 
+set test "signals states are identical"
+if { ! $have_standalone } {
+    untested $test
+    return -1
+}
+
 if {!$purely_local} {
     # Copy file from target to host through build.
     remote_download host [remote_upload target gdb.txt] gdb.txt
@@ -94,4 +102,4 @@ if {!$purely_local} {
 # Diff the .txt files.  They should be identical.
 gdb_test "shell diff -s $standalone_txt $gdb_txt" \
     "Files .* are identical.*" \
-    "signals states are identical"
+    $test

base-commit: 636ae5bb4b6b801f8bda05041f600cbf3945c147
-- 
2.26.2


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

* Re: [PATCH] [gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp
  2021-11-15 23:14 [PATCH] [gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp Tom de Vries
@ 2021-11-18 14:54 ` Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2021-11-18 14:54 UTC (permalink / raw)
  To: gdb-patches

On 11/16/21 12:14 AM, Tom de Vries via Gdb-patches wrote:
> On OBS I ran into:
> ...
> (gdb) shell diff -s outputs/gdb.base/signals-state-child/standalone.txt \
>   outputs/gdb.base/signals-state-child/gdb.txt^M
> diff: outputs/gdb.base/signals-state-child/standalone.txt: \
>   No such file or directory^M
> (gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical
> ...
> 
> I managed to reproduce this by adding "sleep (5)" at the start of main in
> signals-state-child.c.
> 
> Fix this by waiting on the result of the spawned command.
> 
> Tested on x86_64-linux.

Committed.

Thanks,
- Tom

> ---
>  gdb/testsuite/gdb.base/signals-state-child.exp | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp
> index ce143b1509a..733d7cebd5a 100644
> --- a/gdb/testsuite/gdb.base/signals-state-child.exp
> +++ b/gdb/testsuite/gdb.base/signals-state-child.exp
> @@ -69,9 +69,11 @@ set res [remote_spawn target "$binfile-standalone"]
>  if { $res < 0 || $res == "" } {
>      untested "spawning $binfile-standalone failed"
>      return 1
> -} else {
> -    pass "collect standalone signals state"
>  }
> +
> +set wait_status [remote_wait target 60]
> +set have_standalone [expr [lindex $wait_status 0] == 0]
> +gdb_assert { $have_standalone } "collect standalone signals state"
>  remote_close target
>  
>  # Now run the program through gdb, and dump its initial signal actions
> @@ -85,6 +87,12 @@ if { ! [ runto_main ] } then {
>  
>  gdb_continue_to_end "collect signals state under gdb"
>  
> +set test "signals states are identical"
> +if { ! $have_standalone } {
> +    untested $test
> +    return -1
> +}
> +
>  if {!$purely_local} {
>      # Copy file from target to host through build.
>      remote_download host [remote_upload target gdb.txt] gdb.txt
> @@ -94,4 +102,4 @@ if {!$purely_local} {
>  # Diff the .txt files.  They should be identical.
>  gdb_test "shell diff -s $standalone_txt $gdb_txt" \
>      "Files .* are identical.*" \
> -    "signals states are identical"
> +    $test
> 
> base-commit: 636ae5bb4b6b801f8bda05041f600cbf3945c147
> 

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

end of thread, other threads:[~2021-11-18 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 23:14 [PATCH] [gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp Tom de Vries
2021-11-18 14:54 ` 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).