Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 14/24] Make gdb.base/call-rt-st.exp use $inferior_spawn_id
Date: Tue, 21 Apr 2015 18:09:00 -0000	[thread overview]
Message-ID: <1429639711-16459-15-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1429639711-16459-1-git-send-email-palves@redhat.com>

gdb/testsuite/ChangeLog:
2015-04-21  Pedro Alves  <palves@redhat.com>

	* gdb.base/call-rt-st.exp (print_struct_call): Split "result"
	parameter into two new parameters, "inf_result" and "gdb_result".
	Expect inferior output and gdb output from $inferior_spawn_id and
	$gdb_spawn_id, respectively.  Adjust all callers.
---
 gdb/testsuite/gdb.base/call-rt-st.exp | 61 ++++++++++++++++++++++++++---------
 1 file changed, 46 insertions(+), 15 deletions(-)

diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 36d81fb..46cdfa9 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -87,76 +87,107 @@ gdb_test_multiple "finish" "finish out from loop count" {
 # return value unknown", call that an `unsupported' test; on some
 # architectures, it's impossible to find structs returned by value
 # reliably.
-proc print_struct_call { expr result } {
+proc print_struct_call { expr inf_result gdb_result } {
     global gdb_prompt
+    global inferior_spawn_id gdb_spawn_id
+
+    set inferior_matched 0
+    set gdb_matched 0
 
     set command "print $expr"
     gdb_test_multiple "${command}" "${command}" {
-        -re "$result\[\r\n\]+$gdb_prompt $" {
-            pass "$command"
-        }
+	-i $inferior_spawn_id
+	-re "$inf_result" {
+	    set inferior_matched 1
+	    if {!$gdb_matched} {
+		exp_continue
+	    }
+	}
+
+	-i $gdb_spawn_id
+	-re "$gdb_result\r\n$gdb_prompt $" {
+	    set gdb_matched 1
+	    if {!$inferior_matched} {
+		exp_continue
+	    }
+	}
         -re "Function return value unknown.\[\r\n\]+$gdb_prompt $" {
             unsupported "$command"
+	    return
         }
     }
+
+    verbose -log "inferior_matched=$inferior_matched, gdb_matched=$gdb_matched"
+    gdb_assert {$inferior_matched && $gdb_matched} $command
 }
 
 
 if ![gdb_skip_stdio_test "print print_struct_rep(*struct1)"] {
     print_struct_call "print_struct_rep(*struct1)" \
-            ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+.\[0-9\]+ = \\{value = 5, head = 0\\}"
+	".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+" \
+	".\[0-9\]+ = \\{value = 5, head = 0\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
     print_struct_call "print_one_large_struct(*list1)" \
-            ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+.\[0-9\]+ = \\{next_index = \\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\}, values = \\{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\\}, head = 0\\}"
+	".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+" \
+	".\[0-9\]+ = \\{next_index = \\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\}, values = \\{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\\}, head = 0\\}"
 }
 
 if {![gdb_skip_float_test "print print_one_double(*d1)"] && \
         ![gdb_skip_stdio_test "print print_one_double(*d1)"] } {
     print_struct_call "print_one_double(*d1)" \
-	    ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \\{double1 = 1\\.111\[0-9\]*\\}"
+	".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+" \
+	".\[0-9\]+ = \\{double1 = 1\\.111\[0-9\]*\\}"
 }
 
 if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \
         ![gdb_skip_stdio_test "print print_two_floats(*f3)"] } {
     print_struct_call "print_two_floats(*f3)" \
-            ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
+	".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+" \
+	".\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] {
     print_struct_call "print_bit_flags_char(*cflags)" \
-            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\000', gamma = 1 '\\\\001', delta = 0 '\\\\000', epsilon = 1 '\\\\001', omega = 0 '\\\\000'\\}"
+	".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
+	".\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\000', gamma = 1 '\\\\001', delta = 0 '\\\\000', epsilon = 1 '\\\\001', omega = 0 '\\\\000'\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] {
     print_struct_call "print_bit_flags_short(*sflags)" \
-            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
+	".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
+	".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] {
     print_struct_call "print_bit_flags(*flags)" \
-            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
+	".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
+	".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"] {
     print_struct_call "print_bit_flags_combo(*flags_combo)" \
-            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\\}"
+	".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+" \
+	".\[0-9\]+ = \\{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_three_chars(*three_chars)"] {
     print_struct_call "print_three_chars(*three_char)" \
-            ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+.\[0-9\]+ = \\{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\\}"
+	".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+" \
+	".\[0-9\]+ = \\{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_five_chars(*five_chars)"] {
     print_struct_call "print_five_chars(*five_char)" \
-            ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+.\[0-9\]+ = \\{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\\}"
+	".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+" \
+	".\[0-9\]+ = \\{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"] {
     print_struct_call "print_int_char_combo(*int_char_combo)" \
-            ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+.\[0-9\]+ = \\{int1 = 13, ch1 = 33 '!'\\}"
+	".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+" \
+	".\[0-9\]+ = \\{int1 = 13, ch1 = 33 '!'\\}"
 }
 
 return
