binutils-gdb/gdb/testsuite/gdb.python/py-cmd-prompt.exp
Andrew Burgess b5c7f1fd7b gdb/testsuite: don't include port numbers in test names
The gdb.python/py-cmd-prompt.exp script includes a test that has a
gdbserver port number within a test name.  As port numbers can change
from one test run to the next (depending on what else is running on
the machine at the time), this can make it hard to compare test
results between runs.

Give the test a specific name to avoid including the port number.

There is no change in what is tested after this commit.
2024-03-29 22:28:44 +00:00

57 lines
1.8 KiB
Plaintext

# Copyright (C) 2023-2024 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/>.
# This file is part of the GDB testsuite. It tests a corner case
# where the executed GDB command enables the stdin while running
# inside a synchronous command, causing the GDB prompt to be displayed
# prematurely.
load_lib gdb-python.exp
load_lib gdbserver-support.exp
# We use the start command.
require !use_gdb_stub
require allow_python_tests allow_gdbserver_tests
standard_testfile
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
set bp_line [gdb_get_line_number "break-here"]
gdb_breakpoint $bp_line
set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "source $pyfile" "source the script"
set gdbserver [gdbserver_start "" [standard_output_file $binfile]]
set gdbserver_gdbport [lindex $gdbserver 1]
gdb_test_no_output "python the_listener.port = '${gdbserver_gdbport}'" \
"set the_listener.port value"
gdb_run_cmd
gdb_test_multiple "" "prompt is positioned correctly" {
-re -wrap "break-here \[^\r\n\]+" {
pass $gdb_test_name
}
}
# Clean up the gdbserver.
gdb_test "inferior 2" "Switching to inferior 2.*" \
"switch to gdbserver for clean up"
gdbserver_exit 0