public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC] [gdb/testsuite] change gdb.base/skip.exp to use finish
@ 2021-12-08 16:46 Bruno Larsen
  2021-12-28 19:43 ` Bruno Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Larsen @ 2021-12-08 16:46 UTC (permalink / raw)
  To: gdb-patches

Many tests in the testsuite use a hardcoded amount of "next"
instructions to exit a function. This opens us up to XFAILs because of
compiler bugs, when a compiler doesn't add epilog information, for
example.
                                                                                                                                                                                                                    
This change should not stop any important testing on testcases, and
reduce the amount of FAILs or XFAILs.
---
                                                                                                                                                                                                                    
This is an RFC to see if the idea is acceptable, and if I understand
when switching is acceptable. Feedback is appreciated
                                                                                                                                                                                                                    
---
                                                                                                                                                                                                                    
  gdb/testsuite/gdb.base/skip.exp | 56 ++++++++++++++-------------------
  1 file changed, 23 insertions(+), 33 deletions(-)
                                                                                                                                                                                                                    
diff --git a/gdb/testsuite/gdb.base/skip.exp b/gdb/testsuite/gdb.base/skip.exp
index 076954fa4bf..f5d5f3079cf 100644
--- a/gdb/testsuite/gdb.base/skip.exp
+++ b/gdb/testsuite/gdb.base/skip.exp
@@ -117,9 +117,8 @@ with_test_prefix "step after deleting 1" {
         return
      }
                                                                                                                                                                                                                    
-    gdb_test "step" "foo \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2" ; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 3"
+    gdb_test "step" "foo \\(\\) at.*" "step"
+    gdb_test "finish" ".*" "finish" ; # Return from foo()
  }
                                                                                                                                                                                                                    
  # Now disable the skiplist entry for  skip1.c.  We should now
@@ -137,13 +136,11 @@ with_test_prefix "step after disabling 3" {
      }

      gdb_test "step" "bar \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from bar()
-    # With gcc 9.2.0 we jump once back to main before entering foo here.
-    # If that happens try to step a second time.
-    gdb_test "step" "foo \\(\\) at.*" "step 3" \
-       "main \\(\\) at .*\r\n$gdb_prompt " "step"
-    gdb_test "step" ".*" "step 4"; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 5"
+    # guarantee that we jump once back to main before entering foo here.
+    gdb_test "finish" ".*" "finish 1"; # Return to main()
+    gdb_test "step" "foo \\(\\) at.*" "step 2" \
+       "main \\(\\) at .*\r\n$gdb_prompt " "step" # enter foo()
+    gdb_test "finish" ".*" "finish 2"; # Return from foo()
  }

  # Enable skiplist entry 3 and make sure we step over it like before.
@@ -159,9 +156,8 @@ with_test_prefix "step after enable 3" {
         return
      }

-    gdb_test "step" "foo \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 3"
+    gdb_test "step" "foo \\(\\) at.*" "step"
+    gdb_test "finish" ".*" "finish"; # Return from foo()
  }

  # Admin tests (disable,enable,delete).
@@ -230,9 +226,8 @@ with_test_prefix "step using -fi" {

      gdb_test_no_output "skip disable"
      gdb_test_no_output "skip enable 5"
-    gdb_test "step" "foo \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 3"
+    gdb_test "step" "foo \\(\\) at.*" "step"
+    gdb_test "finish" ".*" "finish"; # Return from foo()
  }

  with_test_prefix "step using -gfi" {
@@ -242,9 +237,8 @@ with_test_prefix "step using -gfi" {

      gdb_test_no_output "skip disable"
      gdb_test_no_output "skip enable 6"
-    gdb_test "step" "foo \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 3"
+    gdb_test "step" "foo \\(\\) at.*" "step"
+    gdb_test "finish" ".*" "finish"; # Return from foo()
  }

  with_test_prefix "step using -fu for baz" {
@@ -255,13 +249,11 @@ with_test_prefix "step using -fu for baz" {
      gdb_test_no_output "skip disable"
      gdb_test_no_output "skip enable 7"
      gdb_test "step" "bar \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from bar()
-    # With gcc 9.2.0 we jump once back to main before entering foo here.
-    # If that happens try to step a second time.
-    gdb_test "step" "foo \\(\\) at.*" "step 3" \
-       "main \\(\\) at .*\r\n$gdb_prompt " "step"
-    gdb_test "step" ".*" "step 4"; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 5"
+    # guarantee that we jump once back to main before entering foo here.
+    gdb_test "finish" ".*" "finish 1"; # Return to main()
+    gdb_test "step" "foo \\(\\) at.*" "step 2" \
+       "main \\(\\) at .*\r\n$gdb_prompt " "step" # enter foo()
+    gdb_test "finish" ".*" "finish 2"; # Return from foo()
  }

  with_test_prefix "step using -rfu for baz" {
@@ -272,13 +264,11 @@ with_test_prefix "step using -rfu for baz" {
      gdb_test_no_output "skip disable"
      gdb_test_no_output "skip enable 8"
      gdb_test "step" "bar \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from bar()
-    # With gcc 9.2.0 we jump once back to main before entering foo here.
-    # If that happens try to step a second time.
-    gdb_test "step" "foo \\(\\) at.*" "step 3" \
-       "main \\(\\) at .*\r\n$gdb_prompt " "step"
-    gdb_test "step" ".*" "step 4"; # Return from foo()
-    gdb_test "step" "main \\(\\) at.*" "step 5"
+    # guarantee that we jump once back to main before entering foo here.
+    gdb_test "finish" ".*" "finish 1"; # Return to main()
+    gdb_test "step" "foo \\(\\) at.*" "step 2" \
+       "main \\(\\) at .*\r\n$gdb_prompt " "step" # enter foo()
+    gdb_test "finish" ".*" "finish 2"; # Return from foo()
  }

  # Test -fi + -fu.
--
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [RFC] [gdb/testsuite] change gdb.base/skip.exp to use finish
  2021-12-08 16:46 [RFC] [gdb/testsuite] change gdb.base/skip.exp to use finish Bruno Larsen
@ 2021-12-28 19:43 ` Bruno Larsen
  2022-02-25 18:46   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Larsen @ 2021-12-28 19:43 UTC (permalink / raw)
  To: gdb-patches

[PING]

Also, mail client may have screwed this mail. If needed, I can resend the patch
-- 
Cheers!
Bruno Larsen


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] [gdb/testsuite] change gdb.base/skip.exp to use finish
  2021-12-28 19:43 ` Bruno Larsen
@ 2022-02-25 18:46   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-02-25 18:46 UTC (permalink / raw)
  To: Bruno Larsen via Gdb-patches

Bruno> Also, mail client may have screwed this mail. If needed, I can resend the patch

The intro is weird but the patch itself was fine.
I think this patch is ok.

thanks,
Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-25 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 16:46 [RFC] [gdb/testsuite] change gdb.base/skip.exp to use finish Bruno Larsen
2021-12-28 19:43 ` Bruno Larsen
2022-02-25 18:46   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).