Here's the patch I'm using so far to get to the point where dotest is
actually running and successfully returning results.  It just doesn't
indicate any error results, only a job_begin and a job_end.

All this patch does is add use_lldb_suite.py in 2 places, import it, and
change a "w" to a "wb".

The question of why no errors are getting returned is still open.

On Fri, May 13, 2016 at 1:33 PM Zachary Turner <ztur...@google.com> wrote:

> zturner added a comment.
>
> In lldbsuite\test_event\formatter\__init__.py, if I open the file with "wb"
> instead of "w" I get further, but I still get other errors.  This might
> create a problem because you conditionally set the output file to stderr or
> stdout, which are opened for text already, so those will never work with
> cPickle.dump().  Do you have any good idea how to fix that?
>
> In any case, for now I've set it to "wb" and I'm getting further.  It's
> returning results back to the unit test, but the results only contain a
> begin and an end, but no error results.
>
>
> http://reviews.llvm.org/D20193
>
>
>
>
diff --git a/packages/Python/lldbsuite/test_event/formatter/__init__.py 
b/packages/Python/lldbsuite/test_event/formatter/__init__.py
index 556370e..00d8bfa 100644
--- a/packages/Python/lldbsuite/test_event/formatter/__init__.py
+++ b/packages/Python/lldbsuite/test_event/formatter/__init__.py
@@ -94,7 +94,7 @@ def create_results_formatter(config):
             results_file_object = sys.stderr
             cleanup_func = None
         else:
-            results_file_object = open(config.filename, "w")
+            results_file_object = open(config.filename, "wb")
             cleanup_func = results_file_object.close
         default_formatter_name = (
             "lldbsuite.test_event.formatter.xunit.XunitFormatter")
diff --git a/packages/Python/lldbsuite/test_event/test/src/event_collector.py 
b/packages/Python/lldbsuite/test_event/test/src/event_collector.py
index 35d1320..4671c2f 100644
--- a/packages/Python/lldbsuite/test_event/test/src/event_collector.py
+++ b/packages/Python/lldbsuite/test_event/test/src/event_collector.py
@@ -7,6 +7,7 @@ import sys
 import tempfile
 
 # noinspection PyUnresolvedReferences
+import use_lldb_suite
 from six.moves import cPickle
 
 
diff --git a/packages/Python/lldbsuite/test_event/test/src/use_lldb_suite.py 
b/packages/Python/lldbsuite/test_event/test/src/use_lldb_suite.py
new file mode 100644
index 0000000..f3e358a
--- /dev/null
+++ b/packages/Python/lldbsuite/test_event/test/src/use_lldb_suite.py
@@ -0,0 +1,25 @@
+import inspect
+import os
+import sys
+
+def find_lldb_root():
+    lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
+    while True:
+        lldb_root = os.path.dirname(lldb_root)
+        if lldb_root is None:
+            return None
+
+        test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
+        if os.path.isfile(test_path):
+            return lldb_root
+    return None
+
+lldb_root = find_lldb_root()
+if lldb_root is not None:
+    import imp
+    fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root])
+    try:
+        imp.load_module("use_lldb_suite_root", fp, pathname, desc)
+    finally:
+        if fp:
+            fp.close()
diff --git a/packages/Python/lldbsuite/test_event/use_lldb_suite.py 
b/packages/Python/lldbsuite/test_event/use_lldb_suite.py
new file mode 100644
index 0000000..f3e358a
--- /dev/null
+++ b/packages/Python/lldbsuite/test_event/use_lldb_suite.py
@@ -0,0 +1,25 @@
+import inspect
+import os
+import sys
+
+def find_lldb_root():
+    lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
+    while True:
+        lldb_root = os.path.dirname(lldb_root)
+        if lldb_root is None:
+            return None
+
+        test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
+        if os.path.isfile(test_path):
+            return lldb_root
+    return None
+
+lldb_root = find_lldb_root()
+if lldb_root is not None:
+    import imp
+    fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root])
+    try:
+        imp.load_module("use_lldb_suite_root", fp, pathname, desc)
+    finally:
+        if fp:
+            fp.close()
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to