]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.base/relocate.exp
Fix some duplicate test names
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / relocate.exp
index 4c1696a8cac82678ec5dd942a5f3237285fb0a12..906d16b4a4fcede42470c2e58aa03a5922bc9b34 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002-2018 Free Software Foundation, Inc.
+# Copyright 2002-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
@@ -152,9 +152,11 @@ gdb_test "add-symbol-file ${binfile} 0" \
        "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x0\[\r\n\]+\\(y or n\\) " \
        "y"
 
-# Print the addresses of static variables.
-set static_foo_addr [get_var_address static_foo]
-set static_bar_addr [get_var_address static_bar]
+with_test_prefix "print addresses, static vars" {
+    # Print the addresses of static variables.
+    set static_foo_addr [get_var_address static_foo]
+    set static_bar_addr [get_var_address static_bar]
+}
 
 # Make sure they have different addresses.
 if { "${static_foo_addr}" == "${static_bar_addr}" } {
@@ -163,9 +165,11 @@ if { "${static_foo_addr}" == "${static_bar_addr}" } {
   pass "static variables have different addresses"
 }
 
-# Print the addresses of global variables.
-set global_foo_addr [get_var_address global_foo]
-set global_bar_addr [get_var_address global_bar]
+with_test_prefix "print addresses, global vars" {
+    # Print the addresses of global variables.
+    set global_foo_addr [get_var_address global_foo]
+    set global_bar_addr [get_var_address global_bar]
+}
 
 # Make sure they have different addresses.
 if { "${global_foo_addr}" == "${global_bar_addr}" } {
@@ -174,9 +178,11 @@ if { "${global_foo_addr}" == "${global_bar_addr}" } {
   pass "global variables have different addresses"
 }
 
-# Print the addresses of functions.
-set function_foo_addr [get_var_address function_foo]
-set function_bar_addr [get_var_address function_bar]
+with_test_prefix "print addresses, functions" {
+    # Print the addresses of functions.
+    set function_foo_addr [get_var_address function_foo]
+    set function_bar_addr [get_var_address function_bar]
+}
 
 # Make sure they have different addresses.
 if { "${function_foo_addr}" == "${function_bar_addr}" } {
@@ -220,20 +226,26 @@ gdb_test "symbol-file -o $offset $binfile" \
     "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with offset"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
-    "static variable foo is moved by offset"
+with_test_prefix "static vars" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
+       "static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
+       "global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
-    "function foo is moved by offset"
+with_test_prefix "functions" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
+       "function foo is moved by offset"
+}
 
 # Load the object using add-symbol-file with an offset and check that
 # all addresses are moved by that offset.
@@ -246,20 +258,26 @@ gdb_test "add-symbol-file -o $offset $binfile" \
     "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
-    "static variable foo is moved by offset"
+with_test_prefix "static scope, 2nd" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
+       "static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars, 2nd" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
+       "global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
-    "function foo is moved by offset"
+with_test_prefix "functions, 2nd" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
+       "function foo is moved by offset"
+}
 
 # Re-load the object giving an explicit address for .text
 
@@ -271,10 +289,12 @@ gdb_test "add-symbol-file $binfile -o $offset $text" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure function has a different addresses now.
-set function_foo_addr [get_var_address function_foo]
-gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
-    "function foo has a different address"
+with_test_prefix "functions, 3rd" {
+    # Make sure function has a different addresses now.
+    set function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
+       "function foo has a different address"
+}
 
 # Re-load the object giving an explicit address for .data
 
@@ -286,10 +306,12 @@ gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure variable has a different addresses now.
-set global_foo_addr [get_var_address global_foo]
-gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
-    "global variable foo has a different address"
+with_test_prefix "global vars, 3rd" {
+    # Make sure variable has a different addresses now.
+    set global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
+       "global variable foo has a different address"
+}
 
 # Now try loading the object as an exec-file; we should be able to print
 # the values of variables after we do this.