Skip to content

Commit

Permalink
Refactor lldb-mi tests
Browse files Browse the repository at this point in the history
Summary:
This patch includes following changes:
* split lldb-mi tests into separate folders. It will make our life simpler because we can modify a test program of certain test and don't worry about other tests
* a bit refactoring
* fix comments
* improve some tests

Reviewers: emaste, clayborg, abidh

Reviewed By: clayborg, abidh

Subscribers: clayborg, lldb-commits, emaste, abidh

Differential Revision: http://reviews.llvm.org/D7762

llvm-svn: 230022
  • Loading branch information
k15tfu committed Feb 20, 2015
1 parent f4b269b commit 4e892f9
Show file tree
Hide file tree
Showing 36 changed files with 664 additions and 543 deletions.
2 changes: 1 addition & 1 deletion lldb/test/tools/lldb-mi/Makefile
@@ -1,5 +1,5 @@
LEVEL = ../../make

C_SOURCES := main.c a.c b.c loop.c locals.c
CXX_SOURCES := main.cpp

include $(LEVEL)/Makefile.rules
113 changes: 0 additions & 113 deletions lldb/test/tools/lldb-mi/TestMiBreakpoint.py

This file was deleted.

10 changes: 5 additions & 5 deletions lldb/test/tools/lldb-mi/TestMiExit.py
@@ -1,5 +1,5 @@
"""
Test that the lldb-mi driver works properly with "-gdb-exit".
Test that the lldb-mi driver exits properly.
"""

import lldbmi_testcase
Expand All @@ -8,12 +8,13 @@

class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):

mydir = TestBase.compute_mydir(__file__)

@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdbexit(self):
"""Test that '-gdb-exit' terminates debug session and exits."""
def test_lldbmi_gdb_exit(self):
"""Test that '-gdb-exit' terminates local debug session and exits."""

self.spawnLldbMi(args = None)

Expand All @@ -37,7 +38,6 @@ def test_lldbmi_gdbexit(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_quit(self):
"""Test that 'quit' exits immediately."""

Expand Down
@@ -1,79 +1,80 @@
"""
Test various ways the lldb-mi driver can launch a program.
Test lldb-mi -file-xxx commands.
"""

import lldbmi_testcase
from lldbtest import *
import unittest2

class MiLaunchTestCase(lldbmi_testcase.MiTestCaseBase):
class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):

mydir = TestBase.compute_mydir(__file__)

@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exe(self):
def test_lldbmi_file_exec_and_symbols_file(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""

self.spawnLldbMi(args = None)

# Use no path
# Test that -file-exec-and-symbols works for filename
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")

# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")

@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_abspathexe(self):
def test_lldbmi_file_exec_and_symbols_absolute_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""

self.spawnLldbMi(args = None)

# Use full path
# Test that -file-exec-and-symbols works for absolute path
import os
exe = os.path.join(os.getcwd(), self.myexe)
self.runCmd("-file-exec-and-symbols %s" % exe)
path = os.path.join(os.getcwd(), self.myexe)
self.runCmd("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")

# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")

@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_relpathexe(self):
def test_lldbmi_file_exec_and_symbols_relative_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""

self.spawnLldbMi(args = None)

# Use relative path
exe = "../../" + self.mydir + "/" + self.myexe
self.runCmd("-file-exec-and-symbols %s" % exe)
# Test that -file-exec-and-symbols works for relative path
path = "./%s" % self.myexe
self.runCmd("-file-exec-and-symbols %s" % path)
self.expect("\^done")

# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")

@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_badpathexe(self):
def test_lldbmi_file_exec_and_symbols_unknown_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""

self.spawnLldbMi(args = None)

# Use non-existant path
exe = "badpath/" + self.myexe
self.runCmd("-file-exec-and-symbols %s" % exe)
# Test that -file-exec-and-symbols fails on unknown path
path = "unknown_dir/%s" % self.myexe
self.runCmd("-file-exec-and-symbols %s" % path)
self.expect("\^error")

if __name__ == '__main__':
Expand Down
21 changes: 5 additions & 16 deletions lldb/test/tools/lldb-mi/TestMiInterpreterExec.py
@@ -1,5 +1,5 @@
"""
Test that the lldb-mi driver works with -interpreter-exec command
Test lldb-mi -interpreter-exec command.
"""

import lldbmi_testcase
Expand All @@ -8,6 +8,8 @@

class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):

mydir = TestBase.compute_mydir(__file__)

@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("lldb-mi handles double quotes in passed app path incorrectly")
Expand All @@ -30,7 +32,6 @@ def test_lldbmi_target_create(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_breakpoint_set(self):
"""Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""

Expand All @@ -52,7 +53,6 @@ def test_lldbmi_breakpoint_set(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_settings_set_target_run_args_before(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""

Expand All @@ -67,10 +67,7 @@ def test_lldbmi_settings_set_target_run_args_before(self):
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")

# Run to BP_argctest
line = line_number('main.c', '//BP_argctest')
self.runCmd("-break-insert --file main.c:%d" % line)
self.expect("\^done")
# Run
self.runCmd("-exec-run")
self.expect("\^running")

Expand All @@ -80,7 +77,6 @@ def test_lldbmi_settings_set_target_run_args_before(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_settings_set_target_run_args_after(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""

Expand All @@ -95,10 +91,7 @@ def test_lldbmi_settings_set_target_run_args_after(self):
self.runCmd("-interpreter-exec console \"setting set target.run-args arg1\"")
self.expect("\^done")

# Run to BP_argctest
line = line_number('main.c', '//BP_argctest')
self.runCmd("-break-insert --file main.c:%d" % line)
self.expect("\^done")
# Run
self.runCmd("-exec-run")
self.expect("\^running")

Expand All @@ -108,7 +101,6 @@ def test_lldbmi_settings_set_target_run_args_after(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_process_launch(self):
"""Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""

Expand All @@ -132,7 +124,6 @@ def test_lldbmi_process_launch(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_in(self):
"""Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""

Expand All @@ -159,7 +150,6 @@ def test_lldbmi_thread_step_in(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_over(self):
"""Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""

Expand All @@ -185,7 +175,6 @@ def test_lldbmi_thread_step_over(self):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_continue(self):
"""Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""

Expand Down

0 comments on commit 4e892f9

Please sign in to comment.