<div dir="ltr">Can you give me a command line which will reproduce the original problem? Because I ran through the entire test suite and nothing failed, so I want to make sure we're doing the same thing. I'm still a little confused about how this happens, but I plan to look into it when I'm back on Monday and see if I can understand it better to identify a better fix.</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 30, 2015 at 11:58 AM Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On Oct 29, 2015, at 11:31 PM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:</div><br><div><div dir="ltr">Wow. That's a weird problem. Thanks for finding it! <div><br></div><div>Would it work if we move the definition of the `lldbtest_config` class into lldbsuite/test/__init__.py? This way the configuration should be part of the global package state of the lldbsuite.test package, which all the tests are already members of the same package, so they wouldn't even need to import anything (I think).</div></div><br></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>I think the problem is exactly that we want lldbtest_config to be *global* state and not package local state. </div><div>Honestly, I think if we are not content with the fix as it stands, the right way would be to change the way unittest2 imports test cases as to use the package-level global scope instead of the global global state as it is now.</div></div></div><div style="word-wrap:break-word"><div><div><br></div><div><blockquote type="cite"><div>On Oct 30, 2015, at 8:32 AM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:</div><br><div><div dir="ltr">I'm also still a little confused why this worked before my patch. How is unittest2 importing the individual tests in a way that behaves differently when dotest is a package (now) versus a standalone script (before)?</div><br><div class="gmail_quote"></div></div></blockquote></div><div><br></div></div></div><div style="word-wrap:break-word"><div><div>That is a good question. One to which “because Python” is the only answer I can think of. I suspect scripts live at the global scope anyway, so we were just getting lucky with those imports making it through correctly.</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div class="gmail_quote"><div dir="ltr">On Thu, Oct 29, 2015 at 6:12 PM Enrico Granata via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">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">Author: enrico<br>
Date: Thu Oct 29 20:09:54 2015<br>
New Revision: 251678<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=251678&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=251678&view=rev</a><br>
Log:<br>
Some test cases that need the lldbExec path were failing because lldbExec was turning out to be None even though it was being validly set by dotest.py<br>
<br>
It turns out that lldbtest_config was being imported locally to "lldbsuite.test" instead of globally, so when the test cases got individually brought by a global import via __import__ by unittest2, they did not see the lldbtest_config import, and ended up importing a new separate copy of it, with lldbExec unset<br>
<br>
This is a simple hackaround that brings lldbtest_config to global visibility and makes sure the configuration data is correctly shared<br>
<br>
<br>
Modified:<br>
lldb/trunk/packages/Python/lldbsuite/test/dotest.py<br>
<br>
Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=251678&r1=251677&r2=251678&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=251678&r1=251677&r2=251678&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)<br>
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Thu Oct 29 20:09:54 2015<br>
@@ -21,6 +21,10 @@ for available options.<br>
"""<br>
<br>
from __future__ import print_function<br>
+# this module needs to have global visibility, otherwise test cases<br>
+# will import it anew in their local namespace, essentially losing access<br>
+# to all the configuration data<br>
+globals()['lldbtest_config'] = __import__('lldbtest_config')<br>
<br>
import use_lldb_suite<br>
<br>
@@ -42,7 +46,6 @@ import test_results<br>
from test_results import EventBuilder<br>
import inspect<br>
import unittest2<br>
-import lldbtest_config<br>
import test_categories<br>
<br>
import six<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>
</div></blockquote></div></div><div style="word-wrap:break-word"><div></div><br><div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>Thanks,</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><i>- Enrico</i><br>📩 egranata@<font color="#ff2600"></font>.com ☎️ 27683</div>
</div>
<br></div></blockquote></div>