[Lldb-commits] [PATCH] D85542: lldbutil: add a retry mechanism for the ios simulator

2020-08-07 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG968cba8e89f7: lldbutil: add a retry mechanism for the ios 
simulator (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D85542?vs=283995=284020#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85542/new/

https://reviews.llvm.org/D85542

Files:
  lldb/packages/Python/lldbsuite/test/lldbutil.py


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -21,6 +21,8 @@
 import lldb
 from . import lldbtest_config
 
+# How often failed simulator process launches are retried.
+SIMULATOR_RETRY = 3
 
 # ===
 # Utilities for locating/checking executable programs
@@ -818,9 +820,20 @@
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
+# Unfortunate workaround for the iPhone simulator.
+retry = SIMULATOR_RETRY
+while (retry and error.Fail() and error.GetCString() and
+   "Unable to boot the Simulator" in error.GetCString()):
+retry -= 1
+print("** Simulator is unresponsive. Retrying %d more time(s)"%retry)
+import time
+time.sleep(60)
+error = lldb.SBError()
+process = target.Launch(launch_info, error)
+
 test.assertTrue(process,
-"Could not create a valid process for %s: 
%s"%(target.GetExecutable().GetFilename(),
-error.GetCString()))
+"Could not create a valid process for %s: %s" %
+(target.GetExecutable().GetFilename(), error.GetCString()))
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -21,6 +21,8 @@
 import lldb
 from . import lldbtest_config
 
+# How often failed simulator process launches are retried.
+SIMULATOR_RETRY = 3
 
 # ===
 # Utilities for locating/checking executable programs
@@ -818,9 +820,20 @@
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
+# Unfortunate workaround for the iPhone simulator.
+retry = SIMULATOR_RETRY
+while (retry and error.Fail() and error.GetCString() and
+   "Unable to boot the Simulator" in error.GetCString()):
+retry -= 1
+print("** Simulator is unresponsive. Retrying %d more time(s)"%retry)
+import time
+time.sleep(60)
+error = lldb.SBError()
+process = target.Launch(launch_info, error)
+
 test.assertTrue(process,
-"Could not create a valid process for %s: %s"%(target.GetExecutable().GetFilename(),
-error.GetCString()))
+"Could not create a valid process for %s: %s" %
+(target.GetExecutable().GetFilename(), error.GetCString()))
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85542: lldbutil: add a retry mechanism for the ios simulator

2020-08-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM with the comments addressed. Thanks for fixing this!




Comment at: lldb/packages/Python/lldbsuite/test/lldbutil.py:822
+# Unfortunate workaround for the iPhone simulator.
+retry = 3
+while (retry and error.Fail() and

Nit: can we make this a global constant like SIMULATOR_RETRY?



Comment at: lldb/packages/Python/lldbsuite/test/lldbutil.py:824
+while (retry and error.Fail() and
+   isinstance(error.GetCString(), six.string_types) and
+   "Unable to boot the Simulator" in error.GetCString()):

aprantl wrote:
> JDevlieghere wrote:
> > Why is this necessary? Is there an error case where `error.GetCString` is 
> > not a python string? If so we should probably factor this out in a function 
> > and do the `if sys.version_info.major == 2: str.decode('utf-8', 'replace')` 
> > trick instead because otherwise the retry won't kick in.
> It may be `None`. So I guess we could write `and error.GetCString()`? I just 
> didn't want to crash on unexpected input.
Got it, yeah then that should be sufficient. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85542/new/

https://reviews.llvm.org/D85542

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85542: lldbutil: add a retry mechanism for the ios simulator

2020-08-07 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 283995.
aprantl added a comment.

Address review feedback


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85542/new/

https://reviews.llvm.org/D85542

Files:
  lldb/packages/Python/lldbsuite/test/lldbutil.py


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -818,9 +818,20 @@
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
+# Unfortunate workaround for the iPhone simulator.
+retry = 3
+while (retry and error.Fail() and error.GetCString() and
+   "Unable to boot the Simulator" in error.GetCString()):
+retry -= 1
+print("** Simulator is unresponsive. Retrying %d more time(s)"%retry)
+import time
+time.sleep(60)
+error = lldb.SBError()
+process = target.Launch(launch_info, error)
+
 test.assertTrue(process,
-"Could not create a valid process for %s: 
%s"%(target.GetExecutable().GetFilename(),
-error.GetCString()))
+"Could not create a valid process for %s: %s" %
+(target.GetExecutable().GetFilename(), error.GetCString()))
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -818,9 +818,20 @@
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
+# Unfortunate workaround for the iPhone simulator.
+retry = 3
+while (retry and error.Fail() and error.GetCString() and
+   "Unable to boot the Simulator" in error.GetCString()):
+retry -= 1
+print("** Simulator is unresponsive. Retrying %d more time(s)"%retry)
+import time
+time.sleep(60)
+error = lldb.SBError()
+process = target.Launch(launch_info, error)
+
 test.assertTrue(process,
-"Could not create a valid process for %s: %s"%(target.GetExecutable().GetFilename(),
-error.GetCString()))
+"Could not create a valid process for %s: %s" %
+(target.GetExecutable().GetFilename(), error.GetCString()))
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85542: lldbutil: add a retry mechanism for the ios simulator

