<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sun, Oct 30, 2016 at 9:57 PM Chris Bieneman via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=285542&r1=285541&r2=285542&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=285542&r1=285541&r2=285542&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)<br class="gmail_msg">
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Sun Oct 30 23:48:19 2016<br class="gmail_msg">
@@ -1848,6 +1848,33 @@ class TestBase(Base):<br class="gmail_msg">
                 folder = os.path.dirname(folder)<br class="gmail_msg">
                 continue<br class="gmail_msg">
<br class="gmail_msg">
+    def generateSource(self, source):<br class="gmail_msg">
+        template = source + '.template'<br class="gmail_msg">
+        temp = os.path.join(os.getcwd(), template)<br class="gmail_msg">
+        with open(temp, 'r') as f:<br class="gmail_msg">
+            content = f.read()<br class="gmail_msg">
+<br class="gmail_msg">
+        public_api_dir = os.path.join(<br class="gmail_msg">
+            os.environ["LLDB_SRC"], "include", "lldb", "API")<br class="gmail_msg">
+<br class="gmail_msg">
+        # Look under the include/lldb/API directory and add #include statements<br class="gmail_msg">
+        # for all the SB API headers.<br class="gmail_msg">
+        public_headers = os.listdir(public_api_dir)<br class="gmail_msg">
+        # For different platforms, the include statement can vary.<br class="gmail_msg">
+        if self.hasDarwinFramework():<br class="gmail_msg">
+            include_stmt = "'#include <%s>' % os.path.join('LLDB', header)"<br class="gmail_msg">
+        else:<br class="gmail_msg">
+            include_stmt = "'#include <%s>' % os.path.join(public_api_dir, header)"<br class="gmail_msg">
+        list = [eval(include_stmt) for header in public_headers if (<br class="gmail_msg">
+            header.startswith("SB") and header.endswith(".h"))]<br class="gmail_msg">
+        includes = '\n'.join(list)<br class="gmail_msg">
+        new_content = content.replace('%include_SB_APIs%', includes)<br class="gmail_msg">
+        src = os.path.join(os.getcwd(), source)<br class="gmail_msg">
+        with open(src, 'w') as f:<br class="gmail_msg">
+            f.write(new_content)<br class="gmail_msg">
+<br class="gmail_msg">
+        self.addTearDownHook(lambda: os.remove(src))<br class="gmail_msg">
+<br class="gmail_msg"></blockquote><div><br></div><div>The non hasDarwinFramework codepath is broken here, and I don't believe it to be a Windows specific issue.  I'm getting the following error in multiple tests.</div><div><br></div><div>Traceback (most recent call last):</div><div>  File "C:\src\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\plugins\commands\TestPluginCommands.py", line 23, in setUp</div><div>    self.generateSource('plugin.cpp')</div><div>  File "C:\src\llvm\tools\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 1868, in generateSource</div><div>    list = [eval(include_stmt) for header in public_headers if (</div><div>  File "C:\src\llvm\tools\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 1869, in <listcomp></div><div>    header.startswith("SB") and header.endswith(".h"))]</div><div>  File "<string>", line 1, in <module></div><div><b>NameError: name 'public_api_dir' is not defined</b></div><div>Config=i686-C:\src\llvmbuild\ninja_release\bin\clang.exe </div><div><br></div><div>I'm hypothesizing that the problem is that from inside of a list comprehension, your set of locals is not the same as outside of the list comprehension, and so the eval statement does not see the variable `public_api_dir`.  Is there any way you could provide a fix for this?</div></div></div>