summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-05-26 08:38:02 +0000
committerPavel Labath <labath@google.com>2016-05-26 08:38:02 +0000
commit0314b00daa5a3f611221d4cc6faa8fd876211392 (patch)
treea41772e0fb89285d427dc76cfd94a7bdca2bf221 /lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
parenteb5f178c4b50e7d148e8071d56d2cc52c594ac9c (diff)
downloadbcm5719-llvm-0314b00daa5a3f611221d4cc6faa8fd876211392.tar.gz
bcm5719-llvm-0314b00daa5a3f611221d4cc6faa8fd876211392.zip
Avoid using stdio in TestVirtual
Summary: using stdio in tests does not work on windows, and it is not completely reliable on linux. Avoid using stdio in this test, as it is not necessary for this purpose. Reviewers: clayborg Subscribers: lldb-commits, zturner Differential Revision: http://reviews.llvm.org/D20567 llvm-svn: 270831
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
index 3dc487fa304..bee148773f0 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
@@ -22,9 +22,6 @@ class CppVirtualMadness(TestBase):
# printf() stmts (see main.cpp).
pattern = re.compile("^([^=]*) = '([^=]*)'$")
- # Assert message.
- PRINTF_OUTPUT_GROKKED = "The printf output from compiled code is parsed correctly"
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -58,11 +55,13 @@ class CppVirtualMadness(TestBase):
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
- # First, capture the golden output from the program itself from the
- # series of printf statements.
- stdout = process.GetSTDOUT(1024)
-
- self.assertIsNotNone(stdout, "Encountered an error reading the process's output")
+ # First, capture the golden output from the program itself.
+ golden = thread.GetFrameAtIndex(0).FindVariable("golden")
+ self.assertTrue(golden.IsValid(), "Encountered an error reading the process's golden variable")
+ error = lldb.SBError()
+ golden_str = process.ReadCStringFromMemory(golden.AddressOf().GetValueAsUnsigned(), 4096, error);
+ self.assertTrue(error.Success())
+ self.assertTrue("c_as_C" in golden_str)
# This golden list contains a list of "my_expr = 'value' pairs extracted
# from the golden output.
@@ -72,7 +71,7 @@ class CppVirtualMadness(TestBase):
#
# my_expr = 'value'
#
- for line in stdout.split(os.linesep):
+ for line in golden_str.split(os.linesep):
match = self.pattern.search(line)
if match:
my_expr, val = match.group(1), match.group(2)
OpenPOWER on IntegriCloud