Skip to content

Commit

Permalink
Make LLDB-MI tests wait for LLDB-MI to start up before sending any MI…
Browse files Browse the repository at this point in the history
… commands

Summary:
This set of changes addresses the issue I described in [[ http://llvm.org/pr23403 | Bug 23403 ]], in short most LLDB-MI tests fail unexpectedly due to timeout on my Ubuntu 14.10 x86_64 VirtualBox VM. I have no idea why the Ubuntu buildbots don't seem to suffer from this issue. This patch just makes **MiTestCaseBase.spawnLldbMi()** block until the spawned LLDB-MI child process outputs the **(gdb)** prompt, which ensures that MI commands aren't sent to the LLDB-MI child process until it's ready.

Before these changes 52 LLDB-MI tests failed unexpectedly (all but one due to timeouts), after these changes no tests fail due to timeouts. I still get one unexpected failure in **test_lldbmi_source_option_start_script_error** in **TestMiStartupOptions.py**, but that's due to a file error, that test should be skipped on Linux just like the other two //start_script// tests until the file error is fixed.

Patch from Vadim Macagon. Thanks!

Test Plan: ./dotest.py -A x86_64 -C clang --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh, domipheus, ki.stfu

Reviewed By: ki.stfu

Subscribers: brucem, lldb-commits

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

llvm-svn: 236816
  • Loading branch information
waywardmonkeys committed May 8, 2015
1 parent 42544d6 commit 3a6cc51
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 25 deletions.
3 changes: 0 additions & 3 deletions lldb/test/tools/lldb-mi/TestMiPrompt.py
Expand Up @@ -18,9 +18,6 @@ def test_lldbmi_prompt(self):

self.spawnLldbMi(args = None)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# Test that lldb-mi is ready after unknown command
self.runCmd("-unknown-command")
self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
Expand Down
1 change: 0 additions & 1 deletion lldb/test/tools/lldb-mi/data/TestMiData.py
Expand Up @@ -85,7 +85,6 @@ def test_lldbmi_data_read_memory_bytes_local(self):
"""Test that -data-read-memory-bytes can access local buffers."""

self.spawnLldbMi(args = None)
self.expect(self.child_prompt, exactly = True)

# Load executable
self.runCmd('-file-exec-and-symbols %s' % self.myexe)
Expand Down
2 changes: 2 additions & 0 deletions lldb/test/tools/lldb-mi/lldbmi_testcase.py
Expand Up @@ -36,6 +36,8 @@ def spawnLldbMi(self, args=None):
self.lldbMiExec, args if args else ""))
self.child.setecho(True)
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)

def runCmd(self, cmd):
self.child.sendline(cmd)
Expand Down
21 changes: 0 additions & 21 deletions lldb/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
Expand Up @@ -18,9 +18,6 @@ def test_lldbmi_executable_option_file(self):

self.spawnLldbMi(args = "%s" % self.myexe)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
Expand All @@ -44,9 +41,6 @@ def test_lldbmi_executable_option_unknown_file(self):

self.spawnLldbMi(args = "%s" % path)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# 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))
Expand All @@ -66,9 +60,6 @@ def test_lldbmi_executable_option_absolute_path(self):

self.spawnLldbMi(args = "%s" % path)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# Test that the executable is loaded when file was specified using absolute path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
Expand All @@ -92,9 +83,6 @@ def test_lldbmi_executable_option_relative_path(self):

self.spawnLldbMi(args = "%s" % path)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# Test that the executable is loaded when file was specified using relative path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
Expand All @@ -118,9 +106,6 @@ def test_lldbmi_executable_option_unknown_path(self):

self.spawnLldbMi(args = "%s" % path)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# 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))
Expand Down Expand Up @@ -241,9 +226,6 @@ def test_lldbmi_log_option(self):
logDirectory = "."
self.spawnLldbMi(args = "%s --log" % self.myexe)

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
Expand Down Expand Up @@ -279,9 +261,6 @@ def test_lldbmi_log_directory_option(self):

self.spawnLldbMi(args = "%s --log --log-dir=%s" % (self.myexe,logDirectory))

# Test that lldb-mi is ready after startup
self.expect(self.child_prompt, exactly = True)

# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
Expand Down

0 comments on commit 3a6cc51

Please sign in to comment.