mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
5ba2943476
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. 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.
75 lines
2.7 KiB
Plaintext
75 lines
2.7 KiB
Plaintext
# Copyright 2018-2019 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Verify GDB/MI -complete in various scenarios. This test only tests
|
|
# -complete command, not the correctness of completions.
|
|
|
|
load_lib mi-support.exp
|
|
set MIFLAGS "-i=mi"
|
|
|
|
gdb_exit
|
|
if [mi_gdb_start] {
|
|
continue
|
|
}
|
|
|
|
standard_testfile .cc
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
|
untested "failed to compile"
|
|
return -1
|
|
}
|
|
|
|
mi_run_to_main
|
|
|
|
mi_gdb_test "1-complete br" \
|
|
"1\\^done,completion=\"break\",matches=\\\[.*\"break\",.*\"break-range\".*\\\],max_completions_reached=\"0\"" \
|
|
"-complete br"
|
|
|
|
# Check empty completion list.
|
|
mi_gdb_test "5-complete bogus" \
|
|
"5\\^done,matches=\\\[\\\],max_completions_reached=\"0\"" \
|
|
"-complete bogus"
|
|
|
|
# Check completions for commands with space.
|
|
mi_gdb_test "4-complete \"b mai\"" \
|
|
"4\\^done,completion=\"b main\",matches=\\\[.*\"b main\".*\\\],max_completions_reached=\"0\"" \
|
|
"-complete \"b mai\""
|
|
|
|
# Check wildmatching.
|
|
mi_gdb_test "5-complete \"b push_ba\"" \
|
|
"5\\^done,completion=\"b push_back\\(\",matches=\\\[.*\"b A::push_back\\(void\\*\\)\".*\\\],max_completions_reached=\"0\"" \
|
|
"-complete \"b push_ba\", wildmatching"
|
|
|
|
mi_gdb_test "-info-gdb-mi-command complete" \
|
|
"\\^done,command=\{exists=\"true\"\}" \
|
|
"-info-gdb-mi-command complete"
|
|
|
|
# Limit max completions and check that max_completions_reached=\"0\" is set
|
|
# to 1.
|
|
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
|
|
mi_gdb_test "set max-completions 0" ".*=cmd-param-changed.*\\^done" \
|
|
"set max-completions 0"
|
|
|
|
mi_gdb_test "3-complete br" \
|
|
".*3\\^error,msg=\".*" \
|
|
"-complete br, max-completions 0"
|