]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.cp/inherit.exp
Fix some duplicate test names
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / inherit.exp
index fc5f2e28787f13b3fec37e21729c371ee4590583..59c72da6ae8645a4b50afd23b2f9e52d7491be6d 100644 (file)
@@ -1,5 +1,4 @@
-# Copyright 1992-1999, 2001-2004, 2006-2012 Free Software Foundation,
-# Inc.
+# Copyright 1992-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
@@ -27,7 +26,7 @@ load_lib "cp-support.exp"
 
 standard_testfile misc.cc
 
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
 
@@ -41,37 +40,37 @@ proc test_ptype_si { } {
     # A simple class.
 
     cp_test_ptype_class \
-       "ptype A" "ptype A (FIXME)" "class" "A" \
+       "A" "ptype A (FIXME)" "class" "A" \
        {
            { field public "int a;" }
            { field public "int x;" }
        }
-    cp_test_ptype_class "ptype class A" "ptype class A (FIXME)" "class" "A" ibid
-    cp_test_ptype_class "ptype g_A" "ptype g_A (FIXME)" "class" "A" ibid
+    cp_test_ptype_class "class A" "ptype class A (FIXME)" "class" "A" ibid
+    cp_test_ptype_class "g_A" "ptype g_A (FIXME)" "class" "A" ibid
 
     # A derived class.
 
     cp_test_ptype_class \
-       "ptype B" "" "class" "B" \
+       "B" "" "class" "B" \
        {
            { base         "public A" }
            { field public "int b;" }
            { field public "int x;" }
        }
-    cp_test_ptype_class "ptype class B" "" "class" "B" ibid
-    cp_test_ptype_class "ptype g_B" "" "class" "B" ibid
+    cp_test_ptype_class "class B" "" "class" "B" ibid
+    cp_test_ptype_class "g_B" "" "class" "B" ibid
 
     # Another derived class.
 
     cp_test_ptype_class \
-       "ptype C" "" "class" "C" \
+       "C" "" "class" "C" \
        {
            { base         "public A" }
            { field public "int c;" }
            { field public "int x;" }
        }
-    cp_test_ptype_class "ptype class C" "" "class" "C" ibid
-    cp_test_ptype_class "ptype g_C" "" "class" "C" ibid
+    cp_test_ptype_class "class C" "" "class" "C" ibid
+    cp_test_ptype_class "g_C" "" "class" "C" ibid
 
     # A structure with no tag.
     # TODO: move this mess into a separate file, and re-specify
@@ -146,27 +145,27 @@ proc test_ptype_mi { } {
     # A class with two bases.
 
     cp_test_ptype_class \
-       "ptype D" "" "class" "D" \
+       "D" "" "class" "D" \
        {
            { base         "public B" }
            { base         "public C" }
            { field public "int d;" }
            { field public "int x;" }
        }
-    cp_test_ptype_class "ptype class D" "" "class" "D" ibid
-    cp_test_ptype_class "ptype g_D" "" "class" "D" ibid
+    cp_test_ptype_class "class D" "" "class" "D" ibid
+    cp_test_ptype_class "g_D" "" "class" "D" ibid
 
     # A class derived from the previous class.
 
     cp_test_ptype_class \
-       "ptype E" "" "class" "E" \
+       "E" "" "class" "E" \
        {
            { base         "public D" }
            { field public "int e;" }
            { field public "int x;" }
        }
-    cp_test_ptype_class "ptype class E" "" "class" "E" ibid
-    cp_test_ptype_class "ptype g_E" "" "class" "E" ibid
+    cp_test_ptype_class "class E" "" "class" "E" ibid
+    cp_test_ptype_class "g_E" "" "class" "E" ibid
 }
 
 # Single virtual inheritance, print type definitions.
@@ -176,39 +175,39 @@ proc test_ptype_vi { } {
     # class vA
 
     cp_test_ptype_class \
-       "ptype vA" "" "class" "vA" \
+       "vA" "" "class" "vA" \
        {
            { field public "int va;" }
            { field public "int vx;" }
        }
-    cp_test_ptype_class "ptype class vA" "" "class" "vA" ibid
-    cp_test_ptype_class "ptype g_vA" "" "class" "vA" ibid
+    cp_test_ptype_class "class vA" "" "class" "vA" ibid
+    cp_test_ptype_class "g_vA" "" "class" "vA" ibid
 
     # class vB
 
     cp_test_ptype_class \
-       "ptype vB" "" "class" "vB" \
+       "vB" "" "class" "vB" \
        {
            { base         "public virtual vA" }
            { vbase        "vA" }
            { field public "int vb;" }
            { field public "int vx;" }
        }
-    cp_test_ptype_class "ptype class vB" "" "class" "vB" ibid
-    cp_test_ptype_class "ptype g_vB" "" "class" "vB" ibid
+    cp_test_ptype_class "class vB" "" "class" "vB" ibid
+    cp_test_ptype_class "g_vB" "" "class" "vB" ibid
 
     # class vC
 
     cp_test_ptype_class \
-       "ptype vC" "" "class" "vC" \
+       "vC" "" "class" "vC" \
        {
            { base         "public virtual vA" }
            { vbase        "vA" }
            { field public "int vc;" }
            { field public "int vx;" }
        }
-    cp_test_ptype_class "ptype class vC" "" "class" "vC" ibid
-    cp_test_ptype_class "ptype g_vC" "" "class" "vC" ibid
+    cp_test_ptype_class "class vC" "" "class" "vC" ibid
+    cp_test_ptype_class "g_vC" "" "class" "vC" ibid
 
 }
 
@@ -219,7 +218,7 @@ proc test_ptype_mvi { } {
     # class vD
 
     cp_test_ptype_class \
-       "ptype vD" "" "class" "vD" \
+       "vD" "" "class" "vD" \
        {
            { base         "public virtual vB" }
            { base         "public virtual vC" }
@@ -228,21 +227,21 @@ proc test_ptype_mvi { } {
            { field public "int vd;" }
            { field public "int vx;" }
        }
-    cp_test_ptype_class "ptype class vD" "" "class" "vD" ibid
-    cp_test_ptype_class "ptype g_vD" "" "class" "vD" ibid
+    cp_test_ptype_class "class vD" "" "class" "vD" ibid
+    cp_test_ptype_class "g_vD" "" "class" "vD" ibid
 
     # class vE
 
     cp_test_ptype_class \
-       "ptype vE" "" "class" "vE" \
+       "vE" "" "class" "vE" \
        {
            { base         "public virtual vD" }
            { vbase        "vD" }
            { field public "int ve;" }
            { field public "int vx;" }
        }
-    cp_test_ptype_class "ptype class vE" "" "class" "vE" ibid
-    cp_test_ptype_class "ptype g_vE" "" "class" "vE" ibid
+    cp_test_ptype_class "class vE" "" "class" "vE" ibid
+    cp_test_ptype_class "g_vE" "" "class" "vE" ibid
 
 }
 
@@ -421,9 +420,6 @@ proc test_print_mi_classes { } {
 # incapable of printing the member of an anonymous union.
 # We test the printing of the member first, and perform the other tests
 # only if the test succeeds, to avoid the infinite loop.
-#
-# GDB HEAD 2004-01-27 with hp aCC A.03.45 crashes on the first test.
-# -- chastain 2004-01-27
 
 proc test_print_anon_union {} {
     global gdb_prompt
@@ -483,9 +479,9 @@ proc test_print_svi_members { } {
     gdb_test "print g_vC.vC::vx" "$vhn = 10"
 
     # Print members of g_vC using compact form.
-    gdb_test "print g_vC.va" "$vhn = 7" "print g_vC.va"
-    gdb_test "print g_vC.vc" "$vhn = 9" "print g_vC.vc"
-    gdb_test "print g_vC.vx" "$vhn = 10" "print g_vC.vx"
+    gdb_test "print g_vC.va" "$vhn = 7"
+    gdb_test "print g_vC.vc" "$vhn = 9"
+    gdb_test "print g_vC.vx" "$vhn = 10"
 }
 
 # Single virtual inheritance, print complete classes.
@@ -525,6 +521,12 @@ proc test_print_svi_classes { } {
            # gcc HEAD 2004-07-31 -gstabs+
            pass $name
        }
+       -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = ${hex}( <\[^>]*>)?, vb = 5, vx = 6\}$nl$gdb_prompt $" {
+           # gcc HEAD 2015?+
+           # the vptr is set to the address *after* the vtable,
+           # so the # symbol shown is unpredictable.
+           pass "$name (symbols ignored)"
+       }
     }
 
     # Print all members of g_vC.
@@ -553,6 +555,12 @@ proc test_print_svi_classes { } {
            # gcc HEAD 2004-07-31 -gstabs+
            pass $name
        }
+       -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = ${hex}( <\[^>]*>)?, vc = 9, vx = 10\}$nl$gdb_prompt $" {
+           # gcc HEAD 2015?+
+           # the vptr is set to the address *after* the vtable,
+           # so the symbol shown is unpredictable.
+           pass "$name (symbols ignored)"
+       }
     }
 }
 
