Hi tfiala,
99% of this CL is simply moving calls to "import pexpect" to a more narrow
scope - i.e. the function that actually runs a particular test. This way the
test suite can run on Windows, which doesn't have pexpect, and the individual
tests that use pexpect can be disabled on a platform-specific basis.
There were a handful of other changes that address other portability issues.
Notably, using "ps" to get the command line (changed to use '
'.join(sys.argv)), and using os.uname() which isn't on Windows.
With this change, the only remaining piece of work left to be done to get the
test suite fully working on Windows is to get the Win32 "builder module"
working.
http://reviews.llvm.org/D4573
Files:
test/benchmarks/disassembly/TestDisassembly.py
test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
test/benchmarks/expression/TestExpressionCmd.py
test/benchmarks/expression/TestRepeatedExprs.py
test/benchmarks/frame_variable/TestFrameVariableResponse.py
test/benchmarks/startup/TestStartupDelays.py
test/benchmarks/stepping/TestRunHooksThenSteppings.py
test/benchmarks/stepping/TestSteppingSpeed.py
test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
test/dotest.py
test/functionalities/command_history/TestCommandHistory.py
test/functionalities/command_regex/TestCommandRegex.py
test/functionalities/completion/TestCompletion.py
test/functionalities/connect_remote/TestConnectRemote.py
test/functionalities/embedded_interpreter/TestConvenienceVariables.py
test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
test/functionalities/stop-hook/TestStopHookMechanism.py
test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
test/python_api/interpreter/TestCommandInterpreterAPI.py
test/python_api/sbdata/TestSBData.py
test/settings/TestSettings.py
test/terminal/TestSTTYBeforeAndAfter.py
test/tools/lldb-gdbserver/gdbremote_testcase.py
test/warnings/uuid/TestAddDsymCommand.py
Index: test/benchmarks/disassembly/TestDisassembly.py
===================================================================
--- test/benchmarks/disassembly/TestDisassembly.py
+++ test/benchmarks/disassembly/TestDisassembly.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
def is_exe(fpath):
@@ -66,6 +65,7 @@
print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
def run_lldb_disassembly(self, exe, function, count):
+ import pexpect
# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
prompt = self.child_prompt
@@ -106,6 +106,7 @@
self.child = None
def run_gdb_disassembly(self, exe, function, count):
+ import pexpect
# Set self.child_prompt, which is "(gdb) ".
self.child_prompt = '(gdb) '
prompt = self.child_prompt
Index: test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
===================================================================
--- test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
+++ test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
@@ -5,7 +5,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class AttachThenDisassemblyBench(BenchBase):
Index: test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
===================================================================
--- test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
+++ test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class XCode41Vs42GDBDisassembly(BenchBase):
@@ -47,6 +46,7 @@
print "gdb_42_avg/gdb_41_avg: %f" % (self.gdb_42_avg/self.gdb_41_avg)
def run_gdb_disassembly(self, gdb_exe_path, exe, function, count):
+ import pexpect
# Set self.child_prompt, which is "(gdb) ".
self.child_prompt = '(gdb) '
prompt = self.child_prompt
Index: test/benchmarks/expression/TestExpressionCmd.py
===================================================================
--- test/benchmarks/expression/TestExpressionCmd.py
+++ test/benchmarks/expression/TestExpressionCmd.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class ExpressionEvaluationCase(BenchBase):
@@ -29,6 +28,7 @@
print "lldb expr cmd benchmark:", self.stopwatch
def run_lldb_repeated_exprs(self, exe_name, count):
+ import pexpect
exe = os.path.join(os.getcwd(), exe_name)
# Set self.child_prompt, which is "(lldb) ".
Index: test/benchmarks/expression/TestRepeatedExprs.py
===================================================================
--- test/benchmarks/expression/TestRepeatedExprs.py
+++ test/benchmarks/expression/TestRepeatedExprs.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class RepeatedExprsCase(BenchBase):
@@ -34,6 +33,7 @@
print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
def run_lldb_repeated_exprs(self, exe_name, count):
+ import pexpect
exe = os.path.join(os.getcwd(), exe_name)
# Set self.child_prompt, which is "(lldb) ".
@@ -79,6 +79,7 @@
self.child = None
def run_gdb_repeated_exprs(self, exe_name, count):
+ import pexpect
exe = os.path.join(os.getcwd(), exe_name)
# Set self.child_prompt, which is "(gdb) ".
Index: test/benchmarks/frame_variable/TestFrameVariableResponse.py
===================================================================
--- test/benchmarks/frame_variable/TestFrameVariableResponse.py
+++ test/benchmarks/frame_variable/TestFrameVariableResponse.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class FrameVariableResponseBench(BenchBase):
@@ -33,6 +32,7 @@
print "lldb frame variable benchmark:", self.stopwatch
def run_frame_variable_bench(self, exe, break_spec, count):
+ import pexpect
# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
prompt = self.child_prompt
Index: test/benchmarks/startup/TestStartupDelays.py
===================================================================
--- test/benchmarks/startup/TestStartupDelays.py
+++ test/benchmarks/startup/TestStartupDelays.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class StartupDelaysBench(BenchBase):
@@ -40,6 +39,7 @@
print "lldb startup delay (run to breakpoint) benchmark:", self.stopwatch3
def run_startup_delays_bench(self, exe, break_spec, count):
+ import pexpect
# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
prompt = self.child_prompt
Index: test/benchmarks/stepping/TestRunHooksThenSteppings.py
===================================================================
--- test/benchmarks/stepping/TestRunHooksThenSteppings.py
+++ test/benchmarks/stepping/TestRunHooksThenSteppings.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class RunHooksThenSteppingsBench(BenchBase):
@@ -24,6 +23,7 @@
print "lldb stepping benchmark:", self.stopwatch
def run_lldb_runhooks_then_steppings(self, count):
+ import pexpect
# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
prompt = self.child_prompt
Index: test/benchmarks/stepping/TestSteppingSpeed.py
===================================================================
--- test/benchmarks/stepping/TestSteppingSpeed.py
+++ test/benchmarks/stepping/TestSteppingSpeed.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class SteppingSpeedBench(BenchBase):
@@ -36,6 +35,7 @@
print "lldb stepping benchmark:", self.stopwatch
def run_lldb_steppings(self, exe, break_spec, count):
+ import pexpect
# Set self.child_prompt, which is "(lldb) ".
self.child_prompt = '(lldb) '
prompt = self.child_prompt
Index: test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
===================================================================
--- test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
+++ test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
@@ -3,7 +3,6 @@
import os, sys
import unittest2
import lldb
-import pexpect
from lldbbench import *
class CompileRunToBreakpointBench(BenchBase):
@@ -33,6 +32,7 @@
print "lldb_avg/gdb_avg: %f" % (self.lldb_avg/self.gdb_avg)
def run_lldb_turnaround(self, exe, function, count):
+ import pexpect
def run_one_round():
prompt = self.child_prompt
@@ -73,6 +73,7 @@
self.child = None
def run_gdb_turnaround(self, exe, function, count):
+ import pexpect
def run_one_round():
prompt = self.child_prompt
Index: test/dotest.py
===================================================================
--- test/dotest.py
+++ test/dotest.py
@@ -1180,10 +1180,7 @@
raise Exception('log enable failed (check GDB_REMOTE_LOG env variable)')
def getMyCommandLine():
- ps = subprocess.Popen([which('ps'), '-o', "command=CMD", str(os.getpid())], stdout=subprocess.PIPE).communicate()[0]
- lines = ps.split('\n')
- cmd_line = lines[1]
- return cmd_line
+ return ' '.join(sys.argv)
# ======================================== #
# #
Index: test/functionalities/command_history/TestCommandHistory.py
===================================================================
--- test/functionalities/command_history/TestCommandHistory.py
+++ test/functionalities/command_history/TestCommandHistory.py
@@ -5,7 +5,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class CommandHistoryTestCase(TestBase):
Index: test/functionalities/command_regex/TestCommandRegex.py
===================================================================
--- test/functionalities/command_regex/TestCommandRegex.py
+++ test/functionalities/command_regex/TestCommandRegex.py
@@ -5,15 +5,15 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class CommandRegexTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_command_regex(self):
"""Test a simple scenario of 'command regex' invocation and subsequent use."""
+ import pexpect
prompt = "(lldb) "
regex_prompt = "Enter one of more sed substitution commands in the form: 's/<regex>/<subst>/'.\r\nTerminate the substitution list with an empty line.\r\n"
regex_prompt1 = "\r\n"
Index: test/functionalities/completion/TestCompletion.py
===================================================================
--- test/functionalities/completion/TestCompletion.py
+++ test/functionalities/completion/TestCompletion.py
@@ -5,7 +5,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class CommandLineCompletionTestCase(TestBase):
@@ -153,6 +152,7 @@
def complete_from_to(self, str_input, patterns, turn_off_re_match=False):
"""Test that the completion mechanism completes str_input to patterns,
where patterns could be a pattern-string or a list of pattern-strings"""
+ import pexpect
# Patterns should not be None in order to proceed.
self.assertFalse(patterns is None)
# And should be either a string or list of strings. Check for list type
Index: test/functionalities/connect_remote/TestConnectRemote.py
===================================================================
--- test/functionalities/connect_remote/TestConnectRemote.py
+++ test/functionalities/connect_remote/TestConnectRemote.py
@@ -5,7 +5,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class ConnectRemoteTestCase(TestBase):
@@ -15,6 +14,7 @@
def test_connect_remote(self):
"""Test "process connect connect:://localhost:12345"."""
+ import pexpect
# First, we'll start a fake debugserver (a simple echo server).
fakeserver = pexpect.spawn('./EchoServer.py')
Index: test/functionalities/embedded_interpreter/TestConvenienceVariables.py
===================================================================
--- test/functionalities/embedded_interpreter/TestConvenienceVariables.py
+++ test/functionalities/embedded_interpreter/TestConvenienceVariables.py
@@ -3,7 +3,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class ConvenienceVariablesCase(TestBase):
@@ -33,6 +32,7 @@
def convenience_variables(self):
"""Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame."""
+ import pexpect
exe = os.path.join(os.getcwd(), "a.out")
prompt = "(lldb) "
python_prompt = ">>> "
Index: test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
===================================================================
--- test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
+++ test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
@@ -5,7 +5,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class SingleQuoteInCommandLineTestCase(TestBase):
@@ -25,6 +24,7 @@
def test_lldb_invocation_with_single_quote_in_filename(self):
"""Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it."""
+ import pexpect
self.buildDefault()
system(["/bin/sh", "-c", "cp a.out \"%s\"" % self.myexe])
Index: test/functionalities/stop-hook/TestStopHookMechanism.py
===================================================================
--- test/functionalities/stop-hook/TestStopHookMechanism.py
+++ test/functionalities/stop-hook/TestStopHookMechanism.py
@@ -5,7 +5,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class StopHookMechanismTestCase(TestBase):
@@ -38,6 +37,7 @@
def stop_hook_firing(self):
"""Test the stop-hook mechanism."""
+ import pexpect
exe = os.path.join(os.getcwd(), "a.out")
prompt = "(lldb) "
add_prompt = "Enter your stop hook command(s). Type 'DONE' to end.\r\n> "
Index: test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
===================================================================
--- test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
+++ test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
@@ -5,7 +5,6 @@
import os, time
import unittest2
import lldb
-import pexpect
from lldbtest import *
class StopHookForMultipleThreadsTestCase(TestBase):
@@ -42,6 +41,7 @@
def stop_hook_multiple_threads(self):
"""Test that lldb stop-hook works for multiple threads."""
+ import pexpect
exe = os.path.join(os.getcwd(), self.exe_name)
prompt = "(lldb) "
Index: test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
===================================================================
--- test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
+++ test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
@@ -3,7 +3,6 @@
import os, time
import unittest2
import lldb
-import pexpect
import sys
from lldbtest import *
Index: test/python_api/interpreter/TestCommandInterpreterAPI.py
===================================================================
--- test/python_api/interpreter/TestCommandInterpreterAPI.py
+++ test/python_api/interpreter/TestCommandInterpreterAPI.py
@@ -3,7 +3,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class CommandInterpreterAPICase(TestBase):
Index: test/python_api/sbdata/TestSBData.py
===================================================================
--- test/python_api/sbdata/TestSBData.py
+++ test/python_api/sbdata/TestSBData.py
@@ -3,7 +3,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
from math import fabs
import lldbutil
Index: test/settings/TestSettings.py
===================================================================
--- test/settings/TestSettings.py
+++ test/settings/TestSettings.py
@@ -165,7 +165,7 @@
self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
startstr = "auto-confirm (boolean) = false")
- @unittest2.skipUnless(os.uname()[4] in ['amd64', 'i386', 'x86_64'], "requires x86 or x86_64")
+ @unittest2.skipUnless(os.name != "nt" and os.uname()[4] in ['amd64', 'i386', 'x86_64'], "requires x86 or x86_64")
def test_disassembler_settings(self):
"""Test that user options for the disassembler take effect."""
self.buildDefault()
Index: test/terminal/TestSTTYBeforeAndAfter.py
===================================================================
--- test/terminal/TestSTTYBeforeAndAfter.py
+++ test/terminal/TestSTTYBeforeAndAfter.py
@@ -5,7 +5,6 @@
import os
import unittest2
import lldb
-import pexpect
from lldbtest import *
class CommandLineCompletionTestCase(TestBase):
@@ -22,7 +21,7 @@
def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
"""Test that 'stty -a' displays the same output before and after running the lldb command."""
-
+ import pexpect
if not which('expect'):
self.skipTest("The 'expect' program cannot be located, skip the test")
Index: test/tools/lldb-gdbserver/gdbremote_testcase.py
===================================================================
--- test/tools/lldb-gdbserver/gdbremote_testcase.py
+++ test/tools/lldb-gdbserver/gdbremote_testcase.py
@@ -5,7 +5,6 @@
import errno
import os
import os.path
-import pexpect
import platform
import random
import re
@@ -180,6 +179,7 @@
def launch_debug_monitor(self, attach_pid=None):
# Create the command line.
+ import pexpect
commandline = "{}{} localhost:{}".format(self.debug_monitor_exe, self.debug_monitor_extra_args, self.port)
if attach_pid:
commandline += " --attach=%d" % attach_pid
Index: test/warnings/uuid/TestAddDsymCommand.py
===================================================================
--- test/warnings/uuid/TestAddDsymCommand.py
+++ test/warnings/uuid/TestAddDsymCommand.py
@@ -3,7 +3,6 @@
import os, time
import unittest2
import lldb
-import pexpect
from lldbtest import *
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits