summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-02-15 07:41:12 +0000
committerPavel Labath <pavel@labath.sk>2019-02-15 07:41:12 +0000
commit8d6b60c14ceaa7cb05aa470d874450ed4083b173 (patch)
tree338ce250e8d9bd3bd70aef48a6def1a9a5f15740 /lldb/packages/Python/lldbsuite/test/python_api
parent8c02e778ffc8271da94d1e2b090000c1f7833827 (diff)
downloadbcm5719-llvm-8d6b60c14ceaa7cb05aa470d874450ed4083b173.tar.gz
bcm5719-llvm-8d6b60c14ceaa7cb05aa470d874450ed4083b173.zip
Embed swig version into lldb.py in a different way
Summary: Instead of doing string chopping on the resulting python file, get swig to output the version for us. The two things which make slightly non-trivial are: - in order to get swig to expand SWIG_VERSION for us, we cannot use %pythoncode directly, but we have to go through an intermediate macro. - SWIG_VERSION is a hex number, but it's components are supposed to be interpreted decimally, so there is a bit of integer magic needed to get the right number to come out. I've tested that this approach works both with the latest (3.0.12) and oldest (1.3.40) supported swig. Reviewers: zturner, jingham, serge-sans-paille Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58172 llvm-svn: 354104
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api')
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py b/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py
new file mode 100644
index 00000000000..58e47d9a79f
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/TestSwigVersion.py
@@ -0,0 +1,28 @@
+"""
+Test that we embed the swig version into the lldb module
+"""
+
+from __future__ import print_function
+
+"""
+import os
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbutil
+"""
+from lldbsuite.test.lldbtest import *
+
+class SwigVersionTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test(self):
+ self.assertTrue(getattr(lldb, "swig_version"))
+ self.assertIsInstance(lldb.swig_version, tuple)
+ self.assertEqual(len(lldb.swig_version), 3)
+ self.assertGreaterEqual(lldb.swig_version[0], 1)
+ for v in lldb.swig_version:
+ self.assertGreaterEqual(v, 0)
OpenPOWER on IntegriCloud