From 14ba847d273a0defe0f4617bcfe9e1b2163e2bbc Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 9 Jul 2024 13:57:00 +0000 Subject: [PATCH] [lldb] Bump timeouts in TestCallWithTimeout 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. --- .../expression/timeout/TestCallWithTimeout.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py b/lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py index 2c48024c698337..de074e8ff7b090 100644 --- a/lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py +++ b/lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py @@ -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()) @@ -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()) @@ -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())