[Lldb-commits] [lldb] r349607 - refactor testsuite spawnLldbMi args->exe+args
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 19 00:57:11 PST 2018
Author: jankratochvil
Date: Wed Dec 19 00:57:10 2018
New Revision: 349607
URL: http://llvm.org/viewvc/llvm-project?rev=349607&view=rev
Log:
refactor testsuite spawnLldbMi args->exe+args
Currently spawnLldbMi accepts both lldb-mi options and executable to debug as
a single parameter. Split them.
As in D55859 we will need to execute one lldb-mi command before loading the
exe. Therefore we can no longer use the exe as lldb-mi command-line parameter
as then there is no way to execute a command before loading exe specified as
lldb-mi command-line parameter.
LocateExecutableSymbolFileDsym should be static, that is also a little
refactorization.
Differential Revision: https://reviews.llvm.org/D55858
Modified:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
lldb/trunk/source/Host/common/Symbols.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=349607&r1=349606&r2=349607&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py Wed Dec 19 00:57:10 2018
@@ -40,7 +40,7 @@ class MiTestCaseBase(Base):
pass
Base.tearDown(self)
- def spawnLldbMi(self, args=None):
+ def spawnLldbMi(self, exe=None, args=None):
import pexpect
self.child = pexpect.spawn("%s --interpreter %s" % (
self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@ class MiTestCaseBase(Base):
self.child.logfile_read = open(self.mylog, "w")
# wait until lldb-mi has started up and is ready to go
self.expect(self.child_prompt, exactly=True)
+ if exe:
+ self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
+ # Testcases expect to be able to match output of this command,
+ # see test_lldbmi_specialchars.
def runCmd(self, cmd):
self.child.sendline(cmd)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=349607&r1=349606&r2=349607&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py Wed Dec 19 00:57:10 2018
@@ -22,7 +22,7 @@ class MiStartupOptionsTestCase(lldbmi_te
def test_lldbmi_executable_option_file(self):
"""Test that 'lldb-mi --interpreter %s' loads executable file."""
- self.spawnLldbMi(args="%s" % self.myexe)
+ self.spawnLldbMi(exe=self.myexe)
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -52,7 +52,7 @@ class MiStartupOptionsTestCase(lldbmi_te
# Prepare path to executable
path = "unknown_file"
- self.spawnLldbMi(args="%s" % path)
+ self.spawnLldbMi(exe=path)
# Test that the executable isn't loaded when unknown file was specified
self.expect("-file-exec-and-symbols \"%s\"" % path)
@@ -71,7 +71,7 @@ class MiStartupOptionsTestCase(lldbmi_te
"""Test that 'lldb-mi --interpreter %s' loads executable which is specified via absolute path."""
# Prepare path to executable
- self.spawnLldbMi(args="%s" % self.myexe)
+ self.spawnLldbMi(exe=self.myexe)
# Test that the executable is loaded when file was specified using
# absolute path
@@ -95,7 +95,7 @@ class MiStartupOptionsTestCase(lldbmi_te
# Prepare path to executable
path = os.path.relpath(self.myexe, self.getBuildDir())
- self.spawnLldbMi(args="%s" % path)
+ self.spawnLldbMi(exe=path)
# Test that the executable is loaded when file was specified using
# relative path
@@ -119,7 +119,7 @@ class MiStartupOptionsTestCase(lldbmi_te
# Prepare path to executable
path = "unknown_dir" + self.myexe
- self.spawnLldbMi(args="%s" % path)
+ self.spawnLldbMi(exe=path)
# Test that the executable isn't loaded when file was specified using
# unknown path
@@ -259,7 +259,7 @@ class MiStartupOptionsTestCase(lldbmi_te
"""Test that 'lldb-mi --log' creates a log file in the current directory."""
logDirectory = self.getBuildDir()
- self.spawnLldbMi(args="%s --log" % self.myexe)
+ self.spawnLldbMi(exe=self.myexe, args="--log")
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -296,9 +296,8 @@ class MiStartupOptionsTestCase(lldbmi_te
import tempfile
logDirectory = tempfile.gettempdir()
- self.spawnLldbMi(
- args="%s --log --log-dir=%s" %
- (self.myexe, logDirectory))
+ self.spawnLldbMi(exe=self.myexe,
+ args="--log --log-dir=%s" % logDirectory)
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=349607&r1=349606&r2=349607&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py Wed Dec 19 00:57:10 2018
@@ -53,7 +53,7 @@ class MiSyntaxTestCase(lldbmi_testcase.M
os.symlink(self.myexe, complicated_myexe)
self.addTearDownHook(lambda: os.unlink(complicated_myexe))
- self.spawnLldbMi(args="\"%s\"" % complicated_myexe)
+ self.spawnLldbMi(exe=complicated_myexe)
# Test that the executable was loaded
self.expect(
Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=349607&r1=349606&r2=349607&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Wed Dec 19 00:57:10 2018
@@ -199,7 +199,7 @@ static bool LocateDSYMInVincinityOfExecu
return false;
}
-FileSpec LocateExecutableSymbolFileDsym(const ModuleSpec &module_spec) {
+static FileSpec LocateExecutableSymbolFileDsym(const ModuleSpec &module_spec) {
const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
const ArchSpec *arch = module_spec.GetArchitecturePtr();
const UUID *uuid = module_spec.GetUUIDPtr();
More information about the lldb-commits
mailing list