<div dir="ltr">Bump.  </div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 16, 2014 at 3:58 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi tfiala,<br>
<br>
This fixes a few issues related to running the test suite on Windows.  Most notably, it makes lldb -P return the expected python path so this can be used by the test script.<br>
<br>
<a href="http://reviews.llvm.org/D4548" target="_blank">http://reviews.llvm.org/D4548</a><br>
<br>
Files:<br>
  source/Host/common/Host.cpp<br>
  source/Host/windows/Host.cpp<br>
  test/dotest.py<br>
<br>
Index: source/Host/common/Host.cpp<br>
===================================================================<br>
--- source/Host/common/Host.cpp<br>
+++ source/Host/common/Host.cpp<br>
@@ -1152,6 +1152,10 @@<br>
                 {<br>
                     char raw_path[PATH_MAX];<br>
                     char resolved_path[PATH_MAX];<br>
+#if defined(_WIN32)<br>
+                    lldb_file_spec.AppendPathComponent("../lib/site-packages");<br>
+                    lldb_file_spec.GetPath(raw_path, sizeof(raw_path));<br>
+#else<br>
                     lldb_file_spec.GetPath(raw_path, sizeof(raw_path));<br>
<br>
 #if defined (__APPLE__)<br>
@@ -1174,7 +1178,7 @@<br>
<br>
                         ::strncat(raw_path, python_version_dir.c_str(),<br>
                                   sizeof(raw_path) - strlen(raw_path) - 1);<br>
-<br>
+#endif<br>
 #if defined (__APPLE__)<br>
                     }<br>
 #endif<br>
Index: source/Host/windows/Host.cpp<br>
===================================================================<br>
--- source/Host/windows/Host.cpp<br>
+++ source/Host/windows/Host.cpp<br>
@@ -247,6 +247,22 @@<br>
 Host::GetModuleFileSpecForHostAddress (const void *host_addr)<br>
 {<br>
     FileSpec module_filespec;<br>
+<br>
+    HMODULE hmodule = NULL;<br>
+    if (!::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)host_addr, &hmodule))<br>
+        return module_filespec;<br>
+<br>
+    std::vector<char> buffer(MAX_PATH);<br>
+    DWORD chars_copied = 0;<br>
+    bool success = false;<br>
+    bool error = false;<br>
+    do {<br>
+        chars_copied = ::GetModuleFileName(hmodule, &buffer[0], buffer.size());<br>
+        if (chars_copied == buffer.size() && ::GetLastError() == ERROR_INSUFFICIENT_BUFFER)<br>
+            buffer.resize(buffer.size() * 2);<br>
+    } while (chars_copied >= buffer.size());<br>
+<br>
+    module_filespec.SetFile(&buffer[0], false);<br>
     return module_filespec;<br>
 }<br>
<br>
Index: test/dotest.py<br>
===================================================================<br>
--- test/dotest.py<br>
+++ test/dotest.py<br>
@@ -883,11 +883,6 @@<br>
     os.environ["LLDB_SRC"] = os.path.join(sys.path[0], os.pardir)<br>
<br>
     pluginPath = os.path.join(scriptPath, 'plugins')<br>
-    pexpectPath = os.path.join(scriptPath, 'pexpect-2.4')<br>
-<br>
-    # Put embedded pexpect at front of the load path so we ensure we<br>
-    # use that version.<br>
-    sys.path.insert(0, pexpectPath)<br>
<br>
     # Append script dir and plugin dir to the sys.path.<br>
     sys.path.append(scriptPath)<br>
@@ -1004,17 +999,17 @@<br>
<br>
         # If our lldb supports the -P option, use it to find the python path:<br>
         init_in_python_dir = 'lldb/__init__.py'<br>
-        import pexpect<br>
         lldb_dash_p_result = None<br>
<br>
         if lldbHere:<br>
-            lldb_dash_p_result = pexpect.run("%s -P"%(lldbHere))<br>
+            lldb_dash_p_result = subprocess.check_output("%s -P"%(lldbHere), stderr=subprocess.STDOUT)<br>
         elif lldbExec:<br>
-            lldb_dash_p_result = pexpect.run("%s -P"%(lldbExec))<br>
+            lldb_dash_p_result = subprocess.check_output("%s -P"%(lldbExec), stderr=subprocess.STDOUT)<br>
<br>
-        if lldb_dash_p_result and not lldb_dash_p_result.startswith(("<", "lldb: invalid option:")):<br>
+        if lldb_dash_p_result and not lldb_dash_p_result.startswith(("<", "lldb: invalid option:")) \<br>
+                                                         and not lldb_dash_p_result.startswith("Traceback"):<br>
             lines = lldb_dash_p_result.splitlines()<br>
-            if len(lines) == 1 and os.path.isfile(os.path.join(lines[0], init_in_python_dir)):<br>
+            if len(lines) >= 1 and os.path.isfile(os.path.join(lines[0], init_in_python_dir)):<br>
                 lldbPath = lines[0]<br>
                 if "freebsd" in sys.platform or "linux" in sys.platform:<br>
                     os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPath, '..', '..')<br>
</blockquote></div><br></div>