Skip to content

Commit

Permalink
[lldb] Bump timeouts in TestCallWithTimeout
Browse files Browse the repository at this point in the history
this test is occasionally (~3%) failing on an emulator target. The value
used by the test (one second) is quite aggressive given that we set the timeout
for a single gdb packet to 60 seconds.

Bumping it to five to resolve flakyness.
  • Loading branch information
labath committed Jul 10, 2024
1 parent 5ab755c commit 14ba847
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ def test(self):
self, "stop here in main.", self.main_source_spec
)

short_time = 5000
long_time = short_time * 1000

# First set the timeout too short, and make sure we fail.
options = lldb.SBExpressionOptions()
options.SetTimeoutInMicroSeconds(10)
options.SetTimeoutInMicroSeconds(short_time)
options.SetUnwindOnError(True)

frame = thread.GetFrameAtIndex(0)

value = frame.EvaluateExpression("wait_a_while(1000000)", options)
value = frame.EvaluateExpression(f"wait_a_while({long_time})", options)
self.assertTrue(value.IsValid())
self.assertFalse(value.GetError().Success())

Expand All @@ -44,14 +47,14 @@ def test(self):

result = lldb.SBCommandReturnObject()
return_value = interp.HandleCommand(
"expr -t 100 -u true -- wait_a_while(1000000)", result
f"expr -t {short_time} -u true -- wait_a_while({long_time})", result
)
self.assertEqual(return_value, lldb.eReturnStatusFailed)

# Okay, now do it again with long enough time outs:

options.SetTimeoutInMicroSeconds(1000000)
value = frame.EvaluateExpression("wait_a_while (1000)", options)
options.SetTimeoutInMicroSeconds(long_time)
value = frame.EvaluateExpression(f"wait_a_while({short_time})", options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())

Expand All @@ -61,15 +64,15 @@ def test(self):

result = lldb.SBCommandReturnObject()
return_value = interp.HandleCommand(
"expr -t 1000000 -u true -- wait_a_while(1000)", result
f"expr -t {long_time} -u true -- wait_a_while({short_time})", result
)
self.assertEqual(return_value, lldb.eReturnStatusSuccessFinishResult)

# Finally set the one thread timeout and make sure that doesn't change
# things much:

options.SetTimeoutInMicroSeconds(1000000)
options.SetOneThreadTimeoutInMicroSeconds(500000)
value = frame.EvaluateExpression("wait_a_while (1000)", options)
options.SetTimeoutInMicroSeconds(long_time)
options.SetOneThreadTimeoutInMicroSeconds(1000000)
value = frame.EvaluateExpression(f"wait_a_while({short_time})", options)
self.assertTrue(value.IsValid())
self.assertSuccess(value.GetError())

0 comments on commit 14ba847

Please sign in to comment.