]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: spring clean the gdb.stabs/gdb11479.exp test
authorAndrew Burgess <aburgess@redhat.com>
Tue, 29 Oct 2024 14:59:23 +0000 (14:59 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Mon, 4 Nov 2024 15:51:40 +0000 (15:51 +0000)
I had reason to look at the gdb.stabs/gdb11479.exp test script and
figured it could do with a small clean up.  I've:

  - Made use of standard_testfile and the variables it defines.

  - Made use of with_test_prefix and removed the prefix from the end
    of each test name.

  - Avoid overwriting the test binary when we recompile, instead use a
    different name for each recompilation.

  - Add '.' at the end of each comment.

There should be no changes in what is tested with this commit.

Reviewed-By: Keith Seitz <keiths@redhat.com>
gdb/testsuite/gdb.stabs/gdb11479.exp

index 11d4be08af3e6b92fbe002d1a3ecc5ad92a41a1a..12f60eebe3f62243082e37d64f571334898db3ab 100644 (file)
 
 # Test GDB stabs problem with qualified parameter of forward types.
 
-
-set testfile "gdb11479"
+standard_testfile
 
 proc do_test {version} {
-    if ![runto_main] {
-        return -1
+    with_test_prefix "$version" {
+       if { ![runto_main] } {
+           return -1
+       }
+       gdb_test "rb test" "" "set breakpoints"
+       gdb_test "continue" "Breakpoint .* test2 .*" \
+           "stop at first breakpoint in test2 function"
+
+       # Check that the struct is read in correctly.
+       gdb_test "print *t" ".*\{x = 5, y = 25, b = 2.5\}.*" \
+           "Inspect t in test2"
+
+       # Check that the enum type length has been set to a non-zero value.
+       gdb_test "print sizeof (*e)" "= \[1-9\]*" "sizeof (*e) in test2"
+
+       gdb_test "continue" "Breakpoint .* test .*" \
+           "Stop at first breakpoint test function"
+
+       gdb_test "print *t" ".*\{x = 5, y = 25, b = 2.5\}.*" \
+           "Inspect t in test"
+
+       # Check that the enum type length has been set to a non-zero value.
+       gdb_test "print sizeof (*e)" "= \[1-9\]*" "sizeof (*e) in test"
     }
-    gdb_test "rb test" "" "set breakpoints $version"
-    gdb_test "continue" "Breakpoint .* test2 .*" "stop at first breakpoint $version"
-    # Check that the struct is read in correctly
-    gdb_test "print *t" ".*\{x = 5, y = 25, b = 2.5\}.*" \
-       "Inspect t in test2 $version"
-    # Check that the enum type length has been set to a non-zero value
-    gdb_test "print sizeof (*e)" "= \[1-9\]*" "sizeof (*e) in test2 $version"
-    gdb_test "continue" "Breakpoint .* test .*" \
-       "Stop at first breakpoint $version"
-    gdb_test "print *t" ".*\{x = 5, y = 25, b = 2.5\}.*" \
-       "Inspect t in test $version"
-    # Check that the enum type length has been set to a non-zero value
-    gdb_test "print sizeof (*e)" "= \[1-9\]*" "sizeof (*e) in test $version"
 }
 
-if { [prepare_for_testing "failed to prepare" $testfile $testfile.c {debug additional_flags=-gstabs quiet}] == 0 } {
+# Compile and test with stabs debug format.
+if { [prepare_for_testing "failed to prepare" ${testfile}-stabs $srcfile \
+         {debug additional_flags=-gstabs quiet}] == 0 } {
     do_test forced_stabs
 }
 
-# Without this gdb_exit the executable is still opened
-# by GDB which can generate a compilation failure. 
-gdb_exit
-
-if { [prepare_for_testing "failed to prepare" $testfile $testfile.c {debug}] == 0 } {
+# Compile and test with the default debug format.
+if { [prepare_for_testing "failed to prepare" ${testfile}-default \
+         $srcfile] == 0 } {
     do_test natural_debug_format
 }
-