Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix command result testing in mi-complete.exp
Date: Tue, 23 Jul 2019 07:50:00 -0000	[thread overview]
Message-ID: <20190723075010.GA27426@delia> (raw)

Hi,

When running gdb.mi/mi-complete.exp in conjunction with:
...
$ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
...
we get less than 50% full passes:
...
$ for n in  $(seq 1 100); do \
    make V=1 -O check \
      'RUNTESTFLAGS=gdb.mi/mi-complete.exp --target_board=unix'; \
  done 2>&1 \
  | grep "expected passes" | sort | uniq -c
     45 # of expected passes            7
      9 # of expected passes            8
     46 # of expected passes            9
...

A diff between a passing and failing gdb.log shows this difference:
...
-&"set max-completions 1\n"
 2-complete br
+&"set max-completions 1\n"
...

The problem is that the test-case issues the "set max-completion <n>" command,
and without waiting for the output issues a next command, and tries to parse
the results of both commands, expecting a specific interleaving of the various
output streams.

Fix the FAIL by waiting for the result of the "set max-completion <n>" command
before issuing another command.

Tested on x86_64-linux.

OK for trunk?

Thanks,
- Tom

[gdb/testsuite] Fix command result testing in mi-complete.exp

gdb/testsuite/ChangeLog:

2019-07-23  Tom de Vries  <tdevries@suse.de>

	PR testsuite/24711
	* gdb.mi/mi-complete.exp: Wait for "set max-completions" result before
	issuing next command.

---
 gdb/testsuite/gdb.mi/mi-complete.exp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-complete.exp b/gdb/testsuite/gdb.mi/mi-complete.exp
index 692b004fd9..5b9613548f 100644
--- a/gdb/testsuite/gdb.mi/mi-complete.exp
+++ b/gdb/testsuite/gdb.mi/mi-complete.exp
@@ -58,14 +58,16 @@ mi_gdb_test "-info-gdb-mi-command complete" \
 
 # Limit max completions and check that max_completions_reached=\"0\" is set
 # to 1.
-send_gdb "set max-completions 1\n"
+mi_gdb_test "set max-completions 1" ".*=cmd-param-changed.*\\^done" \
+    "set max-completions 1"
 
 mi_gdb_test "2-complete br" \
             ".*2\\^done,completion=\"br\[A-Za-z0-9-\]+\",matches=\\\[\"br\[A-Za-z0-9-\]+\"\\\],max_completions_reached=\"1\"" \
             "-complete br, max-completions 1"
 
 # Disable completions and check an error is returned
-send_gdb "set max-completions 0\n"
+mi_gdb_test "set max-completions 0" ".*=cmd-param-changed.*\\^done" \
+    "set max-completions 0"
 
 mi_gdb_test "3-complete br" \
             ".*3\\^error,msg=\".*" \


             reply	other threads:[~2019-07-23  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23  7:50 Tom de Vries [this message]
2019-07-23  8:26 ` Andrew Burgess

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=20190723075010.GA27426@delia \
    --to=tdevries@suse.de \
    --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