aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py')
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py118
1 files changed, 65 insertions, 53 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py b/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
index 8ddb6b3a1509..7673846d6df5 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -9,23 +9,24 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_file(self):
"""Test that 'lldb-mi --interpreter %s' loads executable file."""
- self.spawnLldbMi(args = "%s" % self.myexe)
+ self.spawnLldbMi(args="%s" % self.myexe)
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run to main
self.runCmd("-break-insert -f main")
@@ -39,25 +40,27 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_unknown_file(self):
"""Test that 'lldb-mi --interpreter %s' fails on unknown executable file."""
# Prepare path to executable
path = "unknown_file"
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
# Test that the executable isn't loaded when unknown file was specified
self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
+ self.expect(
+ "\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" %
+ (path, path))
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_absolute_path(self):
"""Test that 'lldb-mi --interpreter %s' loads executable which is specified via absolute path."""
@@ -65,69 +68,74 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
import os
path = os.path.join(os.getcwd(), self.myexe)
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
- # Test that the executable is loaded when file was specified using absolute path
+ # Test that the executable is loaded when file was specified using
+ # absolute path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_relative_path(self):
"""Test that 'lldb-mi --interpreter %s' loads executable which is specified via relative path."""
# Prepare path to executable
path = "./%s" % self.myexe
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
- # Test that the executable is loaded when file was specified using relative path
+ # Test that the executable is loaded when file was specified using
+ # relative path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_unknown_path(self):
"""Test that 'lldb-mi --interpreter %s' fails on executable file which is specified via unknown path."""
# Prepare path to executable
path = "unknown_dir/%s" % self.myexe
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
- # Test that the executable isn't loaded when file was specified using unknown path
+ # Test that the executable isn't loaded when file was specified using
+ # unknown path
self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
+ self.expect(
+ "\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" %
+ (path, path))
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_source_option_start_script(self):
"""Test that 'lldb-mi --interpreter' can execute user's commands after initial commands were executed."""
# Prepared source file
sourceFile = "start_script"
- self.spawnLldbMi(args = "--source %s" % sourceFile)
+ self.spawnLldbMi(args="--source %s" % sourceFile)
# After '-file-exec-and-symbols a.out'
self.expect("-file-exec-and-symbols %s" % self.myexe)
@@ -153,23 +161,23 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test that lldb-mi is ready after execution of --source start_script
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Try to evaluate 'a' expression
self.runCmd("-data-evaluate-expression a")
self.expect("\^done,value=\"10\"")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_source_option_start_script_exit(self):
"""Test that 'lldb-mi --interpreter' can execute a prepared file which passed via --source option."""
# Prepared source file
sourceFile = "start_script_exit"
- self.spawnLldbMi(args = "--source %s" % sourceFile)
+ self.spawnLldbMi(args="--source %s" % sourceFile)
# After '-file-exec-and-symbols a.out'
self.expect("-file-exec-and-symbols %s" % self.myexe)
@@ -203,15 +211,15 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^exit")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_source_option_start_script_error(self):
"""Test that 'lldb-mi --interpreter' stops execution of initial commands in case of error."""
# Prepared source file
sourceFile = "start_script_error"
- self.spawnLldbMi(args = "--source %s" % sourceFile)
+ self.spawnLldbMi(args="--source %s" % sourceFile)
# After '-file-exec-and-symbols a.out'
self.expect("-file-exec-and-symbols %s" % self.myexe)
@@ -222,22 +230,22 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^error")
# Test that lldb-mi is ready after execution of --source start_script
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_log_option(self):
"""Test that 'lldb-mi --log' creates a log file in the current directory."""
-
+
logDirectory = "."
- self.spawnLldbMi(args = "%s --log" % self.myexe)
+ self.spawnLldbMi(args="%s --log" % self.myexe)
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
@@ -245,7 +253,8 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\*stopped,reason=\"exited-normally\"")
# Check log file is created
- import glob,os
+ import glob
+ import os
logFile = glob.glob(logDirectory + "/lldb-mi-*.log")
if not logFile:
@@ -255,23 +264,25 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
for f in logFile:
os.remove(f)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_log_directory_option(self):
"""Test that 'lldb-mi --log --log-dir' creates a log file in the directory specified by --log-dir."""
-
+
# Create log in temp directory
import tempfile
logDirectory = tempfile.gettempdir()
- self.spawnLldbMi(args = "%s --log --log-dir=%s" % (self.myexe,logDirectory))
+ self.spawnLldbMi(
+ args="%s --log --log-dir=%s" %
+ (self.myexe, logDirectory))
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
@@ -279,12 +290,13 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\*stopped,reason=\"exited-normally\"")
# Check log file is created
- import glob,os
+ import glob
+ import os
logFile = glob.glob(logDirectory + "/lldb-mi-*.log")
if not logFile:
- self.fail("log file not found")
-
+ self.fail("log file not found")
+
# Delete log
for f in logFile:
os.remove(f)