From 91f8973ba3dff221eb4a3cd2695f3348260972f5 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 29 Oct 2024 14:59:23 +0000 Subject: gdb/testsuite: spring clean the gdb.stabs/gdb11479.exp test 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 --- gdb/testsuite/gdb.stabs/gdb11479.exp | 54 ++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'gdb') diff --git a/gdb/testsuite/gdb.stabs/gdb11479.exp b/gdb/testsuite/gdb.stabs/gdb11479.exp index 11d4be0..12f60ee 100644 --- a/gdb/testsuite/gdb.stabs/gdb11479.exp +++ b/gdb/testsuite/gdb.stabs/gdb11479.exp @@ -17,37 +17,43 @@ # 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 } - -- cgit v1.1