-- 
1.9.3


  parent reply	other threads:[~2015-04-21 18:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 18:08 [PATCH 00/24] Remove gdb,noinferiorio from gdbserver boards Pedro Alves
2015-04-21 18:08 ` [PATCH 10/24] Make gdb.base/catch-gdb-caused-signals.exp use gdb_test_stdio Pedro Alves
2015-04-21 18:08 ` [PATCH 07/24] Introduce gdb_test_stdio Pedro Alves
2015-04-21 18:08 ` [PATCH 13/24] Make gdb.base/call-ar-st.exp use gdb_test_stdio Pedro Alves
2015-04-21 18:08 ` [PATCH 12/24] Make gdb.base/a2-run.exp use $inferior_spawn_id and gdb_test_stdio Pedro Alves
2015-04-21 18:08 ` [PATCH 01/24] gdb_test_multiple match eof of any spawn_id Pedro Alves
2015-04-21 18:08 ` [PATCH 16/24] Make gdb.base/shlib-call.exp use gdb_test_stdio Pedro Alves
2015-04-21 18:08 ` [PATCH 04/24] Don't rely on inferior I/O in gdb.base/siginfo-addr.exp Pedro Alves
2015-04-21 18:09 ` [PATCH 19/24] Make gdb.gdb/selftest.exp use '-i $inferior_spawn_id' Pedro Alves
2015-04-21 18:09 ` [PATCH 11/24] Make gdb.base/dprintf.exp use gdb_test_stdio Pedro Alves
2015-04-21 18:09 ` [PATCH 24/24] Don't set gdb,noinferiorio on gdbserver boards Pedro Alves
2015-04-23 15:09   ` Yao Qi
2015-04-23 15:24     ` Pedro Alves
2015-04-24  9:19       ` Yao Qi
2015-04-21 18:09 ` [PATCH 03/24] Fix gdb.base/interrupt.exp racy fail against gdbserver Pedro Alves
2015-04-23 14:28   ` Yao Qi
2015-04-23 14:58     ` Pedro Alves
2015-04-21 18:09 ` [PATCH 22/24] Unbuffer all tests that rely on stdio Pedro Alves
2015-04-21 18:09 ` [PATCH 06/24] Don't rely on inferior I/O in gdb.base/restore.exp Pedro Alves
2015-04-21 18:09 ` Pedro Alves [this message]
2015-04-21 18:09 ` [PATCH 17/24] Make gdb.base/varargs.exp use gdb_test_stdio Pedro Alves
2015-04-21 18:09 ` [PATCH 20/24] Adjust MI to $inferior_spawn_id Pedro Alves
2015-04-21 18:09 ` [PATCH 09/24] Make gdb.base/call-strs.exp use gdb_test_stdio Pedro Alves
2015-04-21 18:09 ` [PATCH 21/24] Make gdb.mi/mi-dprintf.exp use $inferior_spawn_id Pedro Alves
2015-04-21 18:09 ` [PATCH 05/24] Don't rely on inferior I/O in {call-signal-resume, unwindonsignal}.exp Pedro Alves
2015-04-21 18:09 ` [PATCH 02/24] gdb.base/interrupt.exp: Rename saw_eof to saw_end_of_file Pedro Alves
2015-04-21 18:09 ` [PATCH 23/24] interrupt.exp: Revert back to checking gdb,noinferiorio at the top Pedro Alves
2015-04-21 18:15 ` [PATCH 08/24] Make gdb.base/sizeof.exp use gdb_test_stdio Pedro Alves
2015-04-23 15:36   ` Antoine Tremblay
2015-04-23 15:38     ` Antoine Tremblay
2015-04-23 15:49       ` Pedro Alves
2015-04-23 16:04         ` Pedro Alves
2015-04-23 16:25           ` Antoine Tremblay
2015-04-21 18:18 ` [PATCH 18/24] Make gdb.gdb/complaints.exp use '-i $inferior_spawn_id' and gdb_test_stdio Pedro Alves
2015-04-21 18:43 ` [PATCH 15/24] Make gdb.base/ending-run.exp use gdb_test_stdio Pedro Alves
2015-07-29 11:41 ` [PATCH 00/24] Remove gdb,noinferiorio from gdbserver boards Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429639711-16459-15-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox