binutils-gdb/gdb/testsuite/gdb.cp/virtbase2.exp
Luis Machado c2b750436a Fix some duplicate test names
While doing a testsuite run on aarch64-linux, I noticed a bunch of duplicated
test name results. It annoyed me a little, so I decided to go ahead and fix the
worst offenders.

The following patch brings the duplicate test names down from 461 to 137.

The remaining ones are mostly scattered across the testsuite, with 1 to 3
duplicates per testcase. We can fix those as we go.

gdb/testsuite/ChangeLog:

2020-05-27  Luis Machado  <luis.machado@linaro.org>

	* gdb.arch/aarch64-sighandler-regs.exp: Fix duplicated test names.
	* gdb.arch/aarch64-tagged-pointer.exp: Likewise.
	* gdb.arch/arm-disassembler-options.exp: Likewise.
	* gdb.arch/arm-disp-step.exp: Likewise.
	* gdb.arch/thumb-prologue.exp: Likewise.
	* gdb.base/async.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/complex-parts.exp: Likewise.
	* gdb.base/ena-dis-br.exp: Likewise.
	* gdb.base/foll-exec.exp: Likewise.
	* gdb.base/permissions.exp: Likewise.
	* gdb.base/relocate.exp: Likewise.
	* gdb.base/return2.exp: Likewise.
	* gdb.base/sigbpt.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.cp/converts.exp: Likewise.
	* gdb.cp/exceptprint.exp: Likewise.
	* gdb.cp/inherit.exp: Likewise.
	* gdb.cp/nsnoimports.exp: Likewise.
	* gdb.cp/virtbase2.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/var-cmd.c: Likewise.
2020-05-27 09:24:09 -03:00

118 lines
3.4 KiB
Plaintext

# Copyright 2018-2020 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/>.
# Make sure printing virtual base class data member works correctly (PR16841)
if { [skip_cplus_tests] } { continue }
standard_testfile .cc
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
if {![runto_main]} then {
perror "couldn't run to main"
continue
}
# From a list of nested scopes, generate all possible ways of accessing something
# in those scopes. For example, with the argument {foo bar baz}, this proc will
# return:
# - {} (empty string)
# - baz::
# - bar::
# - bar::baz::
# - foo::
# - foo::baz::
# - foo::bar::
# - foo::bar::baz::
proc make_scope_list { scopes } {
if { [llength $scopes] == 1 } {
return [list "" "${scopes}::"]
}
# Pop the first element, save the first scope.
set this_scope [lindex $scopes 0]
set scopes [lreplace $scopes 0 0]
set child_result [make_scope_list $scopes]
# Add a copy of the child's result without this scope...
set result $child_result
# ... and a copy of the child's result with this scope.
foreach r $child_result {
lappend result "${this_scope}::$r"
}
return $result
}
proc test_variables_in_base { scopes } {
with_test_prefix "$scopes" {
foreach scope [make_scope_list $scopes] {
gdb_test "print ${scope}i" " = 55"
gdb_test "print ${scope}d" " = 6.25"
gdb_test "print ${scope}x" " = 22"
}
}
}
proc test_variables_in_superbase { scopes } {
with_test_prefix "$scopes" {
foreach scope [make_scope_list $scopes] {
gdb_test "print ${scope}x" " = 22"
}
}
}
proc test_variables_in_super { scopes } {
with_test_prefix "$scopes" {
foreach scope [make_scope_list $scopes] {
gdb_test "print ${scope}w" " = 17"
}
}
}
with_test_prefix "derived::func_d" {
gdb_breakpoint "derived::func_d"
gdb_continue_to_breakpoint "continue to derived::func_d"
test_variables_in_base {derived base}
test_variables_in_superbase {derived base superbase}
test_variables_in_superbase {base superbase}
test_variables_in_superbase {derived superbase}
test_variables_in_superbase {superbase}
test_variables_in_superbase {base}
test_variables_in_super {super}
test_variables_in_super {derived super}
}
with_test_prefix "foo::func_f" {
gdb_breakpoint "foo::func_f"
gdb_continue_to_breakpoint "continue to foo::func_f"
test_variables_in_base {foo derived base}
test_variables_in_base {foo base}
test_variables_in_base {base}
test_variables_in_superbase {superbase}
test_variables_in_superbase {foo superbase}
test_variables_in_superbase {foo derived superbase}
test_variables_in_superbase {foo derived base superbase}
test_variables_in_super {super}
test_variables_in_super {foo super}
test_variables_in_super {foo derived super}
}