summaryrefslogtreecommitdiffstats
path: root/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-06 20:12:03 +0000
committerdim <dim@FreeBSD.org>2016-01-06 20:12:03 +0000
commit78b9749c0a4ea980a8b934645da6ae98fcc665e8 (patch)
treedd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
parent60cb593f9d55fa5ca7a5372b731f2330345b4b9a (diff)
downloadFreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.zip
FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.tar.gz
Vendor import of lldb trunk r256945:
https://llvm.org/svn/llvm-project/lldb/trunk@256945
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py')
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py b/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
new file mode 100644
index 0000000..277ffe7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -0,0 +1,54 @@
+"""
+Base class for lldb-mi test cases.
+"""
+
+from __future__ import print_function
+
+
+
+from lldbsuite.test.lldbtest import *
+
+class MiTestCaseBase(Base):
+
+ mydir = None
+ myexe = "a.out"
+ mylog = "child.log"
+
+ def getCategories(self):
+ return ['lldb-mi']
+
+ @classmethod
+ def classCleanup(cls):
+ TestBase.RemoveTempFile(cls.myexe)
+ TestBase.RemoveTempFile(cls.mylog)
+
+ def setUp(self):
+ Base.setUp(self)
+ self.buildDefault()
+ self.child_prompt = "(gdb)"
+
+ def tearDown(self):
+ if self.TraceOn():
+ print("\n\nContents of %s:" % self.mylog)
+ try:
+ print(open(self.mylog, "r").read())
+ except IOError:
+ pass
+ Base.tearDown(self)
+
+ def spawnLldbMi(self, args=None):
+ import pexpect
+ self.child = pexpect.spawn("%s --interpreter %s" % (
+ 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)
+
+ def expect(self, pattern, exactly=False, *args, **kwargs):
+ if exactly:
+ return self.child.expect_exact(pattern, *args, **kwargs)
+ return self.child.expect(pattern, *args, **kwargs)
OpenPOWER on IntegriCloud