@@ -624,6 +632,12 @@ proc test_print_mvi_classes { } {
            # gcc 3.3.2 -gstabs+
            pass "$name"
        }
+       -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = ${hex}( <\[^>]*>)?, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <\[^>]*>)?, vc = 23, vx = 24\}, $re_vbptr_3_vD = ${hex}( <\[^>]*>)?, vd = 25, vx = 26\}$nl$gdb_prompt $" {
+           # gcc HEAD 2015?+
+           # the vptr is set to the address *after* the vtable,
+           # so the symbol shown is unpredictable.
+           pass "$name (symbols ignored)"
+       }
     }
 
     # Print all members of g_vE.
@@ -651,6 +665,12 @@ proc test_print_mvi_classes { } {
            # gcc HEAD 2004-07-31 -gstabs+
            pass $name
        }
+       -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = ${hex}( <\[^>]*>)?, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <\[^>]*>)?, vc = 0, vx = 0\}, $re_vbptr_3_vD = ${hex}( <\[^>]*>)?, vd = 0, vx = 0\}, $re_vbptr_3_vE = ${hex}( <\[^>]*>)?, ve = 27, vx = 28\}$nl$gdb_prompt $" {
+           # gcc HEAD 2015?+
+           # the vptr is set to the address *after* the vtable,
+           # so the symbol shown is unpredictable.
+           pass "$name (symbols ignored)"
+       }
     }
 }
 
@@ -673,9 +693,16 @@ proc do_tests { } {
        return
     }
 
-    test_print_si_members
+    with_test_prefix "single inheritance" {
+       test_print_si_members
+    }
+
     test_print_si_classes
-    test_print_mi_members
+
+    with_test_prefix "multiple inheritance" {
+       test_print_mi_members
+    }
+
     test_print_mi_member_types
     test_print_mi_classes
     test_print_anon_union