2020-08-07 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/lldbutil.py:824
+while (retry and error.Fail() and
+   isinstance(error.GetCString(), six.string_types) and
+   "Unable to boot the Simulator" in error.GetCString()):

JDevlieghere wrote:
> Why is this necessary? Is there an error case where `error.GetCString` is not 
> a python string? If so we should probably factor this out in a function and 
> do the `if sys.version_info.major == 2: str.decode('utf-8', 'replace')` trick 
> instead because otherwise the retry won't kick in.
It may be `None`. So I guess we could write `and error.GetCString()`? I just 
didn't want to crash on unexpected input.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85542/new/

https://reviews.llvm.org/D85542

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85542: lldbutil: add a retry mechanism for the ios simulator

2020-08-07 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/lldbutil.py:824
+while (retry and error.Fail() and
+   isinstance(error.GetCString(), six.string_types) and
+   "Unable to boot the Simulator" in error.GetCString()):

Why is this necessary? Is there an error case where `error.GetCString` is not a 
python string? If so we should probably factor this out in a function and do 
the `if sys.version_info.major == 2: str.decode('utf-8', 'replace')` trick 
instead because otherwise the retry won't kick in.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85542/new/

https://reviews.llvm.org/D85542

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85542: lldbutil: add a retry mechanism for the ios simulator

2020-08-07 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: JDevlieghere, jingham, jasonmolenda, friss.
aprantl requested review of this revision.

We've been seeing this failure on green dragon when the system is under high 
load. Unfortunately this is outside of LLDB's control.


https://reviews.llvm.org/D85542

Files:
  lldb/packages/Python/lldbsuite/test/lldbutil.py


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -818,9 +818,21 @@
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
+# Unfortunate workaround for the iPhone simulator.
+retry = 3
+while (retry and error.Fail() and
+   isinstance(error.GetCString(), six.string_types) and
+   "Unable to boot the Simulator" in error.GetCString()):
+retry -= 1
+print("** Simulator is unresponsive. Retrying %d more time(s)"%retry)
+import time
+time.sleep(60)
+error = lldb.SBError()
+process = target.Launch(launch_info, error)
+
 test.assertTrue(process,
-"Could not create a valid process for %s: 
%s"%(target.GetExecutable().GetFilename(),
-error.GetCString()))
+"Could not create a valid process for %s: %s" %
+(target.GetExecutable().GetFilename(), error.GetCString()))
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -818,9 +818,21 @@
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
+# Unfortunate workaround for the iPhone simulator.
+retry = 3
+while (retry and error.Fail() and
+   isinstance(error.GetCString(), six.string_types) and
+   "Unable to boot the Simulator" in error.GetCString()):
+retry -= 1
+print("** Simulator is unresponsive. Retrying %d more time(s)"%retry)
+import time
+time.sleep(60)
+error = lldb.SBError()
+process = target.Launch(launch_info, error)
+
 test.assertTrue(process,
-"Could not create a valid process for %s: %s"%(target.GetExecutable().GetFilename(),
-error.GetCString()))
+"Could not create a valid process for %s: %s" %
+(target.GetExecutable().GetFilename(), error.GetCString()))
 test.assertFalse(error.Fail(),
  "Process launch failed: %s" % (error.GetCString()))
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits