[test] Delete some xfailed lldb-mi tests

This is a first pass at removing some lldb-mi tests which have been
xfailed and unmaintained for a while. We have open PRs for most of these
tests already. I've opened up the following additional PRs:

  llvm.org/PR36739 - lldb-mi driver exits properly
  llvm.org/PR36740 - lldb-mi -gdb-set and -gdb-show
  llvm.org/PR36741 - lldb-mi -symbol-xxx

The motivation here is to address timeout and pexpect-related issues in
the test suite. This was discussed on lldb-dev in the thread: "increase
timeout for tests?".

After this change, the lldb-mi tests seem to be in better health (on
Darwin at least). I consistently get:

$ ./bin/llvm-dotest -p TestMi
===================
Test Result Summary
===================
Test Methods:        101
Reruns:                0
Success:              88
Expected Failure:      0
Failure:               0
Error:                 0
Exceptional Exit:      0
Unexpected Success:    0
Skip:                 13
Timeout:               0
Expected Timeout:      0

llvm-svn: 327552
This commit is contained in:
Vedant Kumar 2018-03-14 18:37:13 +00:00
parent e66458a841
commit bee500becb
7 changed files with 0 additions and 638 deletions

View File

@ -1,97 +0,0 @@
"""
Test that the lldb-mi driver exits properly.
"""
from __future__ import print_function
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_exit(self):
"""Test that '-gdb-exit' terminates local debug session and exits."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to main
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test -gdb-exit: try to exit and check that program is finished
self.runCmd("-gdb-exit")
self.expect("\^exit")
import pexpect
self.expect(pexpect.EOF)
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_quit(self):
"""Test that 'quit' exits immediately."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to main
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test quit: try to exit and check that program is finished
self.runCmd("quit")
import pexpect
self.expect(pexpect.EOF)
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_q(self):
"""Test that 'q' exits immediately."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to main
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test q: try to exit and check that program is finished
self.runCmd("q")
import pexpect
self.expect(pexpect.EOF)

View File

@ -1,269 +0,0 @@
"""
Test lldb-mi -gdb-set and -gdb-show commands.
"""
from __future__ import print_function
import unittest2
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_set_target_async_default(self):
"""Test that 'lldb-mi --interpreter' switches to async mode by default."""
self.spawnLldbMi(args=None)
# Switch to sync mode
self.runCmd("-gdb-set target-async off")
self.expect("\^done")
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"off\"")
# Test that -gdb-set switches to async by default
self.runCmd("-gdb-set target-async")
self.expect("\^done")
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"on\"")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFlakeyLinux("llvm.org/pr26028") # Fails in ~1% of cases
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_set_target_async_on(self):
"""Test that 'lldb-mi --interpreter' can execute commands in async mode."""
self.spawnLldbMi(args=None)
# Switch to sync mode
self.runCmd("-gdb-set target-async off")
self.expect("\^done")
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"off\"")
# Test that -gdb-set can switch to async mode
self.runCmd("-gdb-set target-async on")
self.expect("\^done")
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"on\"")
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Test that program is executed in async mode
self.runCmd("-exec-run")
self.expect("\*running")
self.expect("@\"argc=1")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@expectedFailureAll(
oslist=["linux"],
bugnumber="Failing in ~11/600 dosep runs (build 3120-3122)")
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_set_target_async_off(self):
"""Test that 'lldb-mi --interpreter' can execute commands in sync mode."""
self.spawnLldbMi(args=None)
# Test that -gdb-set can switch to sync mode
self.runCmd("-gdb-set target-async off")
self.expect("\^done")
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"off\"")
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Test that program is executed in async mode
self.runCmd("-exec-run")
unexpected = ["\*running"] # "\*running" is async notification
it = self.expect(unexpected + ["@\"argc=1\\\\r\\\\n"])
if it < len(unexpected):
self.fail("unexpected found: %s" % unexpected[it])
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_show_target_async(self):
"""Test that 'lldb-mi --interpreter' in async mode by default."""
self.spawnLldbMi(args=None)
# Test that default target-async value is "on"
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"on\"")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_show_language(self):
"""Test that 'lldb-mi --interpreter' can get current language."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to main
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test that -gdb-show language gets current language
self.runCmd("-gdb-show language")
self.expect("\^done,value=\"c\+\+\"")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@unittest2.expectedFailure("-gdb-set ignores unknown properties")
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_set_unknown(self):
"""Test that 'lldb-mi --interpreter' fails when setting an unknown property."""
self.spawnLldbMi(args=None)
# Test that -gdb-set fails if property is unknown
self.runCmd("-gdb-set unknown some_value")
self.expect("\^error")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@unittest2.expectedFailure("-gdb-show ignores unknown properties")
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_show_unknown(self):
"""Test that 'lldb-mi --interpreter' fails when showing an unknown property."""
self.spawnLldbMi(args=None)
# Test that -gdb-show fails if property is unknown
self.runCmd("-gdb-show unknown")
self.expect("\^error")
@expectedFailureAll(
oslist=["windows"],
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_set_ouptut_radix(self):
"""Test that 'lldb-mi --interpreter' works for -gdb-set output-radix."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to BP_printf
line = line_number('main.cpp', '// BP_printf')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Setup variable
self.runCmd("-var-create var_a * a")
self.expect(
"\^done,name=\"var_a\",numchild=\"0\",value=\"10\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
# Test default output
self.runCmd("-var-evaluate-expression var_a")
self.expect("\^done,value=\"10\"")
# Test hex output
self.runCmd("-gdb-set output-radix 16")
self.expect("\^done")
self.runCmd("-var-evaluate-expression var_a")
self.expect("\^done,value=\"0xa\"")
# Test octal output
self.runCmd("-gdb-set output-radix 8")
self.expect("\^done")
self.runCmd("-var-evaluate-expression var_a")
self.expect("\^done,value=\"012\"")
# Test decimal output
self.runCmd("-gdb-set output-radix 10")
self.expect("\^done")
self.runCmd("-var-evaluate-expression var_a")
self.expect("\^done,value=\"10\"")
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfDarwin # pexpect is known to be unreliable on Darwin
@skipIfRemote # We do not currently support remote debugging via the MI.
@expectedFailureAll(
bugnumber="llvm.org/pr31485: data-disassemble doesn't follow flavor settings")
def test_lldbmi_gdb_set_disassembly_flavor(self):
"""Test that 'lldb-mi --interpreter' works for -gdb-set disassembly-flavor."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to BP_printf
line = line_number('main.cpp', '// BP_printf')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\".+addr=\"(0x[0-9a-f]+)\"")
# Get starting and ending address from $pc
pc = int(self.child.match.group(1), base=16)
s_addr, e_addr = pc, pc + 1
# Test default output (att)
self.runCmd("-data-disassemble -s %d -e %d -- 0" % (s_addr, e_addr))
self.expect("movl ")
# Test intel style
self.runCmd("-gdb-set disassembly-flavor intel")
self.expect("\^done")
self.runCmd("-data-disassemble -s %d -e %d -- 0" % (s_addr, e_addr))
self.expect("mov ")
# Test AT&T style
self.runCmd("-gdb-set disassembly-flavor intel")
self.expect("\^done")
self.runCmd("-data-disassemble -s %d -e %d -- 0" % (s_addr, e_addr))
self.expect("movl ")

View File

@ -15,29 +15,6 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFailureAll(
oslist=["linux"],
bugnumber="llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped")
def test_lldbmi_exec_run(self):
"""Test that 'lldb-mi --interpreter' can stop at entry."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Test that program is stopped at entry
self.runCmd("-exec-run --start")
self.expect("\^running")
self.expect(
"\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"")
# Test that lldb-mi is ready to execute next commands
self.expect(self.child_prompt, exactly=True)
@skipIfRemote # We do not currently support remote debugging via the MI.
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races

View File

@ -112,53 +112,6 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that program exited normally
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
@expectedFailureAll(
oslist=["linux"],
bugnumber="Failing in ~9/600 dosep runs (build 3120-3122)")
@skipIfRemote # We do not currently support remote debugging via the MI.
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."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Test that "settings set target.run-args" passes arguments to executable
# FIXME: --arg1 causes an error
self.runCmd(
"-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
self.expect("\^done")
# Run to BP_printf
line = line_number('main.cpp', '// BP_printf')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Run to BP_return
line = line_number('main.cpp', '// BP_return')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"2\"")
self.runCmd("-exec-continue")
self.expect("\^running")
# Test that arguments were passed properly
self.expect("@\"argc=5\\\\r\\\\n\"")
self.expect("@\"argv.0.=.*lldb-mi")
self.expect("@\"argv.1.=arg1\\\\r\\\\n\"")
self.expect("@\"argv.2.=2nd arg\\\\r\\\\n\"")
self.expect("@\"argv.3.=third_arg\\\\r\\\\n\"")
self.expect("@\"argv.4.=fourth=4th arg\\\\r\\\\n\"")
# Hit BP_return
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.

View File

@ -1,104 +0,0 @@
"""
Test lldb-mi -symbol-xxx commands.
"""
from __future__ import print_function
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class MiSymbolTestCase(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
@skipIfRemote # We do not currently support remote debugging via the MI.
@expectedFailureAll(
oslist=["linux"],
bugnumber="new failure after r256863")
def test_lldbmi_symbol_list_lines_file(self):
"""Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to main
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Get address of main and its line
self.runCmd("-data-evaluate-expression main")
self.expect(
"\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
line = line_number('main.cpp', '// FUNC_main')
# Test that -symbol-list-lines works on valid data
self.runCmd("-symbol-list-lines main.cpp")
self.expect(
"\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" %
(addr, line))
# Test that -symbol-list-lines doesn't include lines from other sources
# by checking the first and last line, and making sure the other lines
# are between 30 and 39.
sline = line_number(
'symbol_list_lines_inline_test2.cpp',
'// FUNC_gfunc2')
eline = line_number(
'symbol_list_lines_inline_test2.cpp',
'// END_gfunc2')
self.runCmd("-symbol-list-lines symbol_list_lines_inline_test2.cpp")
self.expect(
"\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*\]" %
(sline, eline))
# FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716 (fixed in newer versions of clang)
##sline = line_number('symbol_list_lines_inline_test.cpp', '// FUNC_gfunc')
##eline = line_number('symbol_list_lines_inline_test.cpp', '// STRUCT_s')
##self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.cpp")
##self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}\]" % (sline, eline))
# Test that -symbol-list-lines works on header files by checking the first
# and last line, and making sure the other lines are under 29.
sline = line_number('symbol_list_lines_inline_test.h', '// FUNC_ifunc')
eline = line_number('symbol_list_lines_inline_test.h', '// FUNC_mfunc')
self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.h")
self.expect(
"\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d\"\})*(,\{pc=\"0x[0-9a-f]+\",line=\"1\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"2\d\"\})*\]" %
(sline, eline))
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_file")
self.expect(
"\^error,message=\"error: No source filenames matched 'unknown_file'\. \"")
# Test that -symbol-list-lines fails when file is specified using
# relative path
self.runCmd("-symbol-list-lines ./main.cpp")
self.expect(
"\^error,message=\"error: No source filenames matched '\./main\.cpp'\. \"")
# Test that -symbol-list-lines works when file is specified using
# absolute path
import os
path = os.path.join(self.getSourceDir(), "main.cpp")
self.runCmd("-symbol-list-lines \"%s\"" % path)
self.expect(
"\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" %
(addr, line))
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_dir/main.cpp")
self.expect(
"\^error,message=\"error: No source filenames matched 'unknown_dir/main\.cpp'\. \"")

View File

@ -66,29 +66,6 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
@expectedFailureAll(
oslist=["linux"],
bugnumber="Failing in ~6/600 dosep runs (build 3120-3122)")
def test_lldbmi_process_output(self):
"""Test that 'lldb-mi --interpreter' wraps process output correctly."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run
self.runCmd("-exec-run")
self.expect("\^running")
# Test that a process output is wrapped correctly
self.expect("\@\"'\\\\r\\\\n\"")
self.expect("\@\"` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"")
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.

View File

@ -171,81 +171,6 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect(
"\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
@skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
@expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipIfRemote # We do not currently support remote debugging via the MI.
def test_lldbmi_gdb_set_show_print_expand_aggregates(self):
"""Test that 'lldb-mi --interpreter' can expand aggregates everywhere."""
self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to BP_gdb_set_show_print_expand_aggregates
line = line_number(
'main.cpp',
'// BP_gdb_set_show_print_expand_aggregates')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test that default print expand-aggregates value is "off"
self.runCmd("-gdb-show print expand-aggregates")
self.expect("\^done,value=\"off\"")
# Test that composite type isn't expanded when print expand-aggregates
# is "off"
self.runCmd("-var-create var1 * complx")
self.expect(
"\^done,name=\"var1\",numchild=\"3\",value=\"{\.\.\.}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
# Test that composite type[] isn't expanded when print
# expand-aggregates is "off"
self.eval_and_check_array("complx_array", "complex_type", 2)
# Test that a struct with a char first element is not formatted as a
# string
self.runCmd("-var-create - * &nstr")
self.expect(
"\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"")
# Test that -gdb-set can set print expand-aggregates flag
self.runCmd("-gdb-set print expand-aggregates on")
self.expect("\^done")
self.runCmd("-gdb-set print expand-aggregates 1")
self.expect("\^done")
self.runCmd("-gdb-show print expand-aggregates")
self.expect("\^done,value=\"on\"")
# Test that composite type is expanded when print expand-aggregates is
# "on"
self.runCmd("-var-create var3 * complx")
self.expect(
"\^done,name=\"var3\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
# Test that composite type[] is expanded when print expand-aggregates
# is "on"
self.runCmd("-var-create var4 * complx_array")
self.expect(
"\^done,name=\"var4\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
# Test that -gdb-set print expand-aggregates fails if "on"/"off" isn't
# specified
self.runCmd("-gdb-set print expand-aggregates")
self.expect(
"\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
# Test that -gdb-set print expand-aggregates fails when option is
# unknown
self.runCmd("-gdb-set print expand-aggregates unknown")
self.expect(
"\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
@skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
@expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races