<p dir="ltr">Hello, </p>
<p dir="ltr">How does it fix lldb-mi tests? Why you move initialization of self.dbg to Base.SetUp? lldb-mi doesn't use these objects: self.dbg/<a href="http://self.ci">self.ci</a> and etc. </p>
<p dir="ltr">Thanks, <br>
Ilia </p>
<div class="gmail_quote">On May 11, 2015 1:06 AM, "Vince Harron" <<a href="mailto:vince@nethacker.com">vince@nethacker.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: vharron<br>
Date: Sun May 10 17:01:59 2015<br>
New Revision: 236963<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=236963&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=236963&view=rev</a><br>
Log:<br>
Fixed lldb-mi test failures introduced by r236956<br>
<br>
Move enable/disableLogForCurrentTest from lldbtest.TestBase to<br>
lldbtest.Base so they're accessible to Mi tests<br>
<br>
<br>
Modified:<br>
lldb/trunk/test/lldbtest.py<br>
<br>
Modified: lldb/trunk/test/lldbtest.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=236963&r1=236962&r2=236963&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=236963&r1=236962&r2=236963&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/test/lldbtest.py (original)<br>
+++ lldb/trunk/test/lldbtest.py Sun May 10 17:01:59 2015<br>
@@ -965,6 +965,55 @@ class Base(unittest2.TestCase):<br>
else:<br>
return True<br>
<br>
+ def enableLogChannelsForCurrentTest(self):<br>
+ if len(lldbtest_config.channels) == 0:<br>
+ return<br>
+<br>
+ # if debug channels are specified in lldbtest_config.channels,<br>
+ # create a new set of log files for every test<br>
+ log_basename = self.getLogBasenameForCurrentTest()<br>
+<br>
+ # confirm that the file is writeable<br>
+ host_log_path = "{}-host.log".format(log_basename)<br>
+ open(host_log_path, 'w').close()<br>
+<br>
+ log_enable = "log enable -Tpn -f {} ".format(host_log_path)<br>
+ for channel_with_categories in lldbtest_config.channels:<br>
+ channel_then_categories = channel_with_categories.split(' ', 1)<br>
+ channel = channel_then_categories[0]<br>
+ if len(channel_then_categories) > 1:<br>
+ categories = channel_then_categories[1]<br>
+ else:<br>
+ categories = "default"<br>
+<br>
+ if channel == "gdb-remote":<br>
+ # communicate gdb-remote categories to debugserver<br>
+ os.environ["LLDB_DEBUGSERVER_LOG_FLAGS"] = categories<br>
+<br>
+ self.ci.HandleCommand(log_enable + channel_with_categories, self.res)<br>
+ if not self.res.Succeeded():<br>
+ raise Exception('log enable failed (check LLDB_LOG_OPTION env variable)')<br>
+<br>
+ # Communicate log path name to debugserver & lldb-server<br>
+ server_log_path = "{}-server.log".format(log_basename)<br>
+ open(server_log_path, 'w').close()<br>
+ os.environ["LLDB_DEBUGSERVER_LOG_FILE"] = server_log_path<br>
+<br>
+ # Communicate channels to lldb-server<br>
+ os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(lldbtest_config.channels)<br>
+<br>
+ if len(lldbtest_config.channels) == 0:<br>
+ return<br>
+<br>
+ def disableLogChannelsForCurrentTest(self):<br>
+ # close all log files that we opened<br>
+ for channel_and_categories in lldbtest_config.channels:<br>
+ # channel format - <channel-name> [<category0> [<category1> ...]]<br>
+ channel = channel_and_categories.split(' ', 1)[0]<br>
+ self.ci.HandleCommand("log disable " + channel, self.res)<br>
+ if not self.res.Succeeded():<br>
+ raise Exception('log disable failed (check LLDB_LOG_OPTION env variable)')<br>
+<br>
def setUp(self):<br>
"""Fixture for unittest test case setup.<br>
<br>
@@ -1095,6 +1144,25 @@ class Base(unittest2.TestCase):<br>
# set environment variable names for finding shared libraries<br>
self.dylibPath = self.platformContext.shlib_environment_var<br>
<br>
+ # Create the debugger instance if necessary.<br>
+ try:<br>
+ self.dbg = lldb.DBG<br>
+ except AttributeError:<br>
+ self.dbg = lldb.SBDebugger.Create()<br>
+<br>
+ if not self.dbg:<br>
+ raise Exception('Invalid debugger instance')<br>
+<br>
+ # Retrieve the associated command interpreter instance.<br>
+ <a href="http://self.ci" target="_blank">self.ci</a> = self.dbg.GetCommandInterpreter()<br>
+ if not <a href="http://self.ci" target="_blank">self.ci</a>:<br>
+ raise Exception('Could not get the command interpreter')<br>
+<br>
+ # And the result object.<br>
+ self.res = lldb.SBCommandReturnObject()<br>
+<br>
+ self.enableLogChannelsForCurrentTest()<br>
+<br>
def runHooks(self, child=None, child_prompt=None, use_cmd_api=False):<br>
"""Perform the run hooks to bring lldb debugger to the desired state.<br>
<br>
@@ -1867,55 +1935,6 @@ class TestBase(Base):<br>
folder = os.path.dirname(folder)<br>
continue<br>
<br>
- def enableLogChannelsForCurrentTest(self):<br>
- if len(lldbtest_config.channels) == 0:<br>
- return<br>
-<br>
- # if debug channels are specified in lldbtest_config.channels,<br>
- # create a new set of log files for every test<br>
- log_basename = self.getLogBasenameForCurrentTest()<br>
-<br>
- # confirm that the file is writeable<br>
- host_log_path = "{}-host.log".format(log_basename)<br>
- open(host_log_path, 'w').close()<br>
-<br>
- log_enable = "log enable -Tpn -f {} ".format(host_log_path)<br>
- for channel_with_categories in lldbtest_config.channels:<br>
- channel_then_categories = channel_with_categories.split(' ', 1)<br>
- channel = channel_then_categories[0]<br>
- if len(channel_then_categories) > 1:<br>
- categories = channel_then_categories[1]<br>
- else:<br>
- categories = "default"<br>
-<br>
- if channel == "gdb-remote":<br>
- # communicate gdb-remote categories to debugserver<br>
- os.environ["LLDB_DEBUGSERVER_LOG_FLAGS"] = categories<br>
-<br>
- self.ci.HandleCommand(log_enable + channel_with_categories, self.res)<br>
- if not self.res.Succeeded():<br>
- raise Exception('log enable failed (check LLDB_LOG_OPTION env variable)')<br>
-<br>
- # Communicate log path name to debugserver & lldb-server<br>
- server_log_path = "{}-server.log".format(log_basename)<br>
- open(server_log_path, 'w').close()<br>
- os.environ["LLDB_DEBUGSERVER_LOG_FILE"] = server_log_path<br>
-<br>
- # Communicate channels to lldb-server<br>
- os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(lldbtest_config.channels)<br>
-<br>
- if len(lldbtest_config.channels) == 0:<br>
- return<br>
-<br>
- def disableLogChannelsForCurrentTest(self):<br>
- # close all log files that we opened<br>
- for channel_and_categories in lldbtest_config.channels:<br>
- # channel format - <channel-name> [<category0> [<category1> ...]]<br>
- channel = channel_and_categories.split(' ', 1)[0]<br>
- self.ci.HandleCommand("log disable " + channel, self.res)<br>
- if not self.res.Succeeded():<br>
- raise Exception('log disable failed (check LLDB_LOG_OPTION env variable)')<br>
-<br>
def setUp(self):<br>
#import traceback<br>
#traceback.print_stack()<br>
@@ -1943,42 +1962,6 @@ class TestBase(Base):<br>
if "LLDB_TIME_WAIT_NEXT_LAUNCH" in os.environ:<br>
self.timeWaitNextLaunch = float(os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"])<br>
<br>
- # Create the debugger instance if necessary.<br>
- try:<br>
- self.dbg = lldb.DBG<br>
- except AttributeError:<br>
- self.dbg = lldb.SBDebugger.Create()<br>
-<br>
- if not self.dbg:<br>
- raise Exception('Invalid debugger instance')<br>
-<br>
- # Retrieve the associated command interpreter instance.<br>
- <a href="http://self.ci" target="_blank">self.ci</a> = self.dbg.GetCommandInterpreter()<br>
- if not <a href="http://self.ci" target="_blank">self.ci</a>:<br>
- raise Exception('Could not get the command interpreter')<br>
-<br>
- # And the result object.<br>
- self.res = lldb.SBCommandReturnObject()<br>
-<br>
- # Create the debugger instance if necessary.<br>
- try:<br>
- self.dbg = lldb.DBG<br>
- except AttributeError:<br>
- self.dbg = lldb.SBDebugger.Create()<br>
-<br>
- if not self.dbg:<br>
- raise Exception('Invalid debugger instance')<br>
-<br>
- # Retrieve the associated command interpreter instance.<br>
- <a href="http://self.ci" target="_blank">self.ci</a> = self.dbg.GetCommandInterpreter()<br>
- if not <a href="http://self.ci" target="_blank">self.ci</a>:<br>
- raise Exception('Could not get the command interpreter')<br>
-<br>
- # And the result object.<br>
- self.res = lldb.SBCommandReturnObject()<br>
-<br>
- self.enableLogChannelsForCurrentTest()<br>
-<br>
#<br>
# Warning: MAJOR HACK AHEAD!<br>
# If we are running testsuite remotely (by checking lldb.lldbtest_remote_sandbox),<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>